Compare commits
1807 Commits
Author | SHA1 | Date | |
---|---|---|---|
898d889537 | |||
0e2964261f | |||
ffe7d8d024 | |||
c01ebbcbde | |||
a6e5914aa7 | |||
6d8de214eb | |||
5bf3c54cd3 | |||
959b64777f | |||
be0af135bc | |||
2d7c58540f | |||
951038a304 | |||
912ee199ed | |||
b9329dc49a | |||
6e08e1ae97 | |||
dd1d2b4d00 | |||
f6d53cc568 | |||
b6cc815447 | |||
ddbbb8afec | |||
a8a497c621 | |||
5c03416e84 | |||
b732c445b8 | |||
97ec88e346 | |||
192bc4fcf0 | |||
fc4ea57a9c | |||
751497a748 | |||
c714e8baa6 | |||
2331a00555 | |||
4218cd13d5 | |||
030dfde38e | |||
901e2fd692 | |||
c03ca3c278 | |||
af2268ebd7 | |||
b9876d1809 | |||
e64909cdcd | |||
ce2ad69e5f | |||
56fb08621e | |||
4457c8218d | |||
c862f199e3 | |||
7918b26f65 | |||
df00d3b046 | |||
19735e7050 | |||
bb63646682 | |||
b4fcf2ee60 | |||
d9eacd1616 | |||
5309c7e082 | |||
dbe57742e6 | |||
928c625e2c | |||
1e00603241 | |||
f6442f2752 | |||
7b7ab823b0 | |||
0410fd4824 | |||
02fa32422a | |||
12037961ff | |||
8c572dead1 | |||
3ddfebe742 | |||
972bbb7e06 | |||
45f315e603 | |||
b9e86103cf | |||
0588589d57 | |||
4d30f60bbe | |||
d58dcf29cc | |||
809457599a | |||
2d19fb7f8c | |||
2c9401ed74 | |||
af23596c34 | |||
233945e60f | |||
147f735333 | |||
8de5b2beda | |||
b02c3dfe8d | |||
c5d3895313 | |||
d20bcdae12 | |||
81cd68b60d | |||
0582b3daba | |||
af0a205594 | |||
06e2e8119e | |||
8b78f19335 | |||
9784393b15 | |||
65da797112 | |||
75fe981b9d | |||
caaf33e4cf | |||
d642db6f66 | |||
3740b83f63 | |||
90cdef8400 | |||
ee649ae69a | |||
20d155e630 | |||
be5996daca | |||
38dfebad8c | |||
a5a05e454e | |||
32d9850263 | |||
a5ea8cc5cb | |||
0ad6b4105a | |||
f765597526 | |||
8ca4f22f1d | |||
674b84d908 | |||
e2ca239be0 | |||
4f237687ce | |||
5b2d2efb45 | |||
82473c85e0 | |||
51ced0cf41 | |||
6c4a444f29 | |||
330c80f3f5 | |||
eee59ec9ce | |||
0959d33ba0 | |||
ca82715bfa | |||
0c05b2cb50 | |||
b2d048aa0e | |||
3ee15e65aa | |||
1bf1c38b30 | |||
eb4a78bcc3 | |||
37afa876a7 | |||
601c51b351 | |||
20d4dada40 | |||
901b75e756 | |||
bc3d7d11fe | |||
490d20e8fb | |||
2113c21fdc | |||
e09c1a1c11 | |||
b104bb4762 | |||
f41ea24e97 | |||
3c655a4b84 | |||
b90e66f7c7 | |||
4446dbde5e | |||
769351b30f | |||
734cbb2f1e | |||
acbe8ad398 | |||
9898066b47 | |||
82635ce606 | |||
8c7433a525 | |||
56ef9e0643 | |||
e6328dfe82 | |||
3a48e3781b | |||
f9056da6be | |||
536feb632c | |||
cafa41ba4d | |||
196d96cfa7 | |||
4e6f95e152 | |||
de9fa6a334 | |||
abd7071eaa | |||
7e68791bee | |||
6c6b18d003 | |||
4da9d4e53a | |||
0ca764968a | |||
62b64d39ab | |||
ae87fbf8e3 | |||
2e890580fc | |||
afda5e684b | |||
9161eebc68 | |||
683254a0db | |||
2885aea65c | |||
523ea68ae2 | |||
ca88e1f1cf | |||
be37d025b8 | |||
4342b71d7a | |||
f20602a7b1 | |||
f311b4111b | |||
61d6ada88d | |||
506c74270c | |||
4d13ddd48c | |||
cc89290eb6 | |||
5bce3e37ee | |||
6671d5553b | |||
41b3b54bf8 | |||
096db53822 | |||
f9148bf9cb | |||
a880f93166 | |||
fd81a7fe63 | |||
65b7893a8a | |||
597dee40fd | |||
2c995f1f91 | |||
68d950c344 | |||
0bcc7d46a3 | |||
93b673043c | |||
de1b745988 | |||
efdbd6326f | |||
25c3d3a452 | |||
548730660b | |||
7ee3743c3d | |||
37b89b3944 | |||
8b9519f0af | |||
529515d1d1 | |||
69d0562e2c | |||
7913fa7bbd | |||
b543868351 | |||
0f17077b3d | |||
9da8bf37d7 | |||
e5cc487b95 | |||
726136beda | |||
59eb09d063 | |||
b9dba97fdb | |||
25a5275921 | |||
e731fc1a3a | |||
90e1262a8b | |||
246f86dad3 | |||
d736074301 | |||
368efaa2ba | |||
2f18a92e20 | |||
affbca74b4 | |||
4c455876f9 | |||
cecfa99b7b | |||
b3cac538cc | |||
587b1e05d1 | |||
02c3727ccd | |||
af471af8ef | |||
e28838805f | |||
8a9762331f | |||
31db6f8f36 | |||
ad1e83d8b9 | |||
bbd9915056 | |||
51fecc0be9 | |||
6f854c8391 | |||
9b8444fff1 | |||
43e317f0b7 | |||
0e40181d8f | |||
63b62ebf4c | |||
569de22481 | |||
9085a04b16 | |||
c7df61a3c3 | |||
c278f05181 | |||
61a9c27af0 | |||
e9b2613d5f | |||
24469a7f43 | |||
56096be8b6 | |||
8ef78e7e7d | |||
504738b183 | |||
32cd2a02c9 | |||
4a109658ab | |||
52d9612301 | |||
d8b89b0c86 | |||
e0ad854d19 | |||
0e26917c72 | |||
3df60995e1 | |||
1a5e7cb0cb | |||
8035afae87 | |||
284e5d83b5 | |||
2b3e1d5c10 | |||
2c328d61ad | |||
76f9b4c582 | |||
c589bc4c57 | |||
d6a1868d0a | |||
9f31cbd8b8 | |||
c0262d8f76 | |||
92702615a7 | |||
c9d3f3ab96 | |||
72797c25d5 | |||
ea6ce47345 | |||
10855b451d | |||
3265b3594b | |||
cafc46a8e9 | |||
5993b178c5 | |||
24e286b5ec | |||
c63de27633 | |||
a84a256df4 | |||
88dfa860f4 | |||
83bc5d95aa | |||
09c61d5cb1 | |||
71c84aee60 | |||
cee09b0d2e | |||
fdb8ea93ef | |||
60ab565185 | |||
1fe251d0a0 | |||
ff931e53b5 | |||
ef376a7919 | |||
09fc9e4d0c | |||
fe3a84a422 | |||
ba56a5b9d1 | |||
a27d8b2910 | |||
b6f6ed35fc | |||
d3cb063d13 | |||
b9125e4256 | |||
0aae86be2e | |||
d9fa07399e | |||
d570adf021 | |||
dcb91c043f | |||
f613930dee | |||
667048310d | |||
642aa3313d | |||
f6e98df8da | |||
d37e44225f | |||
5c172d1a15 | |||
0bf2060a7d | |||
22883b3eeb | |||
6d1dc47368 | |||
f8d05eb625 | |||
45c233c0e7 | |||
b836228465 | |||
8118630861 | |||
bf3e31ece7 | |||
f217ce7ff7 | |||
039790cf26 | |||
e5f82f5457 | |||
a5e4e3fcac | |||
3fe60615df | |||
7b5c1696eb | |||
c7c61b4ac0 | |||
92f24d1988 | |||
9b59bcd995 | |||
43fff1a87e | |||
2aa7138373 | |||
69a438d64d | |||
772551c45d | |||
0c951b6e56 | |||
eadafd8de7 | |||
f9230eb970 | |||
82348e1537 | |||
10bb9919f1 | |||
4769dacf61 | |||
63ec7e58d4 | |||
a963810e02 | |||
69b1da2e1d | |||
dc3d899e70 | |||
78c1d9006a | |||
5dad73647d | |||
13b39a0c3e | |||
90801a94d3 | |||
fab6f4450d | |||
2e04dc03f2 | |||
f8eb6b0067 | |||
7a63fdc447 | |||
4655a59912 | |||
c0668dcdf2 | |||
9cb4bbe2b8 | |||
95d28494f6 | |||
67f678d60a | |||
3993dfa2a5 | |||
935f00ad4c | |||
bafdb54752 | |||
7526ed705c | |||
bccd60125b | |||
7127d2b811 | |||
9cc2733ed8 | |||
3b10fd7557 | |||
f782797dc7 | |||
227b8bfbf6 | |||
385770dcc8 | |||
4f6ca14d4f | |||
c3fc5340b6 | |||
4f30b06930 | |||
398e0b7c63 | |||
b7b014298b | |||
bcaf42e075 | |||
357cb92f2e | |||
31ed86740c | |||
f2cc144811 | |||
1783867f96 | |||
a73638b214 | |||
bd1884e48f | |||
5cd20c0009 | |||
58ebfdffcb | |||
1e2c434ae8 | |||
7107297c25 | |||
35fb602dff | |||
8af3d35234 | |||
323d40a560 | |||
321bca4bf7 | |||
7cb08630d0 | |||
45f0737a00 | |||
6cf478c1b2 | |||
f52a82d9f2 | |||
6dac0c8c4f | |||
5e30eabd30 | |||
7bba867ce8 | |||
e8e6a4702b | |||
c3e2cb9b8e | |||
2e5caa335a | |||
bdabe40c65 | |||
7991a7c50a | |||
4e4fd51117 | |||
e91322bd10 | |||
23cdb3aed5 | |||
bd3d9ee356 | |||
76f1ab33f0 | |||
61fd8463f8 | |||
3883ac08c7 | |||
dd233fdb8d | |||
18aea2d3d3 | |||
74e22368b5 | |||
d03a63e055 | |||
93ab8d46b9 | |||
740eb6ebc4 | |||
d6f0f1a82a | |||
83ef98a9dc | |||
3edfbfec93 | |||
68c004ef68 | |||
e2ae9165c6 | |||
704205c5f7 | |||
21656ba015 | |||
bbcc3304a0 | |||
c6571073fe | |||
ba9fcb31d0 | |||
78c0f0a443 | |||
7656e6b9f8 | |||
39d79f34ab | |||
b3e3d4cacc | |||
3e65ecb93d | |||
ba2a89c760 | |||
eea634a432 | |||
ab19e19f00 | |||
1023ef23b7 | |||
a56fbc1929 | |||
47ce52228b | |||
ff9317365a | |||
0a3ef38cad | |||
9aee72099e | |||
05b2c0743f | |||
4d94ae77b4 | |||
d8143a5e18 | |||
cba739fd6b | |||
fb5237d5b6 | |||
258f95b2cd | |||
b8059d5c87 | |||
66894eb473 | |||
61becbb7e5 | |||
42e453872c | |||
2f42a7c010 | |||
436c1fac1d | |||
16bc9533ed | |||
63a51e2890 | |||
23eaafc4eb | |||
536b7000bc | |||
24cc0904fa | |||
5a65463b92 | |||
c8056452b8 | |||
64e273e9c0 | |||
6f62d6bb34 | |||
d430457f1e | |||
4267cc138e | |||
de2ba8d0f7 | |||
c488fa8461 | |||
608e059b18 | |||
81203b20b8 | |||
91bc32fe51 | |||
d3dacf5c2a | |||
13036a1085 | |||
942ab6fd95 | |||
fd9b2e931f | |||
6de67e828d | |||
2d9f1f7857 | |||
fde8af9483 | |||
c22c0a20f6 | |||
9063209124 | |||
61dc13a6e1 | |||
e3eea6fcbd | |||
7d001458cb | |||
823c9979c0 | |||
9ebcbc94e4 | |||
aa39b0dc24 | |||
2160164e8c | |||
3137f43da9 | |||
efc2a74df1 | |||
9638889614 | |||
0df639f8f5 | |||
011ce35ede | |||
a9802eff02 | |||
f9837163d3 | |||
6bc93d2050 | |||
37a7e9e275 | |||
531e5f9923 | |||
617845a7da | |||
9dc59eff76 | |||
a6c5596782 | |||
022d3857cc | |||
82aa3f59d6 | |||
04d6b03733 | |||
3b22ecc80c | |||
53fe576028 | |||
f6dc99f345 | |||
c0df1169ee | |||
b92884a0ad | |||
a421e31dd5 | |||
7b1c0c4013 | |||
f558b088e6 | |||
99afc74021 | |||
761bb4fdd0 | |||
663a336b83 | |||
e506fda3e4 | |||
42da36ba81 | |||
a730c86907 | |||
b8cba90d85 | |||
9090edebb0 | |||
49d76c6311 | |||
5717dfe3b9 | |||
c576cd68cb | |||
f2078bf986 | |||
c2c37f3a63 | |||
b1eb16d5fb | |||
f2db82940b | |||
a2837ccaa7 | |||
284b37ccc0 | |||
48d9708abe | |||
b141026fc7 | |||
c9bd0b3bf1 | |||
21b158cc48 | |||
dab13f59e5 | |||
036bbfaff9 | |||
afafde2571 | |||
1dec034f77 | |||
0df33485ca | |||
7ea53dd21b | |||
3869d6257b | |||
4e12899a8e | |||
cebced259e | |||
425d311ce8 | |||
ac8918992b | |||
cbf8d9c45b | |||
905253b4f5 | |||
d9b12be697 | |||
2196d982c3 | |||
5c5943a00c | |||
a4cfe4cd16 | |||
ceaef19fb7 | |||
944fdfb65e | |||
be44b15eac | |||
d73edfea56 | |||
c21882da9c | |||
f260250580 | |||
40a4ba6e39 | |||
d862d2868c | |||
1e213b4d4c | |||
3d66492828 | |||
838fdf4d11 | |||
685c5e9ad1 | |||
66a29a00ee | |||
6768521330 | |||
6c0de526e8 | |||
4c812e3796 | |||
e6808c69f8 | |||
75637f68b3 | |||
56cb2f43fa | |||
038476c412 | |||
201109a7a0 | |||
7e28161638 | |||
ef4472e185 | |||
4acb3d81f3 | |||
bee44ae731 | |||
95106e2e30 | |||
2a6ea38718 | |||
d8d4cfbf01 | |||
34404eb300 | |||
7a84805824 | |||
1d4563ac31 | |||
a18336fa18 | |||
1e4a40e772 | |||
6e5feaba3a | |||
71b38a48ac | |||
6a3f230555 | |||
a952ff2c61 | |||
05e51f40b4 | |||
b83aefcf8f | |||
8b9b593256 | |||
275a76ff5c | |||
3d163f7044 | |||
764dd1c3d9 | |||
ac09c3569a | |||
ce5b7f0305 | |||
1fde17bacb | |||
d472c59b8d | |||
126fc46dc4 | |||
d2e624f301 | |||
7173b0124b | |||
1f27022fa7 | |||
9a25a627bb | |||
375aae44e4 | |||
31bc5e1559 | |||
b1100b3d13 | |||
399b2e9e26 | |||
6f16f44438 | |||
1c0c3e62dc | |||
9169b6c999 | |||
a660ec490e | |||
f5c2600ca4 | |||
48745eca57 | |||
b0f6dc43b4 | |||
456bfea58d | |||
0f5fb48a0b | |||
dc8edea0c6 | |||
cf6164e847 | |||
a13a21377c | |||
37acd375d6 | |||
f2289544b7 | |||
7a53ecac86 | |||
906e49ff72 | |||
e4d1aba3f8 | |||
38fe77ecf2 | |||
8fde33d87c | |||
220552af62 | |||
637d50a9de | |||
f5b465c0e1 | |||
6ac70ba808 | |||
08cd603623 | |||
ddf0cb0278 | |||
75f8ee1b9c | |||
0508a41afd | |||
0d9f33dc4f | |||
90f9415107 | |||
2ec638a23d | |||
a6cffefa6d | |||
a818c622d9 | |||
ccae473783 | |||
54f68280bd | |||
7d8084262a | |||
bacb53fe8f | |||
33c132968e | |||
73e314cc1a | |||
6af54c5943 | |||
fa7220ec0e | |||
d1a22a0878 | |||
8ac411a9e4 | |||
e5fad005a9 | |||
0940d673db | |||
b94335f115 | |||
a13ba7102a | |||
451b8aa7b2 | |||
53731acf51 | |||
3b9411044f | |||
141e2db38c | |||
0cf4ddda4a | |||
0e4a2c378f | |||
2854f14966 | |||
4328c6c3bc | |||
b171c9a0db | |||
82a60b1e28 | |||
19f09e46fa | |||
134ad8ac21 | |||
32ec378e3b | |||
2cc50bdb10 | |||
94f4316a0e | |||
35c4e28f31 | |||
47424df417 | |||
73e2c6e511 | |||
12cd9df059 | |||
4ad2ff2f71 | |||
b57c855a8c | |||
ed954c5ca2 | |||
21341ab15c | |||
f4d12603e0 | |||
ff81415ffe | |||
5371195c80 | |||
473ce82040 | |||
ab013d831c | |||
57b71bfff0 | |||
6bc8c9d8ef | |||
5f39d5b7ea | |||
9490b1f136 | |||
badec136fc | |||
8ea5f424fd | |||
3cafa60284 | |||
2415ae45c1 | |||
aa169b54de | |||
83c6b7ab3d | |||
ba5008c370 | |||
3fa1b5a89d | |||
7603d8cee8 | |||
869eff49bc | |||
d9abc28fe3 | |||
3e22fee842 | |||
5ec5911e1b | |||
8ef4edebbf | |||
86c74d8a65 | |||
49086e4556 | |||
4c7bb06894 | |||
f3e527e130 | |||
df74dd6e41 | |||
5e9166cec7 | |||
d2c288b13f | |||
fc32dc11a6 | |||
2721804ebf | |||
7b86176d0e | |||
a95ff21aaf | |||
3e84e8b8c3 | |||
9ec32e7926 | |||
7756b5bf1c | |||
eadeac0a42 | |||
4b07987210 | |||
172fc1052b | |||
523412edfb | |||
f7a407ffa0 | |||
7903f24a8f | |||
4b655ab22c | |||
d9d11042ca | |||
0b245b031e | |||
a42d714a87 | |||
c9e6e60c09 | |||
df391c8413 | |||
4c20fa4874 | |||
b7df177f33 | |||
179b064b05 | |||
a19e82fcbc | |||
ccbdb1a3a1 | |||
4e9d430476 | |||
8d7b2cd486 | |||
00dcb0f22c | |||
7fbe2f7adf | |||
fd33e0812c | |||
60ce886605 | |||
ab27a91b07 | |||
24ffb22fa6 | |||
da462bbd55 | |||
fd3916a49e | |||
bb912cff30 | |||
e53ef9642e | |||
6338a4933b | |||
29249db5d2 | |||
4dbb84cea1 | |||
f1b6427e63 | |||
db473beb48 | |||
1b4cc4af5c | |||
7382c328da | |||
641b0dec44 | |||
2fbb5d0bbf | |||
d8dbbf7484 | |||
377ccff600 | |||
f974517f64 | |||
f808138a94 | |||
b845dd1b88 | |||
b6725c4415 | |||
5bfa29dded | |||
80e62ad291 | |||
e2fc20876d | |||
96eb0ce492 | |||
d6c0d176ee | |||
9f0f0197fe | |||
a994573a43 | |||
883c84bdb9 | |||
f6e0bdb2f2 | |||
e3d811b04b | |||
cabb8752cb | |||
1f5ef968cf | |||
c8f27da294 | |||
68d6d3c4ff | |||
4c24e0cfb0 | |||
9653531242 | |||
07c1b4ddee | |||
1cae7327ae | |||
c03550de35 | |||
c6a918d996 | |||
0034efafe4 | |||
0fd15d9cf3 | |||
938d0a970b | |||
fdc3e103cc | |||
c1b0329969 | |||
da93712846 | |||
cdc99bfee1 | |||
88b100e5d0 | |||
21889305e0 | |||
18db95d0e9 | |||
51fcc75354 | |||
721d58b464 | |||
4221552c0b | |||
cc1b275ad9 | |||
cc6080fe38 | |||
6399f6f094 | |||
218ef07d8e | |||
16bc3e0398 | |||
40976c02a4 | |||
f692cec763 | |||
40e0a34a5c | |||
7295fcfa86 | |||
cfe166ef35 | |||
0ffbd05c0e | |||
a1a0ee4edb | |||
54a99d8e32 | |||
62db18b6dd | |||
f32e9d07dd | |||
700c3166b7 | |||
17e7528e2c | |||
8a7a0b6b88 | |||
9617208e40 | |||
fb3b7a3baa | |||
69857b4ba8 | |||
0ffcfa307e | |||
16c812ec80 | |||
268fbdabce | |||
87496e9f4a | |||
300a951730 | |||
095539de29 | |||
c4c67e591b | |||
502aa68bb7 | |||
81cb4bc8d6 | |||
e713f7a54c | |||
352b83252f | |||
a0c3083af0 | |||
98d856daa2 | |||
8bfb02ba3c | |||
0b82c9ebad | |||
de761c5a82 | |||
6cf1da166f | |||
6625d79296 | |||
debed1ac2d | |||
5ff7733f84 | |||
865acfa40f | |||
3ce5ad9e2c | |||
d2b1dfe424 | |||
55dcf4c65f | |||
7e635d37ad | |||
b7b973624a | |||
62059a91aa | |||
35676217e8 | |||
8cfee8a38c | |||
80a73cb14b | |||
e9648a6cdf | |||
e6a63f5547 | |||
b48ed824e6 | |||
29b966894c | |||
f0160635a2 | |||
964b30902a | |||
2a3dd53952 | |||
236e474553 | |||
dee6e7e3c1 | |||
7711eba297 | |||
2f4628520b | |||
b203d25656 | |||
1bc451ed10 | |||
e07bae2525 | |||
5304b0d8d1 | |||
fe6960888a | |||
5b6ddaa2d7 | |||
6471c1f4e2 | |||
8e7e409fce | |||
1458dc8347 | |||
303579cb42 | |||
a46514b397 | |||
25a84e30fc | |||
978b056a01 | |||
6a7b47e5e1 | |||
d6dee7bb5c | |||
35a12b94ea | |||
2258e36a59 | |||
59e1444b27 | |||
eb79d4a2f3 | |||
57e29857cf | |||
21ae423feb | |||
9ba5c91d4a | |||
80d02d189a | |||
56267b2aed | |||
6040574d8d | |||
5e6eae620b | |||
69dad37d8f | |||
cfdcce6d12 | |||
0b2e5ed499 | |||
9150778757 | |||
50f3ccd3c9 | |||
584072fa6a | |||
3adb183c5f | |||
95953b48f9 | |||
aa6e3c79a0 | |||
0c43d34ce3 | |||
8b03965912 | |||
82e0abc4be | |||
0405ba1ccf | |||
738fa5a5e5 | |||
b96c08f35c | |||
cc4d0199e7 | |||
781f06ef82 | |||
f9f60f89d9 | |||
5ce3aac929 | |||
2229e91b57 | |||
2debde3451 | |||
3e8e025704 | |||
a775ee7d31 | |||
9ece8c465e | |||
499d1628c7 | |||
59389b3dce | |||
619e113748 | |||
e722eab892 | |||
9ca699c86d | |||
d45db0f5af | |||
0b5a2a7594 | |||
831a513b2d | |||
c312ae221f | |||
a35b6589d2 | |||
719233617c | |||
3c8e74023f | |||
71c6ec71e5 | |||
1fd04557c7 | |||
aa6ff039c4 | |||
8a05efa365 | |||
da536cc311 | |||
0912d4be59 | |||
489e1a5b83 | |||
824ed99160 | |||
385f1410d2 | |||
70d8e3ad94 | |||
71348f3ebb | |||
e268d9492a | |||
123c466843 | |||
5d2f523e81 | |||
73145de618 | |||
05677f57e2 | |||
cae58f43f1 | |||
82052459a2 | |||
4e1e857949 | |||
1b1945c63e | |||
8d1b01cb5b | |||
70fe7dd1fd | |||
5dffa43201 | |||
6b1a38f14c | |||
fe8e7ded8c | |||
eff1fe3c61 | |||
7d01fab132 | |||
c9295a5883 | |||
aec13b50fd | |||
a95fa379cc | |||
07536216c2 | |||
3bcb6bf321 | |||
7f56678d84 | |||
97dee9de36 | |||
e3ec000e93 | |||
6b5bb0b278 | |||
e33adad8f5 | |||
769bad3320 | |||
9a25651151 | |||
c2bbec2f05 | |||
0c498556d5 | |||
3fa6dd377f | |||
6600b005b6 | |||
b5b57aca02 | |||
160278c489 | |||
d868a234da | |||
59da8b2a4b | |||
41dfbe544f | |||
bbfc9359e9 | |||
558775d544 | |||
a3876353ca | |||
273f0d18b0 | |||
9347d6c866 | |||
fea1b6b2c3 | |||
0ce0bc00d2 | |||
69b44bf9a5 | |||
73cafbe0ec | |||
e5f168f599 | |||
7d62dbe9f7 | |||
13f14c2f4c | |||
c952fbbd8d | |||
ab0228f626 | |||
6c7ce79c89 | |||
1b2cac0cc5 | |||
1bc33ae8d7 | |||
598a1d8dd7 | |||
64aaea3978 | |||
876aa0883d | |||
477feee8a3 | |||
36db5865e7 | |||
7394ec6f6a | |||
3593fb3462 | |||
d3f29d09e8 | |||
5341afcdcd | |||
57c857e89a | |||
c16ad053b6 | |||
6080a45c9c | |||
5384f185ae | |||
76a95dc58f | |||
5076c49210 | |||
72e7e36a5b | |||
2fa21aa676 | |||
3999e468b7 | |||
6693149f3e | |||
2c196307ee | |||
d6676a9d6c | |||
a7409850d6 | |||
53e5f94b99 | |||
64bf3ffe6c | |||
9405150b11 | |||
a3db7d0728 | |||
11ff96ba1d | |||
0d0039674f | |||
789046ca57 | |||
1a4f16e0ed | |||
4983fd3776 | |||
cc10d4f310 | |||
167a5039d0 | |||
4b82171a95 | |||
b4624237af | |||
49f93a57bf | |||
ea71738c72 | |||
49956ed63d | |||
280fcc3771 | |||
3a6346f560 | |||
980d145f48 | |||
a7bd1eaa40 | |||
1773dca9dc | |||
8e3e830e89 | |||
77b385fb12 | |||
0b34d8e75e | |||
0c3dd2be96 | |||
444481f6d9 | |||
299ec12b39 | |||
b21c5d8e51 | |||
2d0adb562d | |||
3bc9530db7 | |||
75a191a856 | |||
7c3be2b5c1 | |||
0b9e5928d3 | |||
e8cdff3eaf | |||
fe78eb77d4 | |||
f69454ec98 | |||
8a8264bc39 | |||
1119f64a77 | |||
c25ceaf06b | |||
b263926ea6 | |||
84747b1a14 | |||
9396b8d53c | |||
37497ec2a8 | |||
851e4c667f | |||
9feeafd757 | |||
0027a1e152 | |||
65af5af138 | |||
557d2b3b0d | |||
fbde40d1fc | |||
557c0c29b0 | |||
0e5aac6a11 | |||
b242216674 | |||
423412df98 | |||
c85dd262ed | |||
02d5a31822 | |||
7821d1cbdd | |||
80dc7fb675 | |||
a3ed5277ef | |||
2a527ea82e | |||
367ffde00c | |||
bbdb8eb0de | |||
b6a6346405 | |||
4464fa5d39 | |||
86996d4315 | |||
07cef1bdb8 | |||
69f006f641 | |||
d656e87395 | |||
3cb8070980 | |||
ff7ac0487b | |||
19c0923a86 | |||
6ce64c2557 | |||
3ed5edb295 | |||
c3dbae8d5e | |||
b2494b53e6 | |||
f091a074d4 | |||
f80d65286c | |||
0271e3d3ac | |||
00cb8dbda8 | |||
025069de7e | |||
86673bd6d6 | |||
ddf3d1f949 | |||
3664966340 | |||
cb6864f04a | |||
701e1654a1 | |||
732de5bf7f | |||
11731af45a | |||
735ae9b369 | |||
cb277f52e8 | |||
8ea83c9548 | |||
610ab0750c | |||
d06499a50c | |||
ef316ced3b | |||
0617b17534 | |||
f7d3e262a9 | |||
8189b2ba91 | |||
e73868bc5a | |||
6f0bc1f676 | |||
88898c68d7 | |||
cd005341c5 | |||
bc666d0ab7 | |||
933b47389d | |||
a8d7a31327 | |||
c2226cf0df | |||
5f6eb2ce98 | |||
c1a53a2653 | |||
776f93e7be | |||
5a5a513b18 | |||
cc4a2bb0c3 | |||
e4dc46741f | |||
20beafedc5 | |||
8d82ac5cc8 | |||
9dc2ef5549 | |||
cd3d77987c | |||
b11d429bc0 | |||
e391bc004b | |||
a35fa7ac93 | |||
bebe3d7cfa | |||
c1f1530d54 | |||
1f7a41cff8 | |||
f4d3c995bc | |||
637da383f5 | |||
389ea272a0 | |||
9a723be263 | |||
3802d37d29 | |||
750352836f | |||
a43c3fbf2e | |||
4fbcad2468 | |||
0d386f1c31 | |||
85b90f122a | |||
3dba016a93 | |||
db0369e9b8 | |||
0ab3e49be9 | |||
f116c4b9c0 | |||
307e44f7c8 | |||
d1341578d8 | |||
7b8ce16057 | |||
3a959a7763 | |||
cfd101c9b8 | |||
ca6ec120a9 | |||
88ba39b162 | |||
da9a720c3f | |||
10707c3673 | |||
b9d4b42f93 | |||
bf4cab5f2f | |||
1f4c667646 | |||
dfb08ec753 | |||
4626175d11 | |||
4838cbc350 | |||
53d98343b7 | |||
73bedfcc01 | |||
d5b48c90ed | |||
ebfbb7f452 | |||
b11ffc9635 | |||
3947807b1f | |||
5db538d85e | |||
a9176d7b62 | |||
b4487cefc9 | |||
867258de8b | |||
5fcef91278 | |||
2aa1b5d9b7 | |||
9a5be0a092 | |||
4da794b389 | |||
0a5429cab0 | |||
7d676ad16a | |||
b75bdedaee | |||
085734aaba | |||
0fd6808e21 | |||
bf193dd3cf | |||
facb009a1d | |||
8d09c37140 | |||
f6ced547be | |||
c826cec1d4 | |||
620562f7cf | |||
922d9657b9 | |||
499b2dccad | |||
1e3d5c4d87 | |||
6f46f0e0e1 | |||
8169b35482 | |||
c9b4028cd3 | |||
7cd3c419ee | |||
fa03d50e90 | |||
0dff741310 | |||
fcc5bf1e66 | |||
508d31513a | |||
7578b56298 | |||
2599b1bacc | |||
e3983f8a57 | |||
14264c2d6f | |||
3c54187c40 | |||
7df4eb69b5 | |||
559e384130 | |||
ebe5c526bb | |||
5097aae716 | |||
569c5e77fd | |||
9c87decba6 | |||
fe6d5b1402 | |||
eea8d58afa | |||
21e6850722 | |||
5986d83738 | |||
4564dd95ff | |||
d2bfdfa6e7 | |||
b69afa010e | |||
708aac1ea7 | |||
17bfd4d55e | |||
b31071463c | |||
dda376c9eb | |||
40d5c79b62 | |||
1537109514 | |||
66c74f0ad9 | |||
821f1f366e | |||
e99eda4a4a | |||
fadb291962 | |||
f0003ea922 | |||
e30ba3e138 | |||
7a15d8a7e3 | |||
dba91eaa09 | |||
d57ea671d7 | |||
d647a587a1 | |||
a493fc23f4 | |||
b3516c599b | |||
3ba54c7e35 | |||
b41079ddf9 | |||
e2a2993b18 | |||
8ca885d27c | |||
bc0954381c | |||
7c761dea72 | |||
3f8a5b8b76 | |||
a061aa3d87 | |||
b343eac10d | |||
649a12472b | |||
d05e8a9772 | |||
cac6be87ba | |||
38d34a7495 | |||
fb4c3dd8d4 | |||
1ffd67e014 | |||
8c18c60c00 | |||
bca8886ff8 | |||
1f7bb67069 | |||
712e2785f2 | |||
5515909c1e | |||
5ef806c43c | |||
1e8ead441c | |||
0db7c94c90 | |||
99969b186b | |||
f9f7de0ec7 | |||
d27c14af48 | |||
88949a750f | |||
547b1c6157 | |||
0b354803f3 | |||
0b9524f23d | |||
4bf3bcbd55 | |||
3f0eca72f7 | |||
fe20f0d7cd | |||
d78e3bb307 | |||
e45475c5b5 | |||
a408e5f685 | |||
f67ddb579d | |||
a297e4a5bf | |||
1ad2cfeedf | |||
412389ec75 | |||
cf6f30963c | |||
3f567a07ca | |||
41fc08b330 | |||
07ea4fd4f9 | |||
778c7e6e70 | |||
c863ff3f02 | |||
f398952a6c | |||
56285ec0d4 | |||
25a067c8c3 | |||
91fa643131 | |||
6da9d2d36f | |||
f881cdd767 | |||
84ba365c77 | |||
f9f4dd5276 | |||
cac55105c3 | |||
a87cd2d094 | |||
235f4762b7 | |||
79e9a8bcc2 | |||
fad9dff2db | |||
1632aec102 | |||
255320e2a6 | |||
93bb934d4e | |||
feddd946f9 | |||
6bfbc43e3c | |||
35b5dcf89d | |||
9743db3538 | |||
e5f7c55c54 | |||
df08c2cfab | |||
21cdfb96de | |||
53c7f61f98 | |||
6d398beefd | |||
ab34884e3e | |||
532f413472 | |||
235d4aba9a | |||
cfdf4e3a49 | |||
f19c3c51d3 | |||
0b7cd2f40a | |||
2a2e3b80b3 | |||
f803dd5ff4 | |||
7c9949eea3 | |||
d853dbf2d8 | |||
aee8e95d49 | |||
0cbbcf2884 | |||
30e4a188d0 | |||
5c9411a671 | |||
48a2ad032a | |||
f05e62deae | |||
dbee1b38b3 | |||
c9919cc5ba | |||
9c26d10ea6 | |||
3f71afd0fb | |||
221df51875 | |||
f33f3fcb72 | |||
57c7992c78 | |||
c287ae4d1d | |||
3eca5d9c29 | |||
8a68624dae | |||
bfb152f53f | |||
759d71037e | |||
daebce4994 | |||
def9cf2a6a | |||
4aa8449fe1 | |||
53aad7f6bd | |||
787608b568 | |||
2b04ac5e9b | |||
adf89901c4 | |||
50d4f66d73 | |||
7bae95836c | |||
07f84a99b4 | |||
f89f02ce9e | |||
be4f08a548 | |||
0073d0f694 | |||
16eae132fa | |||
6fc150bddb | |||
dfdd46db80 | |||
87bb0086de | |||
1d0654bd14 | |||
463442eb6f | |||
4affa10ca0 | |||
2e1d363a86 | |||
1cbdae65fe | |||
dcbae5f313 | |||
c59c74ddda | |||
abbcb0a12c | |||
845955dea5 | |||
8aa68cd5f1 | |||
edbc5d3588 | |||
96a58becf8 | |||
8a9715f183 | |||
1b122cddbd | |||
42390e662b | |||
494681a482 | |||
dbf40f30f9 | |||
dc50e8ae5b | |||
7a55c6b388 | |||
c2ce018202 | |||
0d0af07ce9 | |||
de697a1c45 | |||
472206dfb2 | |||
7e84f5a7db | |||
6889fcfc28 | |||
4dc0ff8f13 | |||
3013d90f57 | |||
60da0e6cae | |||
ced040c503 | |||
00aa115898 | |||
17ca5be4c1 | |||
ab720a6f1e | |||
e5e11c1b24 | |||
7cc64c5cb6 | |||
b84dba3ecb | |||
bd7e4ab695 | |||
ee1a008f2d | |||
8fb9df9751 | |||
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 | |||
a425bbc673 | |||
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 |
85
.gitignore
vendored
@ -1,13 +1,16 @@
|
||||
/ext/llvm-g++-Xcode4.6.2
|
||||
/ext/llvm-g++-Xcode4.6.2.tar.bz2
|
||||
/zerotier-*
|
||||
/ZeroTierUI/*.user
|
||||
*.o
|
||||
# Main binaries created in *nix builds
|
||||
/zerotier-one
|
||||
/zerotier-idtool
|
||||
/zerotier-cli
|
||||
/zerotier-selftest
|
||||
/zerotier
|
||||
|
||||
# OS-created garbage files from various platforms
|
||||
.DS_Store
|
||||
.Apple*
|
||||
*.dSYM
|
||||
/netconf-service/node_modules
|
||||
/ipch
|
||||
Thumbs.db
|
||||
|
||||
# Windows build droppings
|
||||
/windows/ZeroTierOne.sdf
|
||||
/windows/ZeroTierOne.v11.suo
|
||||
/windows/x64
|
||||
@ -18,8 +21,25 @@
|
||||
/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-*
|
||||
/examples/docker/zerotier-one
|
||||
/examples/docker/test-*.env
|
||||
/world/mkworld
|
||||
/world/*.c25519
|
||||
zt1-src.tar.gz
|
||||
|
||||
# Miscellaneous temporaries, build files, etc.
|
||||
*.log
|
||||
*.opensdf
|
||||
*.user
|
||||
@ -27,19 +47,38 @@
|
||||
*.obj
|
||||
*.tlog
|
||||
*.pid
|
||||
/*.deb
|
||||
/*.rpm
|
||||
/build-*
|
||||
/ZeroTierOneInstaller-*
|
||||
.qmake.stash
|
||||
*.pkg
|
||||
*.o
|
||||
*.a
|
||||
*.dylib
|
||||
*.so
|
||||
*.so.*
|
||||
*.o-*
|
||||
*.core
|
||||
*.deb
|
||||
*.rpm
|
||||
*.autosave
|
||||
/ZeroTier One.dmg
|
||||
/root-topology/*.secret
|
||||
/testnet/local-testnet/n????
|
||||
/testnet/local-testnet/*/peers.persist
|
||||
/testnet/local-testnet/*/authtoken.secret
|
||||
/testnet/local-testnet/*/*.log
|
||||
/testnet/local-testnet/*/*.old
|
||||
/testnet/local-testnet/*/root-topology
|
||||
/testnet/local-testnet/*/local.conf
|
||||
/testnet/local-testnet/*/networks.d
|
||||
*.tmp
|
||||
doc/*.1
|
||||
doc/*.2
|
||||
doc/*.8
|
||||
.depend
|
||||
node_modules
|
||||
debian/files
|
||||
debian/zerotier-one
|
||||
debian/zerotier-one*.debhelper
|
||||
debian/*.log
|
||||
debian/zerotier-one.substvars
|
||||
|
||||
# Java/Android/JNI build droppings
|
||||
java/obj/
|
||||
java/libs/
|
||||
java/bin/
|
||||
java/classes/
|
||||
java/doc/
|
||||
java/build_win64/
|
||||
java/build_win32/
|
||||
/java/mac32_64/
|
||||
windows/WinUI/obj/
|
||||
windows/WinUI/bin/
|
||||
windows/ZeroTierOne/Debug/
|
||||
|
80
AUTHORS.md
Normal file
@ -0,0 +1,80 @@
|
||||
## Primary Authors
|
||||
|
||||
* ZeroTier Core and ZeroTier One virtual networking service<br>
|
||||
Adam Ierymenko / adam.ierymenko@zerotier.com
|
||||
|
||||
* Java JNI Interface to enable Android application development, and Android app itself (code for that is elsewhere)<br>
|
||||
Grant Limberg / glimberg@gmail.com
|
||||
|
||||
* ZeroTier SDK (formerly known as Network Containers)<br>
|
||||
Joseph Henry / joseph.henry@zerotier.com
|
||||
|
||||
## Third Party Contributors
|
||||
|
||||
* A number of fixes and improvements to the new controller, other stuff.<br>
|
||||
Kees Bos / https://github.com/keesbos/
|
||||
|
||||
* Debugging and testing, OpenWRT support fixes.<br>
|
||||
Moritz Warning / moritzwarning@web.de
|
||||
|
||||
* Debian GNU/Linux packaging, manual pages, and license compliance edits.<br>
|
||||
Ben Finney <ben+zerotier@benfinney.id.au>
|
||||
|
||||
* Several others made smaller contributions, which GitHub tracks here:<br>
|
||||
https://github.com/zerotier/ZeroTierOne/graphs/contributors/
|
||||
|
||||
## Third-Party Code
|
||||
|
||||
These are included in ext/ for platforms that do not have them available in common repositories. Otherwise they may be linked and the package may ship with them as dependencies.
|
||||
|
||||
* LZ4 compression algorithm by Yann Collet
|
||||
|
||||
* Files: ext/lz4/*
|
||||
* Home page: http://code.google.com/p/lz4/
|
||||
* License grant: BSD attribution
|
||||
|
||||
* http-parser by Joyent, Inc. (many authors)
|
||||
|
||||
* Files: ext/http-parser/*
|
||||
* Home page: https://github.com/joyent/http-parser/
|
||||
* License grant: MIT/Expat
|
||||
|
||||
* json-parser by James McLaughlin
|
||||
|
||||
* Files: ext/json-parser/*
|
||||
* Home page: https://github.com/udp/json-parser/
|
||||
* License grant: BSD attribution
|
||||
|
||||
* TunTapOSX by Mattias Nissler
|
||||
|
||||
* Files: ext/tap-mac/tuntap/*
|
||||
* Home page: http://tuntaposx.sourceforge.net/
|
||||
* License grant: BSD attribution no-endorsement
|
||||
* ZeroTier Modifications: change interface name to zt#, increase max MTU, increase max devices
|
||||
|
||||
* tap-windows6 by the OpenVPN project
|
||||
|
||||
* Files: windows/TapDriver6/*
|
||||
* Home page:
|
||||
https://github.com/OpenVPN/tap-windows6/
|
||||
* License grant: GNU GPL v2
|
||||
* ZeroTier Modifications: change name of driver to ZeroTier, add ioctl() to get L2 multicast memberships (source is in ext/ and modifications inherit GPL)
|
||||
|
||||
* Salsa20 stream cipher, Curve25519 elliptic curve cipher, Ed25519
|
||||
digital signature algorithm, and Poly1305 MAC algorithm, all by
|
||||
Daniel J. Bernstein
|
||||
|
||||
* Files:
|
||||
node/Salsa20.hpp
|
||||
node/C25519.hpp
|
||||
node/Poly1305.hpp
|
||||
* Home page: http://cr.yp.to/
|
||||
* License grant: public domain
|
||||
|
||||
* MiniUPNPC and libnatpmp by Thomas Bernard
|
||||
|
||||
* Files:
|
||||
ext/libnatpmp/*
|
||||
ext/miniupnpc/*
|
||||
* Home page: http://miniupnp.free.fr/
|
||||
* License grant: BSD attribution no-endorsement
|
21
AUTHORS.txt
@ -1,21 +0,0 @@
|
||||
ZeroTier One is designed and written by Adam Ierymenko, with a few bug
|
||||
fixes and other contributions from other users. Information about all
|
||||
contributors can be found on the GitHub home page at:
|
||||
|
||||
https://github.com/zerotier/ZeroTierOne
|
||||
|
||||
ZeroTier One includes the following third party code:
|
||||
|
||||
* LZ4 compression algorithm by Yann Collet (BSD license)
|
||||
http://code.google.com/p/lz4/
|
||||
|
||||
* TunTapOSX by Mattias Nissler (forked for ZT1) (BSD license)
|
||||
http://tuntaposx.sourceforge.net
|
||||
|
||||
* tap-windows by the OpenVPN project (forked for ZT1) (GPL)
|
||||
https://github.com/OpenVPN/tap-windows
|
||||
|
||||
* Salsa20 stream cipher, Curve25519 elliptic curve cipher, Ed25519
|
||||
digital signature algorithm, and Poly1305 MAC algorithm, all by
|
||||
Daniel J. Bernstein (public domain)
|
||||
http://cr.yp.to/
|
37
BUILDING.txt
@ -1,37 +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
|
||||
|
||||
Just type 'make'. You'll need gcc and g++ installed, but ZeroTier One requires
|
||||
no other third party libraries beyond the standard libc, libstdc++, and libm.
|
||||
|
||||
-- MacOS
|
||||
|
||||
make
|
||||
|
||||
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.
|
17
COPYING
Normal file
@ -0,0 +1,17 @@
|
||||
ZeroTier One, an endpoint server for the ZeroTier virtual network layer.
|
||||
Copyright © 2011–2016 ZeroTier, Inc.
|
||||
|
||||
ZeroTier One 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.
|
||||
|
||||
See the file ‘LICENSE.GPL-3’ for the text of the GNU GPL version 3.
|
||||
If that file is not present, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
..
|
||||
Local variables:
|
||||
coding: utf-8
|
||||
mode: text
|
||||
End:
|
||||
vim: fileencoding=utf-8 filetype=text :
|
339
LICENSE.GPL-2
Normal file
@ -0,0 +1,339 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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 2 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, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
674
LICENSE.GPL-3
Normal file
@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
13
LICENSE.txt
@ -1,13 +0,0 @@
|
||||
ZeroTier One is licensed under the terms of the GNU General Public License
|
||||
version 3, which are available here:
|
||||
|
||||
http://gplv3.fsf.org/
|
||||
|
||||
Modification and redistribution of ZeroTier One is permitted in source form.
|
||||
Binary distribution is permitted provided all copyright notices remain
|
||||
intact and any modifications to the source code are also distributed.
|
||||
|
||||
ZeroTier One may not be embedded into any closed-source application (e.g. via
|
||||
linking), nor may closed-source derivatives be created, without a separately
|
||||
negotiated license from ZeroTier Networks LLC. See the terms of the GPLv3 for
|
||||
details.
|
4
Makefile
@ -13,4 +13,6 @@ endif
|
||||
ifeq ($(OSTYPE),FreeBSD)
|
||||
include make-freebsd.mk
|
||||
endif
|
||||
|
||||
ifeq ($(OSTYPE),OpenBSD)
|
||||
include make-freebsd.mk
|
||||
endif
|
||||
|
97
README.md
@ -1,41 +1,88 @@
|
||||
ZeroTier One - Network Virtualization Everywhere
|
||||
ZeroTier - A Planetary Ethernet Switch
|
||||
======
|
||||
|
||||
ZeroTier One is an ethernet virtualization engine. It creates virtual switched LANs of almost unlimited size that span physical network boundaries. To the operating system these behave just like ordinary Ethernet ports. Everything just works, even as your computer moves around or your physical Internet link changes.
|
||||
ZeroTier is a software-based managed Ethernet switch for planet Earth.
|
||||
|
||||
It's intended to replace conventional hub-and-spoke VPNs, provide provider-neutral secure private backplane networks to multi-data-center and hybrid cloud deployments, allow remote access to embedded devices, and much more.
|
||||
It erases the LAN/WAN distinction and makes VPNs, tunnels, proxies, and other kludges arising from the inflexible nature of physical networks obsolete. Everything is encrypted end-to-end and traffic takes the most direct (peer to peer) path available.
|
||||
|
||||
ZeroTier uses a peer to peer network with managed anchor points ("supernodes"). These are operated by ZeroTier Networks, and are free to use. They provides instant "zero configuration" startup, NAT traversal assistance, relaying in cases where NAT traversal doesn't work, and a trusted root authority for looking up peer public keys (identities). The supernodes run the same open-source software as regular nodes, are geographically distributed across three continents, and have remained stable for over a year. [This blog post](http://adamierymenko.com/decentralization-i-want-to-believe/) discusses the design rationale in some detail. *(TL;DR: this design represents a compromise between speed and ease of use and decentralization.)*
|
||||
This repository contains ZeroTier One, a service that provides ZeroTier network connectivity to devices running Windows, Mac, Linux, iOS, Android, and FreeBSD and makes joining virtual networks as easy as joining IRC or Slack channels. It also contains the OS-independent core ZeroTier protocol implementation in [node/](node/).
|
||||
|
||||
ZeroTier One encrypts all traffic end-to-end with keys that only you control. Even when traffic is traversing our network we cannot decrypt it. It's not, however, a "strong privacy" tool since it would still be possible for us (or your ISP or anyone else in between) to observe "meta-data" about your traffic. If you need *that* level of anonymity, we recommend [Tor](https://www.torproject.org) or something similar. Onion routing is the only technology we're aware of that is capable of delivering that level of end-to-end privacy protection.
|
||||
|
||||
At the moment the ZeroTier wire protocol is only documented in the source (start with the comments in Packet.hpp), but more formal documentation is planned for the near future. Encapsulation overhead is comparable to IPSec or OpenVPN.
|
||||
|
||||
[Visit ZeroTier Networks on the web](https://www.zerotier.com/) for more information. Follow the [ZeroTier blog](https://www.zerotier.com/blog/), [Twitter feed](https://twitter.com/ZeroTier) and the main [GitHub project](https://github.com/zerotier/ZeroTierOne) to stay up to date. See the GitHub-hosted wiki (sidebar) for more technical info and help for various platforms. There's also a [support portal](https://www.zerotier.com/support/) for more general information.
|
||||
Visit [ZeroTier's site](https://www.zerotier.com/) for more information and [pre-built binary packages](https://www.zerotier.com/download.shtml). Apps for Android and iOS are available for free in the Google Play and Apple app stores.
|
||||
|
||||
### Getting Started
|
||||
|
||||
Auto-updating binary packages that install easily [can be found here](https://www.zerotier.com/download.html) for officially supported platforms. Packages for popular Linux distributions that neatly wrap the Linux installer/uninstaller are coming soon.
|
||||
ZeroTier's basic operation is easy to understand. Devices have 10-digit *ZeroTier addresses* like `89e92ceee5` and networks have 16-digit network IDs like `8056c2e21c000001`. All it takes for a device to join a network is its 16-digit ID, and all it takes for a network to authorize a device is its 10-digit address. Everything else is automatic.
|
||||
|
||||
If you want to build from source, clone this repository and see BUILDING.txt and RUNNING.txt. If you build manually you'll have to update manually, and we recommend doing so often as development is progressing very rapidly. (Protocol is pretty stable but you might miss out on new features or experience performance degradation if you're too far behind.)
|
||||
A "device" can be anything really: desktops, laptops, phones, servers, VMs/VPSes, containers, and even (soon) apps.
|
||||
|
||||
Once you are up and running, you have several options.
|
||||
For testing we provide a public virtual network called *Earth* with network ID `8056c2e21c000001`. On Linux and Mac you can do this with:
|
||||
|
||||
ZeroTier provides ZeroTier One for free, but to help finance development and operations we have a [user-friendly freemium control panel on the web](https://www.zerotier.com/admin.html). This control panel lets you quickly and easily create your own networks, and the operation of their controller node(s) is left to us. Public networks created on our site are free, and private networks are free for up to ten devices. After that there is a monthly charge.
|
||||
sudo zerotier-cli join 8056c2e21c000001
|
||||
|
||||
You *only* need an account on our site if you want to use the control panel found there. Joining networks requires no account. To get authorized on a private network, just send your device's 10-digit ID to the network's administrator and they can add you.
|
||||
Now wait about 30 seconds and check your system with `ip addr list` or `ifconfig`. You'll see a new interface whose name starts with *zt* and it should quickly get an IPv4 and an IPv6 address. Once you see it get an IP, try pinging `earth.zerotier.net` at `29.209.112.93`. If you've joined Earth from more than one system, try pinging your other machine.
|
||||
|
||||
Public networks, as the name implies, can be joined without getting authorization from anyone. All you need is their 16-digit network ID. A public network called [Earth](https://www.zerotier.com/earth.html) (8056c2e21c000001) exists for everyone, but be sure your device is adequately secured and up to date before joining.
|
||||
*(IPv4 addresses for Earth are assigned from the block 28.0.0.0/7, which is not a part of the public Internet but is non-standard for private networks. It's used to avoid IP conflicts during testing. Your networks can run any IP addressing scheme you want.)*
|
||||
|
||||
Alternatively, you can run your own network configuration controller. This lets you run any network for free. To do this, start with the netconf-service/ subfolder of this project. You'll need to do a bit of system administration work and manually populate a Redis database, but it's not terribly hard if you're into that kind of thing.
|
||||
If you don't want to belong to a giant Ethernet party line anymore, just type:
|
||||
|
||||
More products and services will be forthcoming.
|
||||
sudo zerotier-cli leave 8056c2e21c000001
|
||||
|
||||
### Basic Troubleshooting
|
||||
The *zt* interface will disappear. You're no longer on the network.
|
||||
|
||||
For about 95% of users, it just works.
|
||||
To create networks of your own you'll need a network controller. You can use [our hosted controller at my.zerotier.com](https://my.zerotier.com) which is free for up to 100 devices on an unlimited number of networks, or you can build your own controller and run it through its local JSON API. See [README.md in controller/](controller/) for more information.
|
||||
|
||||
If you are running a local system firewall, we recommend adding a rule permitting UDP port 9993 inbound and outbound. The binary Windows installer takes care of this for Windows' built-in firewall, but other platforms and third party firewall software may need this for optimal performance.
|
||||
### Building from Source
|
||||
|
||||
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:
|
||||
|
||||
* **Mac**: Xcode command line tools. It should build on OSX 10.7 or newer.
|
||||
* **Linux**: gcc/g++ (4.9 or newer recommended) or clang/clang++ (3.4 or newer recommended) Makefile will use clang by default if available. The Linux build will auto-detect the presence of development headers for *json-parser*, *http-parser*, *li8bnatpmp*, and *libminiupnpc* and will link against the system libraries for these if they are present and recent enough. Otherwise the bundled versions in [ext/](ext/) will be used. Type `make install` to install the binaries and other files on the system, though this will not create init.d or systemd links.
|
||||
* **FreeBSD**: C++ compiler (G++ usually) and GNU make (gmake).
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
32 and 64 bit X86 and ARM (e.g. Raspberry Pi, Android) are officially supported. Community members have built for MIPS and Sparc without issues.
|
||||
|
||||
### 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`
|
||||
* **FreeBSD**: `/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*.
|
||||
|
||||
### 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 found 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.
|
||||
|
||||
@ -43,12 +90,12 @@ Users behind certain types of firewalls and "symmetric" NAT devices may not able
|
||||
|
||||
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 *slow*. If performance seems just terrible, this is the first thing to check.
|
||||
If a firewall between you and the Internet blocks ZeroTier's UDP traffic, you will fall back to last-resort TCP tunneling to rootservers over port 443 (https impersonation). This will work almost anywhere but is *very slow* compared to UDP or direct peer to peer connectivity.
|
||||
|
||||
Some Windows users have reported a [problem with the TAP device driver](https://github.com/zerotier/ZeroTierOne/issues/107). From user reports this seems to occur on Windows systems that have not been updated through Windows Update. While we have a fix planned, we **really** recommend keeping your system up to date for security reasons. Frankly we're a bit torn on this one. If this is truly the cause, perhaps ZeroTier failing to work on unpatched Windows systems is a feature not a bug.
|
||||
### Contributing
|
||||
|
||||
More help can be found in the [GitHub wiki](https://github.com/zerotier/ZeroTierOne/wiki) and the [customer support portal / knowledge base](https://www.zerotier.com/support/).
|
||||
Please make pull requests against the `dev` branch. The `master` branch is release, and `edge` is for unstable and work in progress changes and is not likely to work.
|
||||
|
||||
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 licensing.
|
||||
### License
|
||||
|
||||
*ZeroTier is keyboard crafted with coffee and sleep deprivation in Southern California.*
|
||||
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.
|
||||
|
74
RUNNING.txt
@ -1,74 +0,0 @@
|
||||
This guide is for those building and running from source. See BUILDING.txt
|
||||
first.
|
||||
|
||||
The wiki at GitHub contains several pages that are probably also of interest:
|
||||
https://github.com/zerotier/ZeroTierOne/wiki
|
||||
|
||||
--- MacOS
|
||||
|
||||
On Mac, the default ZeroTier home is:
|
||||
|
||||
/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 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 &
|
||||
|
||||
--- LINUX
|
||||
|
||||
On Linux, the default ZeroTier home is:
|
||||
|
||||
/var/lib/zerotier-one
|
||||
|
||||
Just type:
|
||||
|
||||
sudo mkdir /var/lib/zerotier-one
|
||||
sudo ./zerotier-one &
|
||||
|
||||
Your system must have the Linux tun/tap driver available (tun). All tested
|
||||
distributions so far ship with this driver as a module that will load
|
||||
automatically.
|
||||
|
||||
UDP port 9993 must be open in your local firewall for this to work properly.
|
||||
How to do this varies by Linux distribution.
|
||||
|
||||
- Opening port 9993 on Ubuntu
|
||||
|
||||
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
|
||||
|
||||
--- WINDOWS
|
||||
|
||||
A windows port is in progress.
|
||||
|
||||
--- ONCE IT'S RUNNING:
|
||||
|
||||
To use the command line interface, see this guide:
|
||||
https://github.com/zerotier/ZeroTierOne/wiki/Command-Line-Interface
|
||||
|
||||
If you want to test by joining the Earth network, try:
|
||||
sudo ./zerotier-cli join 8056c2e21c000001
|
||||
|
||||
An interface called 'zt0' should appear and should get an IP address in
|
||||
the 28.0.0.0/7 range (28.* or 29.*) within a few seconds or so. Then try
|
||||
pinging earth.zerotier.net or navigating to http://earth.zerotier.net/ in
|
||||
a web browser.
|
@ -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,6 +0,0 @@
|
||||
Qt GUI
|
||||
======
|
||||
|
||||
This is the Qt GUI distributed for Mac and Windows. It should build on Linux too if you've got Qt installed.
|
||||
|
||||
It's a bit ugly and limited and will probably eventually be replaced.
|
@ -1,9 +0,0 @@
|
||||
REM If you're an OSS user and want to run this batch file, edit to change the path to Qt.
|
||||
REM Start Visual Studio command prompt and run this from within the ZeroTierUI subfolder.
|
||||
|
||||
CD ..
|
||||
MKDIR build-ZeroTierUI-win32-release
|
||||
CD build-ZeroTierUI-win32-release
|
||||
C:\Qt\5.2.1\Src\qtbase\bin\qmake.exe ..\ZeroTierUI\ZeroTierUI.pro
|
||||
nmake clean
|
||||
nmake
|
Before Width: | Height: | Size: 52 KiB |
@ -1,128 +0,0 @@
|
||||
QT += core gui widgets network
|
||||
TARGET = "ZeroTier One"
|
||||
TEMPLATE = app
|
||||
|
||||
win32:RC_FILE = ZeroTierUI.rc
|
||||
win32:LIBS += winhttp.lib Iphlpapi.lib ws2_32.lib advapi32.lib Shell32.lib Rpcrt4.lib
|
||||
win32:QMAKE_LFLAGS += /MANIFESTUAC:\"level=\'requireAdministrator\' uiAccess=\'false\'\"
|
||||
|
||||
mac:ICON = zt1icon.icns
|
||||
mac:QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
|
||||
mac:QMAKE_INFO_PLIST = Info.plist
|
||||
mac:LIBS += -framework Cocoa
|
||||
|
||||
SOURCES += main.cpp \
|
||||
mainwindow.cpp \
|
||||
aboutwindow.cpp \
|
||||
networkwidget.cpp \
|
||||
installdialog.cpp \
|
||||
licensedialog.cpp \
|
||||
onetimedialog.cpp \
|
||||
../control/IpcConnection.cpp \
|
||||
../control/IpcListener.cpp \
|
||||
../control/NodeControlClient.cpp \
|
||||
../control/NodeControlService.cpp \
|
||||
../node/C25519.cpp \
|
||||
../node/CertificateOfMembership.cpp \
|
||||
../node/Defaults.cpp \
|
||||
../node/Dictionary.cpp \
|
||||
../node/HttpClient.cpp \
|
||||
../node/Identity.cpp \
|
||||
../node/IncomingPacket.cpp \
|
||||
../node/InetAddress.cpp \
|
||||
../node/Logger.cpp \
|
||||
../node/Multicaster.cpp \
|
||||
../node/Network.cpp \
|
||||
../node/NetworkConfig.cpp \
|
||||
../node/Node.cpp \
|
||||
../node/NodeConfig.cpp \
|
||||
../node/OutboundMulticast.cpp \
|
||||
../node/Packet.cpp \
|
||||
../node/Peer.cpp \
|
||||
../node/Poly1305.cpp \
|
||||
../node/RoutingTable.cpp \
|
||||
../node/Salsa20.cpp \
|
||||
../node/Service.cpp \
|
||||
../node/SHA512.cpp \
|
||||
../node/SoftwareUpdater.cpp \
|
||||
../node/Switch.cpp \
|
||||
../node/Topology.cpp \
|
||||
../node/Utils.cpp \
|
||||
../ext/lz4/lz4.c
|
||||
|
||||
HEADERS += mainwindow.h \
|
||||
aboutwindow.h \
|
||||
networkwidget.h \
|
||||
installdialog.h \
|
||||
mac_doprivileged.h \
|
||||
licensedialog.h \
|
||||
main.h \
|
||||
onetimedialog.h \
|
||||
../control/IpcConnection.hpp \
|
||||
../control/IpcListener.hpp \
|
||||
../control/NodeControlClient.hpp \
|
||||
../control/NodeControlService.hpp \
|
||||
../node/Address.hpp \
|
||||
../node/AntiRecursion.hpp \
|
||||
../node/Array.hpp \
|
||||
../node/AtomicCounter.hpp \
|
||||
../node/BandwidthAccount.hpp \
|
||||
../node/Buffer.hpp \
|
||||
../node/C25519.hpp \
|
||||
../node/CertificateOfMembership.hpp \
|
||||
../node/CMWC4096.hpp \
|
||||
../node/Constants.hpp \
|
||||
../node/Defaults.hpp \
|
||||
../node/Dictionary.hpp \
|
||||
../node/EthernetTap.hpp \
|
||||
../node/EthernetTapFactory.hpp \
|
||||
../node/HttpClient.hpp \
|
||||
../node/Identity.hpp \
|
||||
../node/IncomingPacket.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/Node.hpp \
|
||||
../node/NodeConfig.hpp \
|
||||
../node/NonCopyable.hpp \
|
||||
../node/OutboundMulticast.hpp \
|
||||
../node/Packet.hpp \
|
||||
../node/Path.hpp \
|
||||
../node/Peer.hpp \
|
||||
../node/Poly1305.hpp \
|
||||
../node/RoutingTable.hpp \
|
||||
../node/RuntimeEnvironment.hpp \
|
||||
../node/Salsa20.hpp \
|
||||
../node/Service.hpp \
|
||||
../node/SHA512.hpp \
|
||||
../node/SharedPtr.hpp \
|
||||
../node/Socket.hpp \
|
||||
../node/SocketManager.hpp \
|
||||
../node/SoftwareUpdater.hpp \
|
||||
../node/Switch.hpp \
|
||||
../node/Thread.hpp \
|
||||
../node/Topology.hpp \
|
||||
../node/Utils.hpp \
|
||||
../ext/lz4/lz4.h
|
||||
|
||||
FORMS += mainwindow.ui \
|
||||
aboutwindow.ui \
|
||||
networkwidget.ui \
|
||||
installdialog.ui \
|
||||
licensedialog.ui \
|
||||
quickstartdialog.ui \
|
||||
onetimedialog.ui
|
||||
|
||||
RESOURCES += \
|
||||
resources.qrc
|
||||
|
||||
mac:OBJECTIVE_SOURCES += \
|
||||
mac_doprivileged.mm
|
||||
|
||||
OTHER_FILES += \
|
||||
stylesheet.css
|
@ -1 +0,0 @@
|
||||
IDI_ICON1 ICON DISCARDABLE "zt1icon.ico"
|
@ -1,254 +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::Sunken</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="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,219 +0,0 @@
|
||||
/*
|
||||
* ZeroTier One - Global Peer to Peer Ethernet
|
||||
* Copyright (C) 2011-2014 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/
|
||||
*/
|
||||
|
||||
#include "installdialog.h"
|
||||
#include "mainwindow.h"
|
||||
#include "ui_installdialog.h"
|
||||
|
||||
#include "../node/Constants.hpp"
|
||||
#include "../node/Defaults.hpp"
|
||||
#include "../node/SoftwareUpdater.hpp"
|
||||
|
||||
#ifdef __UNIX_LIKE__
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include "mac_doprivileged.h"
|
||||
#endif
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QMessageBox>
|
||||
#include <QByteArray>
|
||||
#include <QSslSocket>
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
#include <QProcess>
|
||||
|
||||
InstallDialog::InstallDialog(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::InstallDialog),
|
||||
nam(new QNetworkAccessManager(this)),
|
||||
phase(FETCHING_NFO)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
QObject::connect(nam,SIGNAL(finished(QNetworkReply*)),this,SLOT(on_networkReply(QNetworkReply*)));
|
||||
|
||||
const char *nfoUrl = ZeroTier::ZT_DEFAULTS.updateLatestNfoURL.c_str();
|
||||
if (!*nfoUrl) {
|
||||
QMessageBox::critical(this,"Download Failed","Download failed: internal error: no update URL configured in build!",QMessageBox::Ok,QMessageBox::NoButton);
|
||||
QApplication::exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
QNetworkReply *reply = nam->get(QNetworkRequest(QUrl(nfoUrl)));
|
||||
QObject::connect(reply,SIGNAL(downloadProgress(qint64,qint64)),this,SLOT(on_downloadProgress(qint64,qint64)));
|
||||
}
|
||||
|
||||
InstallDialog::~InstallDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void InstallDialog::on_networkReply(QNetworkReply *reply)
|
||||
{
|
||||
reply->deleteLater();
|
||||
|
||||
if (reply->error() != QNetworkReply::NoError) {
|
||||
QMessageBox::critical(this,"Download Failed",QString("Download failed: ") + reply->errorString() + "\n\nAre you connected to the Internet?",QMessageBox::Ok,QMessageBox::NoButton);
|
||||
QApplication::exit(1);
|
||||
} else {
|
||||
if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute) == 200) {
|
||||
QByteArray installerData(reply->readAll());
|
||||
|
||||
switch(phase) {
|
||||
case FETCHING_NFO: {
|
||||
unsigned int vMajor = 0,vMinor = 0,vRevision = 0;
|
||||
installerData.append((char)0);
|
||||
const char *err = ZeroTier::SoftwareUpdater::parseNfo(installerData.data(),vMajor,vMinor,vRevision,signedBy,signature,url);
|
||||
|
||||
if (err) {
|
||||
QMessageBox::critical(this,"Download Failed","Download failed: there is a problem with the software update web site.\nTry agian later. (invalid .nfo file)",QMessageBox::Ok,QMessageBox::NoButton);
|
||||
QApplication::exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
phase = FETCHING_INSTALLER;
|
||||
reply = nam->get(QNetworkRequest(QUrl(url.c_str())));
|
||||
QObject::connect(reply,SIGNAL(downloadProgress(qint64,qint64)),this,SLOT(on_downloadProgress(qint64,qint64)));
|
||||
} break;
|
||||
case FETCHING_INSTALLER: {
|
||||
if (!ZeroTier::SoftwareUpdater::validateUpdate(installerData.data(),installerData.length(),signedBy,signature)) {
|
||||
QMessageBox::critical(this,"Download Failed","Download failed: there is a problem with the software update web site. Try agian later. (downloaded data failed signature check)",QMessageBox::Ok,QMessageBox::NoButton);
|
||||
QApplication::exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
{
|
||||
std::string homePath(QDir::homePath().toStdString());
|
||||
QString zt1Caches(QDir::homePath() + "/Library/Caches/ZeroTier/One");
|
||||
QDir::root().mkpath(zt1Caches);
|
||||
std::string instPath((zt1Caches + "/ZeroTierOneInstaller").toStdString());
|
||||
std::string tmpPath((zt1Caches + "/inst.sh").toStdString());
|
||||
|
||||
int outfd = ::open(instPath.c_str(),O_CREAT|O_TRUNC|O_WRONLY,0755);
|
||||
if (outfd <= 0) {
|
||||
QMessageBox::critical(this,"Download Failed",QString("Installation failed: unable to write to ")+instPath.c_str(),QMessageBox::Ok,QMessageBox::NoButton);
|
||||
QApplication::exit(1);
|
||||
return;
|
||||
}
|
||||
if (::write(outfd,installerData.data(),installerData.length()) != installerData.length()) {
|
||||
QMessageBox::critical(this,"Installation Failed",QString("Installation failed: unable to write to ")+instPath.c_str(),QMessageBox::Ok,QMessageBox::NoButton);
|
||||
QApplication::exit(1);
|
||||
return;
|
||||
}
|
||||
::close(outfd);
|
||||
chmod(instPath.c_str(),0755);
|
||||
|
||||
FILE *scr = fopen(tmpPath.c_str(),"w");
|
||||
if (!scr) {
|
||||
QMessageBox::critical(this,"Installation Failed","Cannot write script to temporary Library/Caches/ZeroTier/One folder.",QMessageBox::Ok,QMessageBox::NoButton);
|
||||
QApplication::exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(scr,"#!/bin/bash\n");
|
||||
fprintf(scr,"export PATH=\"/bin:/usr/bin:/sbin:/usr/sbin\"\n");
|
||||
fprintf(scr,"'%s'\n",instPath.c_str());
|
||||
fprintf(scr,"if [ -f '/Library/Application Support/ZeroTier/One/authtoken.secret' ]; then\n");
|
||||
fprintf(scr," mkdir -p '%s/Library/Application Support/ZeroTier/One'\n",homePath.c_str());
|
||||
fprintf(scr," chown %d '%s/Library/Application Support/ZeroTier'\n",(int)getuid(),homePath.c_str());
|
||||
fprintf(scr," chgrp %d '%s/Library/Application Support/ZeroTier'\n",(int)getgid(),homePath.c_str());
|
||||
fprintf(scr," chmod 0700 '%s/Library/Application Support/ZeroTier'\n",homePath.c_str());
|
||||
fprintf(scr," chown %d '%s/Library/Application Support/ZeroTier/One'\n",(int)getuid(),homePath.c_str());
|
||||
fprintf(scr," chgrp %d '%s/Library/Application Support/ZeroTier/One'\n",(int)getgid(),homePath.c_str());
|
||||
fprintf(scr," chmod 0700 '%s/Library/Application Support/ZeroTier/One'\n",homePath.c_str());
|
||||
fprintf(scr," cp -f '/Library/Application Support/ZeroTier/One/authtoken.secret' '%s/Library/Application Support/ZeroTier/One/authtoken.secret'\n",homePath.c_str());
|
||||
fprintf(scr," chown %d '%s/Library/Application Support/ZeroTier/One/authtoken.secret'\n",(int)getuid(),homePath.c_str());
|
||||
fprintf(scr," chgrp %d '%s/Library/Application Support/ZeroTier/One/authtoken.secret'\n",(int)getgid(),homePath.c_str());
|
||||
fprintf(scr," chmod 0600 '%s/Library/Application Support/ZeroTier/One/authtoken.secret'\n",homePath.c_str());
|
||||
fprintf(scr,"fi\n");
|
||||
fprintf(scr,"exit 0\n");
|
||||
|
||||
fclose(scr);
|
||||
chmod(tmpPath.c_str(),0755);
|
||||
|
||||
macExecutePrivilegedShellCommand((std::string("'")+tmpPath+"' >>/dev/null 2>&1").c_str());
|
||||
|
||||
unlink(tmpPath.c_str());
|
||||
unlink(instPath.c_str());
|
||||
|
||||
// Restart the binary with whatever updates may have occurred
|
||||
std::string appPath(QCoreApplication::applicationFilePath().toStdString());
|
||||
execl(appPath.c_str(),appPath.c_str(),(const char *)0);
|
||||
|
||||
// We only make it here if execl() fails
|
||||
QMessageBox::critical(this,"Re-Launch Failed","An error occurred re-launching ZeroTier One.app. Try launching it manually.",QMessageBox::Ok,QMessageBox::NoButton);
|
||||
QApplication::exit(1);
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
} break;
|
||||
}
|
||||
|
||||
ui->progressBar->setMinimum(0);
|
||||
ui->progressBar->setMaximum(100);
|
||||
ui->progressBar->setValue(0);
|
||||
} else {
|
||||
QMessageBox::critical(this,"Download Failed",QString("Download failed: HTTP status code ") + reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toString(),QMessageBox::Ok,QMessageBox::NoButton);
|
||||
QApplication::exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InstallDialog::on_InstallDialog_rejected()
|
||||
{
|
||||
QApplication::exit();
|
||||
}
|
||||
|
||||
void InstallDialog::on_cancelButton_clicked()
|
||||
{
|
||||
QApplication::exit();
|
||||
}
|
||||
|
||||
void InstallDialog::on_downloadProgress(qint64 bytesReceived,qint64 bytesTotal)
|
||||
{
|
||||
if (bytesTotal <= 0) {
|
||||
ui->progressBar->setValue(0);
|
||||
ui->progressBar->setMinimum(0);
|
||||
ui->progressBar->setMaximum(0);
|
||||
} else {
|
||||
double pct = ((double)bytesReceived / (double)bytesTotal) * 100.0;
|
||||
if (pct > 100.0)
|
||||
pct = 100.0;
|
||||
ui->progressBar->setMinimum(0);
|
||||
ui->progressBar->setMaximum(100);
|
||||
ui->progressBar->setValue((int)pct);
|
||||
}
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
/*
|
||||
* ZeroTier One - Global Peer to Peer Ethernet
|
||||
* Copyright (C) 2011-2014 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 INSTALLDIALOG_H
|
||||
#define INSTALLDIALOG_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QUrl>
|
||||
#include <QNetworkRequest>
|
||||
#include <QNetworkReply>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "../node/Address.hpp"
|
||||
|
||||
// Right now InstallDialog is only used on Mac
|
||||
|
||||
namespace Ui {
|
||||
class InstallDialog;
|
||||
}
|
||||
|
||||
class InstallDialog : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit InstallDialog(QWidget *parent = 0);
|
||||
~InstallDialog();
|
||||
|
||||
private slots:
|
||||
void on_networkReply(QNetworkReply *reply);
|
||||
void on_InstallDialog_rejected();
|
||||
void on_cancelButton_clicked();
|
||||
void on_downloadProgress(qint64 bytesReceived,qint64 bytesTotal);
|
||||
|
||||
private:
|
||||
Ui::InstallDialog *ui;
|
||||
QNetworkAccessManager *nam;
|
||||
enum {
|
||||
FETCHING_NFO,
|
||||
FETCHING_INSTALLER
|
||||
} phase;
|
||||
|
||||
ZeroTier::Address signedBy;
|
||||
std::string url,signature;
|
||||
};
|
||||
|
||||
#endif // INSTALLDIALOG_H
|
@ -1,124 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>InstallDialog</class>
|
||||
<widget class="QMainWindow" name="InstallDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>547</width>
|
||||
<height>231</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Install ZeroTier One Service</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="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="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Since this is your first time running ZeroTier One on this computer, the virtual Ethernet service must be downloaded and installed.
|
||||
|
||||
Please wait while the service downloads, then you will be prompted to enter an administrator password to install it.</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::NoTextInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="maximum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<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>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cancelButton">
|
||||
<property name="text">
|
||||
<string>Cancel and Exit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="resources.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
@ -1,43 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "main.h"
|
||||
#include "licensedialog.h"
|
||||
#include "ui_licensedialog.h"
|
||||
|
||||
#include "../node/Constants.hpp"
|
||||
|
||||
LicenseDialog::LicenseDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::LicenseDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
QWidgetList widgets = this->findChildren<QWidget*>();
|
||||
foreach(QWidget *widget, widgets) {
|
||||
QFont font(widget->font());
|
||||
font.setPointSizeF(font.pointSizeF() * 0.75);
|
||||
widget->setFont(font);
|
||||
}
|
||||
this->raise();
|
||||
#endif
|
||||
}
|
||||
|
||||
LicenseDialog::~LicenseDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void LicenseDialog::on_buttonBox_accepted()
|
||||
{
|
||||
settings->setValue("acceptedLicenseV1",true);
|
||||
settings->sync();
|
||||
|
||||
this->setResult(QDialog::Accepted);
|
||||
}
|
||||
|
||||
void LicenseDialog::on_buttonBox_rejected()
|
||||
{
|
||||
::exit(0);
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
#ifndef LICENSEDIALOG_H
|
||||
#define LICENSEDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class LicenseDialog;
|
||||
}
|
||||
|
||||
class LicenseDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit LicenseDialog(QWidget *parent = 0);
|
||||
~LicenseDialog();
|
||||
|
||||
private slots:
|
||||
void on_buttonBox_accepted();
|
||||
|
||||
void on_buttonBox_rejected();
|
||||
|
||||
private:
|
||||
Ui::LicenseDialog *ui;
|
||||
};
|
||||
|
||||
#endif // LICENSEDIALOG_H
|
@ -1,256 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>LicenseDialog</class>
|
||||
<widget class="QDialog" name="LicenseDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>534</width>
|
||||
<height>333</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>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<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="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Do you agree to the terms of the license agreement?</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="licenseDisplayTextEdit">
|
||||
<property name="undoRedoEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><title>GNU General Public License v3.0 - GNU Project - Free Software Foundation (FSF)</title><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'.Lucida Grande UI'; font-size:13pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:14px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:large; font-weight:600;">GNU GENERAL PUBLIC LICENSE</span></p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Version 3, 29 June 2007 </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Copyright © 2007 Free Software Foundation, Inc. &lt;<a href="http://fsf.org/"><span style=" text-decoration: underline; color:#0000ff;">http://fsf.org/</span></a>&gt;</p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="preamble"></a><span style=" font-size:large; font-weight:600;">P</span><span style=" font-size:large; font-weight:600;">reamble</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The GNU General Public License is a free, copyleft license for software and other kinds of works. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The precise terms and conditions for copying, distribution and modification follow. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="terms"></a><span style=" font-size:large; font-weight:600;">T</span><span style=" font-size:large; font-weight:600;">ERMS AND CONDITIONS</span> </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section0"></a><span style=" font-size:medium; font-weight:600;">0</span><span style=" font-size:medium; font-weight:600;">. Definitions.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">“This License” refers to version 3 of the GNU General Public License. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">A “covered work” means either the unmodified Program or a work based on the Program. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section1"></a><span style=" font-size:medium; font-weight:600;">1</span><span style=" font-size:medium; font-weight:600;">. Source Code.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The Corresponding Source for a work in source code form is that same work. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section2"></a><span style=" font-size:medium; font-weight:600;">2</span><span style=" font-size:medium; font-weight:600;">. Basic Permissions.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section3"></a><span style=" font-size:medium; font-weight:600;">3</span><span style=" font-size:medium; font-weight:600;">. Protecting Users' Legal Rights From Anti-Circumvention Law.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section4"></a><span style=" font-size:medium; font-weight:600;">4</span><span style=" font-size:medium; font-weight:600;">. Conveying Verbatim Copies.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section5"></a><span style=" font-size:medium; font-weight:600;">5</span><span style=" font-size:medium; font-weight:600;">. Conveying Modified Source Versions.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: </p>
|
||||
<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">a) The work must carry prominent notices stating that you modified it, and giving a relevant date. </li>
|
||||
<li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”. </li>
|
||||
<li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. </li>
|
||||
<li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. </li></ul>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section6"></a><span style=" font-size:medium; font-weight:600;">6</span><span style=" font-size:medium; font-weight:600;">. Conveying Non-Source Forms.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: </p>
|
||||
<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. </li>
|
||||
<li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. </li>
|
||||
<li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. </li>
|
||||
<li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. </li>
|
||||
<li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. </li></ul>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section7"></a><span style=" font-size:medium; font-weight:600;">7</span><span style=" font-size:medium; font-weight:600;">. Additional Terms.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: </p>
|
||||
<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or </li>
|
||||
<li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or </li>
|
||||
<li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or </li>
|
||||
<li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">d) Limiting the use for publicity purposes of names of licensors or authors of the material; or </li>
|
||||
<li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or </li>
|
||||
<li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. </li></ul>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section8"></a><span style=" font-size:medium; font-weight:600;">8</span><span style=" font-size:medium; font-weight:600;">. Termination.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section9"></a><span style=" font-size:medium; font-weight:600;">9</span><span style=" font-size:medium; font-weight:600;">. Acceptance Not Required for Having Copies.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section10"></a><span style=" font-size:medium; font-weight:600;">1</span><span style=" font-size:medium; font-weight:600;">0. Automatic Licensing of Downstream Recipients.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section11"></a><span style=" font-size:medium; font-weight:600;">1</span><span style=" font-size:medium; font-weight:600;">1. Patents.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section12"></a><span style=" font-size:medium; font-weight:600;">1</span><span style=" font-size:medium; font-weight:600;">2. No Surrender of Others' Freedom.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section13"></a><span style=" font-size:medium; font-weight:600;">1</span><span style=" font-size:medium; font-weight:600;">3. Use with the GNU Affero General Public License.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section14"></a><span style=" font-size:medium; font-weight:600;">1</span><span style=" font-size:medium; font-weight:600;">4. Revised Versions of this License.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section15"></a><span style=" font-size:medium; font-weight:600;">1</span><span style=" font-size:medium; font-weight:600;">5. Disclaimer of Warranty.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section16"></a><span style=" font-size:medium; font-weight:600;">1</span><span style=" font-size:medium; font-weight:600;">6. Limitation of Liability.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section17"></a><span style=" font-size:medium; font-weight:600;">1</span><span style=" font-size:medium; font-weight:600;">7. Interpretation of Sections 15 and 16.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">END OF TERMS AND CONDITIONS </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="howto"></a><span style=" font-size:large; font-weight:600;">H</span><span style=" font-size:large; font-weight:600;">ow to Apply These Terms to Your New Programs</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"> &lt;one line to give the program's name and a brief idea of what it does.&gt;</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"> Copyright (C) &lt;year&gt; &lt;name of author&gt;</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New,courier';"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"> This program is free software: you can redistribute it and/or modify</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"> it under the terms of the GNU General Public License as published by</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"> the Free Software Foundation, either version 3 of the License, or</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"> (at your option) any later version.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New,courier';"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"> This program is distributed in the hope that it will be useful,</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"> but WITHOUT ANY WARRANTY; without even the implied warranty of</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"> GNU General Public License for more details.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New,courier';"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"> You should have received a copy of the GNU General Public License</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"> along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt;. </span></p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Also add information on how to contact you by electronic and paper mail. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: </p>
|
||||
<p style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"> &lt;program&gt; Copyright (C) &lt;year&gt; &lt;name of author&gt;</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"> This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"> This is free software, and you are welcome to redistribute it</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"> under certain conditions; type `show c' for details. </span></p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see &lt;<a href="http://www.gnu.org/licenses/"><span style=" text-decoration: underline; color:#0000ff;">http://www.gnu.org/licenses/</span></a>&gt;. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read &lt;<a href="http://www.gnu.org/philosophy/why-not-lgpl.html"><span style=" text-decoration: underline; color:#0000ff;">http://www.gnu.org/philosophy/why-not-lgpl.html</span></a>&gt;. </p></body></html></string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::No|QDialogButtonBox::Yes</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="resources.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>LicenseDialog</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>LicenseDialog</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,12 +0,0 @@
|
||||
#ifndef mac_doprivileged_h
|
||||
#define mac_doprivileged_h
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
// commandAndArgs can contain only single-tic quotes and should redirect its
|
||||
// stdout and stderr somewhere...
|
||||
bool macExecutePrivilegedShellCommand(const char *commandAndArgs);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,24 +0,0 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "mac_doprivileged.h"
|
||||
|
||||
#undef slots
|
||||
#include <Cocoa/Cocoa.h>
|
||||
|
||||
bool macExecutePrivilegedShellCommand(const char *commandAndArgs)
|
||||
{
|
||||
char tmp[32768];
|
||||
|
||||
snprintf(tmp,sizeof(tmp),"do shell script \"%s\" with administrator privileges\n",commandAndArgs);
|
||||
tmp[32767] = (char)0;
|
||||
|
||||
NSString *scriptApple = [[NSString alloc] initWithUTF8String:tmp];
|
||||
NSAppleScript *as = [[NSAppleScript alloc] initWithSource:scriptApple];
|
||||
NSDictionary *err = nil;
|
||||
[as executeAndReturnError:&err];
|
||||
[as release];
|
||||
[scriptApple release];
|
||||
|
||||
return (err == nil);
|
||||
}
|
@ -1,194 +0,0 @@
|
||||
/*
|
||||
* ZeroTier One - Global Peer to Peer Ethernet
|
||||
* Copyright (C) 2011-2014 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/
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "installdialog.h"
|
||||
#include "licensedialog.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDir>
|
||||
#include <QString>
|
||||
#include <QFont>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "../node/Constants.hpp"
|
||||
#include "../node/Defaults.hpp"
|
||||
|
||||
// Uncomment for testing to disable making sure Windows service is running
|
||||
#define DISABLE_WINDOWS_SERVICE_MANAGEMENT
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#include <WinSock2.h>
|
||||
#include <windows.h>
|
||||
#include "../windows/ZeroTierOne/ZeroTierOneService.h"
|
||||
|
||||
#ifndef DISABLE_WINDOWS_SERVICE_MANAGEMENT
|
||||
// Returns true if started or already running, false if failed or not installed
|
||||
static bool startWindowsService()
|
||||
{
|
||||
SERVICE_STATUS ssSvcStatus;
|
||||
SC_HANDLE schSCManager = NULL;
|
||||
SC_HANDLE schService = NULL;
|
||||
|
||||
schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT);
|
||||
if (schSCManager == NULL)
|
||||
return false;
|
||||
|
||||
schService = OpenServiceA(schSCManager, ZT_SERVICE_NAME, SERVICE_QUERY_STATUS | SERVICE_START);
|
||||
if (schService == NULL) {
|
||||
CloseServiceHandle(schSCManager);
|
||||
return false;
|
||||
}
|
||||
|
||||
int tries = 0;
|
||||
bool running = true;
|
||||
|
||||
for(;;) {
|
||||
memset(&ssSvcStatus,0,sizeof(ssSvcStatus));
|
||||
if ((++tries > 20)||(!QueryServiceStatus(schService,&ssSvcStatus))) {
|
||||
running = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ssSvcStatus.dwCurrentState == SERVICE_RUNNING) {
|
||||
break;
|
||||
} else if (ssSvcStatus.dwCurrentState == SERVICE_START_PENDING) {
|
||||
Sleep(500);
|
||||
continue;
|
||||
}
|
||||
|
||||
StartService(schService,0,NULL);
|
||||
Sleep(500);
|
||||
}
|
||||
|
||||
CloseServiceHandle(schService);
|
||||
CloseServiceHandle(schSCManager);
|
||||
return running;
|
||||
}
|
||||
#endif // !DISABLE_WINDOWS_SERVICE_MANAGEMENT
|
||||
#endif // __WINDOWS__
|
||||
|
||||
// Globally visible settings for the app
|
||||
QSettings *settings = (QSettings *)0;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
// Start up Winsock2
|
||||
{
|
||||
WSADATA wsaData;
|
||||
WSAStartup(MAKEWORD(2,2),&wsaData);
|
||||
}
|
||||
#endif
|
||||
|
||||
{
|
||||
QFile qss(":css/stylesheet.css");
|
||||
qss.open(QFile::ReadOnly);
|
||||
QString style(qss.readAll());
|
||||
a.setStyleSheet(style);
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
// If service isn't installed, download and install it
|
||||
if (!QFile::exists("/Library/Application Support/ZeroTier/One/zerotier-one")) {
|
||||
// InstallDialog is an alternative main window. It will re-launch the app
|
||||
// when done.
|
||||
InstallDialog id;
|
||||
id.setStyleSheet(a.styleSheet());
|
||||
id.show();
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
{
|
||||
// Put QSettings here because this is one of the writable directories allowed
|
||||
// in Apple's app store sandbox specs. We might end up in app store someday.
|
||||
QString zt1AppSupport(QDir::homePath() + "/Library/Application Support/ZeroTier/One");
|
||||
QDir::root().mkpath(zt1AppSupport);
|
||||
settings = new QSettings(zt1AppSupport + "/ui.ini",QSettings::IniFormat);
|
||||
}
|
||||
#else // on non-Apple boxen put it in the standard place using the default format
|
||||
settings = new QSettings("ZeroTier Networks","ZeroTier One");
|
||||
#endif
|
||||
|
||||
if (!settings->value("acceptedLicenseV1",false).toBool()) {
|
||||
LicenseDialog ld;
|
||||
ld.setStyleSheet(a.styleSheet());
|
||||
ld.exec();
|
||||
}
|
||||
|
||||
#if defined(__WINDOWS__) && !defined(DISABLE_WINDOWS_SERVICE_MANAGEMENT)
|
||||
{
|
||||
bool winSvcInstalled = false;
|
||||
while (!startWindowsService()) {
|
||||
if (winSvcInstalled) {
|
||||
// Service was installed and subsequently failed to start again, so
|
||||
// something is wrong!
|
||||
QMessageBox::critical((QWidget *)0,"Service Not Available","Unable to locate or start ZeroTier One service. There may be a problem with the installation. Try installing from the .msi file again or e-mail contact@zerotier.com if you cannot install. (Error: service failed to start)",QMessageBox::Ok);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef _WIN64
|
||||
BOOL is64Bit = TRUE;
|
||||
#else
|
||||
BOOL is64Bit = FALSE;
|
||||
IsWow64Process(GetCurrentProcess(),&is64Bit);
|
||||
#endif
|
||||
std::string exe(ZeroTier::ZT_DEFAULTS.defaultHomePath + "\\zerotier-one_");
|
||||
exe.append((is64Bit == TRUE) ? "x64.exe" : "x86.exe");
|
||||
|
||||
if (QFile::exists(exe.c_str())) {
|
||||
STARTUPINFOA si;
|
||||
PROCESS_INFORMATION pi;
|
||||
memset(&si,0,sizeof(si));
|
||||
memset(&pi,0,sizeof(pi));
|
||||
if (CreateProcessA(NULL,const_cast <LPSTR>((exe + " -I").c_str()),NULL,NULL,FALSE,CREATE_NO_WINDOW|CREATE_NEW_PROCESS_GROUP,NULL,NULL,&si,&pi)) {
|
||||
WaitForSingleObject(pi.hProcess,INFINITE);
|
||||
CloseHandle(pi.hProcess);
|
||||
CloseHandle(pi.hThread);
|
||||
winSvcInstalled = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!winSvcInstalled) {
|
||||
// Service failed to install -- installation problem like missing .exe
|
||||
QMessageBox::critical((QWidget *)0,"Service Not Available","Unable to locate or start ZeroTier One service. There may be a problem with the installation. Try installing from the .msi file again or e-mail contact@zerotier.com if you cannot install. (Error: service not installed)",QMessageBox::Ok);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
MainWindow w;
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
#ifndef MAIN_H
|
||||
#define MAIN_H
|
||||
|
||||
#include <QSettings>
|
||||
#include <QMainWindow>
|
||||
|
||||
extern QSettings *settings;
|
||||
|
||||
#endif // MAIN_H
|
@ -1,424 +0,0 @@
|
||||
/*
|
||||
* ZeroTier One - Global Peer to Peer Ethernet
|
||||
* Copyright (C) 2011-2014 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/
|
||||
*/
|
||||
|
||||
#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>
|
||||
#include <QFont>
|
||||
|
||||
#include "main.h"
|
||||
#include "mainwindow.h"
|
||||
#include "aboutwindow.h"
|
||||
#include "networkwidget.h"
|
||||
#include "ui_mainwindow.h"
|
||||
#include "ui_quickstartdialog.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "mac_doprivileged.h"
|
||||
#endif
|
||||
|
||||
#include "../node/Utils.hpp"
|
||||
#include "../node/Identity.hpp"
|
||||
#include "../node/Defaults.hpp"
|
||||
|
||||
// Globally visible
|
||||
ZeroTier::NodeControlClient *zeroTierClient = (ZeroTier::NodeControlClient *)0;
|
||||
|
||||
// Main window instance for app
|
||||
QMainWindow *mainWindow = (MainWindow *)0;
|
||||
|
||||
// Handles message from ZeroTier One service
|
||||
static void handleZTMessage(void *arg,const char *line)
|
||||
{
|
||||
static std::vector<std::string> ztReplies;
|
||||
static QMutex ztReplies_m;
|
||||
|
||||
ztReplies_m.lock();
|
||||
|
||||
if (line) {
|
||||
//printf("%s\n",line);
|
||||
if ((line[0] == '.')&&(line[1] == (char)0)) {
|
||||
// The message is packed into an event and sent to the main window where
|
||||
// the actual parsing code lives.
|
||||
MainWindow::ZTMessageEvent *event = new MainWindow::ZTMessageEvent(ztReplies);
|
||||
ztReplies.clear();
|
||||
QCoreApplication::postEvent(mainWindow,event); // must post since this may be another thread
|
||||
} else if (line[0]) {
|
||||
ztReplies.push_back(std::string(line));
|
||||
}
|
||||
}
|
||||
|
||||
ztReplies_m.unlock();
|
||||
}
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::MainWindow),
|
||||
pollServiceTimerId(-1)
|
||||
{
|
||||
mainWindow = this;
|
||||
|
||||
ui->setupUi(this);
|
||||
if (ui->networkListWidget->verticalScrollBar())
|
||||
ui->networkListWidget->verticalScrollBar()->setSingleStep(8);
|
||||
|
||||
#ifdef __APPLE__
|
||||
QWidgetList widgets = this->findChildren<QWidget*>();
|
||||
foreach(QWidget *widget, widgets)
|
||||
widget->setAttribute(Qt::WA_MacShowFocusRect,false);
|
||||
#endif
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
// Windows operates at a different DPI, so we have to rescale the default Qt
|
||||
// font sizes so everything isn't huge. Yeah.
|
||||
QWidgetList widgets = this->findChildren<QWidget*>();
|
||||
foreach(QWidget *widget, widgets) {
|
||||
if (typeid(*widget) != typeid(*ui->menuFile)) { // menus don't need the DPI shift apparently
|
||||
QFont font(widget->font());
|
||||
font.setPointSizeF(font.pointSizeF() * 0.75);
|
||||
widget->setFont(font);
|
||||
}
|
||||
}
|
||||
this->raise();
|
||||
#endif
|
||||
|
||||
ui->noNetworksLabel->setVisible(true);
|
||||
ui->noNetworksLabel->setText("Connecting to Service...");
|
||||
ui->bottomContainerWidget->setVisible(false);
|
||||
ui->networkListWidget->setVisible(false);
|
||||
|
||||
this->firstTimerTick = true;
|
||||
this->pollServiceTimerId = this->startTimer(200);
|
||||
this->cyclesSinceResponseFromService = 0;
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete ui;
|
||||
delete zeroTierClient;
|
||||
zeroTierClient = (ZeroTier::NodeControlClient *)0;
|
||||
mainWindow = (MainWindow *)0;
|
||||
}
|
||||
|
||||
void MainWindow::timerEvent(QTimerEvent *event) // event can be null since code also calls this directly
|
||||
{
|
||||
if (this->isHidden())
|
||||
return;
|
||||
if (this->pollServiceTimerId < 0)
|
||||
return;
|
||||
|
||||
// Show quick start dialog on first launch, then reset timer to normal rate
|
||||
if (this->firstTimerTick) {
|
||||
this->firstTimerTick = false;
|
||||
this->killTimer(this->pollServiceTimerId);
|
||||
if (!settings->value("shown_quickStart",false).toBool()) {
|
||||
on_actionQuick_Start_triggered();
|
||||
settings->setValue("shown_quickStart",true);
|
||||
settings->sync();
|
||||
}
|
||||
this->pollServiceTimerId = this->startTimer(2000);
|
||||
}
|
||||
|
||||
if (!zeroTierClient) {
|
||||
#ifdef __APPLE__
|
||||
if ((!QFile::exists(ZeroTier::NodeControlClient::authTokenDefaultUserPath()))&&(QFile::exists("/Library/Application Support/ZeroTier/One/zerotier-one"))) {
|
||||
// Authorize user by copying auth token into local home directory
|
||||
QMessageBox::information(this,"Authorization Needed","Administrator privileges are required to allow the current user to control ZeroTier One on this computer. (You only have to do this once.)",QMessageBox::Ok,QMessageBox::NoButton);
|
||||
|
||||
std::string homePath(QDir::homePath().toStdString());
|
||||
QString zt1Caches(QDir::homePath() + "/Library/Caches/ZeroTier/One");
|
||||
QDir::root().mkpath(zt1Caches);
|
||||
std::string tmpPath((zt1Caches + "/auth.sh").toStdString());
|
||||
|
||||
FILE *scr = fopen(tmpPath.c_str(),"w");
|
||||
if (!scr) {
|
||||
QMessageBox::critical(this,"Cannot Authorize","Unable to authorize this user to administrate ZeroTier One. (Cannot write to temporary Library/Caches/ZeroTier/One folder.)",QMessageBox::Ok,QMessageBox::NoButton);
|
||||
QApplication::exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(scr,"#!/bin/bash\n");
|
||||
fprintf(scr,"export PATH=\"/bin:/usr/bin:/sbin:/usr/sbin\"\n");
|
||||
fprintf(scr,"if [ -f '/Library/Application Support/ZeroTier/One/authtoken.secret' ]; then\n");
|
||||
fprintf(scr," mkdir -p '%s/Library/Application Support/ZeroTier/One'\n",homePath.c_str());
|
||||
fprintf(scr," chown %d '%s/Library/Application Support/ZeroTier'\n",(int)getuid(),homePath.c_str());
|
||||
fprintf(scr," chgrp %d '%s/Library/Application Support/ZeroTier'\n",(int)getgid(),homePath.c_str());
|
||||
fprintf(scr," chmod 0700 '%s/Library/Application Support/ZeroTier'\n",homePath.c_str());
|
||||
fprintf(scr," chown %d '%s/Library/Application Support/ZeroTier/One'\n",(int)getuid(),homePath.c_str());
|
||||
fprintf(scr," chgrp %d '%s/Library/Application Support/ZeroTier/One'\n",(int)getgid(),homePath.c_str());
|
||||
fprintf(scr," chmod 0700 '%s/Library/Application Support/ZeroTier/One'\n",homePath.c_str());
|
||||
fprintf(scr," cp -f '/Library/Application Support/ZeroTier/One/authtoken.secret' '%s/Library/Application Support/ZeroTier/One/authtoken.secret'\n",homePath.c_str());
|
||||
fprintf(scr," chown %d '%s/Library/Application Support/ZeroTier/One/authtoken.secret'\n",(int)getuid(),homePath.c_str());
|
||||
fprintf(scr," chgrp %d '%s/Library/Application Support/ZeroTier/One/authtoken.secret'\n",(int)getgid(),homePath.c_str());
|
||||
fprintf(scr," chmod 0600 '%s/Library/Application Support/ZeroTier/One/authtoken.secret'\n",homePath.c_str());
|
||||
fprintf(scr,"fi\n");
|
||||
fprintf(scr,"exit 0\n");
|
||||
|
||||
fclose(scr);
|
||||
chmod(tmpPath.c_str(),0755);
|
||||
|
||||
macExecutePrivilegedShellCommand((std::string("'")+tmpPath+"' >>/dev/null 2>&1").c_str());
|
||||
|
||||
unlink(tmpPath.c_str());
|
||||
}
|
||||
#endif // __APPLE__
|
||||
|
||||
try {
|
||||
std::string buf;
|
||||
if (ZeroTier::Utils::readFile((ZeroTier::ZT_DEFAULTS.defaultHomePath + ZT_PATH_SEPARATOR_S + "identity.public").c_str(),buf)) {
|
||||
ZeroTier::Identity id;
|
||||
if (id.fromString(buf)) {
|
||||
std::string authToken(ZeroTier::NodeControlClient::getAuthToken(ZeroTier::NodeControlClient::authTokenDefaultUserPath(),false));
|
||||
if (!authToken.length())
|
||||
authToken = ZeroTier::NodeControlClient::getAuthToken((ZeroTier::ZT_DEFAULTS.defaultHomePath + ZT_PATH_SEPARATOR_S + "authtoken.secret").c_str(),false);
|
||||
zeroTierClient = new ZeroTier::NodeControlClient((std::string(ZT_IPC_ENDPOINT_BASE) + id.address().toString()).c_str(),authToken.c_str(),&handleZTMessage,this);
|
||||
const char *err = zeroTierClient->error();
|
||||
if (err) {
|
||||
delete zeroTierClient;
|
||||
zeroTierClient = (ZeroTier::NodeControlClient *)0;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch ( ... ) {
|
||||
zeroTierClient = (ZeroTier::NodeControlClient *)0;
|
||||
}
|
||||
}
|
||||
|
||||
if (++this->cyclesSinceResponseFromService >= 3) {
|
||||
if (this->cyclesSinceResponseFromService == 3) {
|
||||
QMessageBox::warning(this,"Service Not Running","Can't connect to the ZeroTier One service. Is it running?",QMessageBox::Ok);
|
||||
}
|
||||
ui->noNetworksLabel->setVisible(true);
|
||||
ui->noNetworksLabel->setText("Connecting to Service...");
|
||||
ui->bottomContainerWidget->setVisible(false);
|
||||
ui->networkListWidget->setVisible(false);
|
||||
}
|
||||
|
||||
if (zeroTierClient) {
|
||||
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::NodeControlClient::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::NodeControlClient::splitLine(m->ztMessage[i]));
|
||||
// 200 listnetworks <nwid> <name> <mac> <status> <config age> <type> <dev> <ips>
|
||||
if ((l.size() == 10)&&(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->setMAC(l[4]);
|
||||
nw->setStatus(l[5],l[6]);
|
||||
nw->setNetworkType(l[7]);
|
||||
nw->setNetworkDeviceName(l[8]);
|
||||
nw->setIps(l[9]);
|
||||
}
|
||||
}
|
||||
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->setMAC(l[4]);
|
||||
nw->setStatus(l[5],l[6]);
|
||||
nw->setNetworkType(l[7]);
|
||||
nw->setNetworkDeviceName(l[8]);
|
||||
nw->setIps(l[9]);
|
||||
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)
|
||||
++this->numPeers;
|
||||
} else
|
||||
return;
|
||||
|
||||
if (!ui->networkListWidget->count()) {
|
||||
ui->noNetworksLabel->setText("You Have Not Joined Any Networks");
|
||||
ui->noNetworksLabel->setVisible(true);
|
||||
} else ui->noNetworksLabel->setVisible(false);
|
||||
|
||||
if (!ui->bottomContainerWidget->isVisible())
|
||||
ui->bottomContainerWidget->setVisible(true);
|
||||
if (!ui->networkListWidget->isVisible())
|
||||
ui->networkListWidget->setVisible(true);
|
||||
|
||||
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 += " peers";
|
||||
ui->statusLabel->setText(st);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionQuick_Start_triggered()
|
||||
{
|
||||
Ui::QuickstartDialog qd;
|
||||
QDialog *qdd = new QDialog(this);
|
||||
qd.setupUi(qdd);
|
||||
qdd->setModal(false);
|
||||
qdd->show();
|
||||
}
|
@ -1,101 +0,0 @@
|
||||
/*
|
||||
* ZeroTier One - Global Peer to Peer Ethernet
|
||||
* Copyright (C) 2011-2014 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 MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QEvent>
|
||||
#include <QString>
|
||||
#include <QShowEvent>
|
||||
#include <QTimerEvent>
|
||||
#include <QSettings>
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "../node/Constants.hpp"
|
||||
#include "../node/Node.hpp"
|
||||
#include "../node/Utils.hpp"
|
||||
#include "../control/NodeControlClient.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::NodeControlClient *zeroTierClient;
|
||||
|
||||
// Globally visible pointer to main app window
|
||||
extern QMainWindow *mainWindow;
|
||||
|
||||
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();
|
||||
void on_actionQuick_Start_triggered();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
|
||||
QString myAddress;
|
||||
QString myStatus;
|
||||
QString myVersion;
|
||||
bool firstTimerTick;
|
||||
int pollServiceTimerId;
|
||||
unsigned int numPeers;
|
||||
unsigned int cyclesSinceResponseFromService;
|
||||
std::map< std::string,std::vector<std::string> > networks;
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
@ -1,306 +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>850</width>
|
||||
<height>400</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="QLabel" name="noNetworksLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>16</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>You Have Not Joined Any Networks</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>25</number>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::NoTextInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="networkListWidget">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</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>0</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="QToolButton" 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="text">
|
||||
<string notr="true">----------</string>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextOnly</enum>
|
||||
</property>
|
||||
<property name="class" stdset="0">
|
||||
<string notr="true">clickToCopy</string>
|
||||
</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="text">
|
||||
<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="QToolButton" 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="text">
|
||||
<string notr="true">+</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>850</width>
|
||||
<height>34</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuHelp">
|
||||
<property name="title">
|
||||
<string>Help</string>
|
||||
</property>
|
||||
<addaction name="actionAbout"/>
|
||||
<addaction name="actionQuick_Start"/>
|
||||
</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>10</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>
|
||||
<action name="actionQuick_Start">
|
||||
<property name="text">
|
||||
<string>Quick Start</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,181 +0,0 @@
|
||||
/*
|
||||
* ZeroTier One - Global Peer to Peer Ethernet
|
||||
* Copyright (C) 2011-2014 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/
|
||||
*/
|
||||
|
||||
#include "networkwidget.h"
|
||||
#include "mainwindow.h"
|
||||
#include "ui_networkwidget.h"
|
||||
#include "onetimedialog.h"
|
||||
#include "main.h"
|
||||
|
||||
#include <QClipboard>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QCoreApplication>
|
||||
#include <QProcess>
|
||||
#include <QList>
|
||||
#include <QMessageBox>
|
||||
#include <QFont>
|
||||
|
||||
#include "../node/Constants.hpp"
|
||||
|
||||
NetworkWidget::NetworkWidget(QWidget *parent,const std::string &nwid) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::NetworkWidget),
|
||||
networkIdStr(nwid),
|
||||
publicWarningShown(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->networkIdButton->setText(QString(nwid.c_str()));
|
||||
|
||||
QFontMetrics fm(ui->ipListWidget->font());
|
||||
int lineHeight = ui->ipListWidget->spacing() + fm.height();
|
||||
ui->ipListWidget->setMinimumHeight(lineHeight * 6);
|
||||
ui->ipListWidget->setMaximumHeight(lineHeight * 6);
|
||||
|
||||
#ifdef __APPLE__
|
||||
QWidgetList widgets = this->findChildren<QWidget*>();
|
||||
foreach(QWidget* widget, widgets)
|
||||
widget->setAttribute(Qt::WA_MacShowFocusRect,false);
|
||||
#endif
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
QWidgetList widgets = this->findChildren<QWidget*>();
|
||||
foreach(QWidget *widget, widgets) {
|
||||
QFont font(widget->font());
|
||||
font.setPointSizeF(font.pointSizeF() * 0.75);
|
||||
widget->setFont(font);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
NetworkWidget::~NetworkWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void NetworkWidget::setStatus(const std::string &status,const std::string &age)
|
||||
{
|
||||
ui->statusLabel->setText(QString(status.c_str()));
|
||||
}
|
||||
|
||||
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") {
|
||||
if ((!publicWarningShown)&&(!settings->value("shown_publicWarning",false).toBool())) {
|
||||
publicWarningShown = true;
|
||||
OneTimeDialog *d = new OneTimeDialog(mainWindow,"shown_publicWarning","Security Notice","Security Notice:"ZT_EOL_S""ZT_EOL_S"You have joined a public network. Anyone can join these. We recommend making sure that your system's automatic software updates are enabled and turning off any shared network services that you do not want people to access.");
|
||||
d->setModal(false);
|
||||
d->show();
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkWidget::setMAC(const std::string &mac)
|
||||
{
|
||||
ui->macLabel->setText(QString(mac.c_str()));
|
||||
}
|
||||
|
||||
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_networkIdButton_clicked()
|
||||
{
|
||||
QApplication::clipboard()->setText(ui->networkIdButton->text());
|
||||
}
|
||||
|
||||
void NetworkWidget::on_ipListWidget_itemActivated(QListWidgetItem *item)
|
||||
{
|
||||
if (item)
|
||||
QApplication::clipboard()->setText(item->text());
|
||||
}
|
||||
|
||||
void NetworkWidget::on_ipListWidget_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous)
|
||||
{
|
||||
if (current)
|
||||
QApplication::clipboard()->setText(current->text());
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
/*
|
||||
* ZeroTier One - Global Peer to Peer Ethernet
|
||||
* Copyright (C) 2011-2014 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 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);
|
||||
void setMAC(const std::string &mac);
|
||||
|
||||
const std::string &networkId();
|
||||
|
||||
private slots:
|
||||
void on_leaveNetworkButton_clicked();
|
||||
void on_networkIdButton_clicked();
|
||||
void on_ipListWidget_itemActivated(QListWidgetItem *item);
|
||||
void on_ipListWidget_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous);
|
||||
|
||||
private:
|
||||
Ui::NetworkWidget *ui;
|
||||
std::string networkIdStr;
|
||||
bool publicWarningShown;
|
||||
};
|
||||
|
||||
#endif // NETWORK_H
|
@ -1,574 +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>689</width>
|
||||
<height>253</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Network</string>
|
||||
</property>
|
||||
<property name="class" stdset="0">
|
||||
<string notr="true">networkListItem</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">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<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="QWidget" name="networkInfoWidget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolButton" name="networkIdButton">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Courier</family>
|
||||
<pointsize>13</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="text">
|
||||
<string notr="true">----------------</string>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextOnly</enum>
|
||||
</property>
|
||||
<property name="class" stdset="0">
|
||||
<string notr="true">clickToCopy</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>[</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::NoTextInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="nameLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>13</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>
|
||||
<property name="class" stdset="0">
|
||||
<string notr="true">networkName</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>]</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::NoTextInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<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>
|
||||
<item>
|
||||
<widget class="QWidget" name="networkStatsWidget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<property name="rowWrapPolicy">
|
||||
<enum>QFormLayout::DontWrapRows</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>4</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Type:</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="networkTypeLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<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="3" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Status:</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<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>12</pointsize>
|
||||
<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 row="5" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<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="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<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>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>MAC:</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="macLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>Your system's Ethernet MAC address.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>?</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</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>
|
||||
<pointsize>12</pointsize>
|
||||
<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 Addresses</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>IP addresses assigned to this interface; click to copy to clipboard.</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>
|
||||
<property name="class" stdset="0">
|
||||
<string notr="true">ipAddressList</string>
|
||||
</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="QToolButton" 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="text">
|
||||
<string>Leave Network</string>
|
||||
</property>
|
||||
<property name="class" stdset="0">
|
||||
<string notr="true">leaveNetworkButton</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>ipListWidget</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -1,37 +0,0 @@
|
||||
#include "onetimedialog.h"
|
||||
#include "ui_onetimedialog.h"
|
||||
#include "main.h"
|
||||
|
||||
OneTimeDialog::OneTimeDialog(QWidget *parent,const char *propName,const QString &title,const QString &message) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::OneTimeDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->label->setText(message);
|
||||
this->setWindowTitle(title);
|
||||
_propName = propName;
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
QWidgetList widgets = this->findChildren<QWidget*>();
|
||||
foreach(QWidget *widget, widgets) {
|
||||
QFont font(widget->font());
|
||||
font.setPointSizeF(font.pointSizeF() * 0.75);
|
||||
widget->setFont(font);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
OneTimeDialog::~OneTimeDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void OneTimeDialog::on_pushButton_clicked()
|
||||
{
|
||||
if (_propName) {
|
||||
settings->setValue(_propName,ui->checkBox->isChecked());
|
||||
settings->sync();
|
||||
}
|
||||
this->close();
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
#ifndef ONETIMEDIALOG_H
|
||||
#define ONETIMEDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class OneTimeDialog;
|
||||
}
|
||||
|
||||
class OneTimeDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OneTimeDialog(QWidget *parent = 0,const char *propName = (const char *)0,const QString &title = QString(),const QString &message = QString());
|
||||
~OneTimeDialog();
|
||||
|
||||
private slots:
|
||||
void on_pushButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::OneTimeDialog *ui;
|
||||
const char *_propName;
|
||||
};
|
||||
|
||||
#endif // ONETIMEDIALOG_H
|
@ -1,99 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OneTimeDialog</class>
|
||||
<widget class="QDialog" name="OneTimeDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>496</width>
|
||||
<height>197</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<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">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::NoTextInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Don't Show This Message Again</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>OK</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -1,170 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QuickstartDialog</class>
|
||||
<widget class="QDialog" name="QuickstartDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>480</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Quick Start</string>
|
||||
</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="QScrollArea" name="scrollArea">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>785</width>
|
||||
<height>800</height>
|
||||
</rect>
|
||||
</property>
|
||||
<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>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background: #000000;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="resources.qrc">:/img/ZT1GUI.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<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="QLabel" name="label_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Select Help -> Quick Start to see this screen again.</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::NoTextInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>702</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="okButton">
|
||||
<property name="text">
|
||||
<string>OK</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="resources.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>okButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>QuickstartDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>753</x>
|
||||
<y>457</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>399</x>
|
||||
<y>239</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -1,9 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/img">
|
||||
<file>zt1icon.png</file>
|
||||
<file>ZT1GUI.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/css">
|
||||
<file>stylesheet.css</file>
|
||||
</qresource>
|
||||
</RCC>
|
@ -1,106 +0,0 @@
|
||||
QToolButton {
|
||||
margin: 0;
|
||||
padding: 2px;
|
||||
text-align: center;
|
||||
background: palette(button);
|
||||
color: palette(button-text);
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
QToolButton:focus {
|
||||
border: 1px solid #000000;
|
||||
}
|
||||
QToolButton:hover {
|
||||
background: palette(highlight);
|
||||
color: palette(highlight-text);
|
||||
}
|
||||
QToolButton:pressed {
|
||||
border: 1px solid #000000;
|
||||
}
|
||||
|
||||
QToolButton.clickToCopy {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: palette(link);
|
||||
}
|
||||
QToolButton.clickToCopy:focus {
|
||||
text-decoration: underline;
|
||||
}
|
||||
QToolButton.clickToCopy:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
QToolButton.clickToCopy:pressed {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
QToolButton.leaveNetworkButton {
|
||||
margin: 0 4px 3px 0;
|
||||
}
|
||||
|
||||
QMainWindow {
|
||||
background: palette(dark);
|
||||
}
|
||||
|
||||
QListWidget {
|
||||
background: transparent;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: 0;
|
||||
}
|
||||
QListWidget::item {
|
||||
background: palette(base);
|
||||
margin: 1px 0 1px 0;
|
||||
}
|
||||
|
||||
QListWidget.ipAddressList {
|
||||
background: palette(button);
|
||||
margin: 0 4px 4px 0;
|
||||
}
|
||||
QListWidget.ipAddressList::item {
|
||||
background: transparent;
|
||||
color: palette(link);
|
||||
border-bottom: 1px solid transparent;
|
||||
}
|
||||
QListWidget.ipAddressList::item:selected {
|
||||
background: transparent;
|
||||
border-top: 0;
|
||||
border-left: 0;
|
||||
border-right: 0;
|
||||
border-bottom: 1px solid transparent;
|
||||
}
|
||||
QListWidget.ipAddressList::item:hover {
|
||||
border-bottom: 1px solid palette(link);
|
||||
}
|
||||
|
||||
QStatusBar {
|
||||
background: palette(button);
|
||||
}
|
||||
|
||||
QLabel.networkName {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#networkIdButton {
|
||||
padding: 0.2em 0 0 0;
|
||||
}
|
||||
|
||||
#joinNetworkButton {
|
||||
margin: 1px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#noNetworksLabel {
|
||||
background: transparent;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
#networkListWidget {
|
||||
background: palette(dark);
|
||||
margin: 0 0 2px 0;
|
||||
}
|
||||
|
||||
#bottomContainerWidget {
|
||||
background: palette(base);
|
||||
}
|
Before Width: | Height: | Size: 361 KiB |
Before Width: | Height: | Size: 44 KiB |
BIN
artwork/AppIcon.png
Normal file
After Width: | Height: | Size: 40 KiB |
BIN
artwork/AppIcon@2x.png
Normal file
After Width: | Height: | Size: 74 KiB |
BIN
artwork/AppIcon@3x.png
Normal file
After Width: | Height: | Size: 144 KiB |
BIN
artwork/AppIcon_29x29.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
artwork/AppIcon_40x40.png
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
artwork/AppIcon_58x58.png
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
artwork/AppIcon_80x80.png
Normal file
After Width: | Height: | Size: 43 KiB |
BIN
artwork/AppIcon_87x87.png
Normal file
After Width: | Height: | Size: 47 KiB |
BIN
artwork/AppIcon_iPad@2x.png
Normal file
After Width: | Height: | Size: 108 KiB |
BIN
artwork/AppIcon_iPadPro@2x.png
Normal file
After Width: | Height: | Size: 126 KiB |
BIN
artwork/ZeroTierIcon-WithBorder.png
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
artwork/ZeroTierIcon.icns
Normal file
BIN
artwork/ZeroTierIcon.ico
Normal file
After Width: | Height: | Size: 361 KiB |
BIN
artwork/ZeroTierIcon.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
artwork/ZeroTierIcon512x512.png
Normal file
After Width: | Height: | Size: 50 KiB |
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) 2011-2014 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) 2011-2014 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
|
||||
|
651
attic/OSXEthernetTap.cpp.pcap-with-bridge-test
Normal file
@ -0,0 +1,651 @@
|
||||
/*
|
||||
* 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 <errno.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <net/route.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_arp.h>
|
||||
#include <net/if_dl.h>
|
||||
#include <net/if_media.h>
|
||||
#include <netinet6/in6_var.h>
|
||||
#include <netinet/in_var.h>
|
||||
#include <netinet/icmp6.h>
|
||||
|
||||
#include <pcap/pcap.h>
|
||||
|
||||
// OSX compile fix... in6_var defines this in a struct which namespaces it for C++ ... why?!?
|
||||
struct prf_ra {
|
||||
u_char onlink : 1;
|
||||
u_char autonomous : 1;
|
||||
u_char reserved : 6;
|
||||
} prf_ra;
|
||||
|
||||
#include <netinet6/nd6.h>
|
||||
#include <ifaddrs.h>
|
||||
|
||||
// These are KERNEL_PRIVATE... why?
|
||||
#ifndef SIOCAUTOCONF_START
|
||||
#define SIOCAUTOCONF_START _IOWR('i', 132, struct in6_ifreq) /* accept rtadvd on this interface */
|
||||
#endif
|
||||
#ifndef SIOCAUTOCONF_STOP
|
||||
#define SIOCAUTOCONF_STOP _IOWR('i', 133, struct in6_ifreq) /* stop accepting rtadv for this interface */
|
||||
#endif
|
||||
|
||||
#ifndef ETH_ALEN
|
||||
#define ETH_ALEN 6
|
||||
#endif
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// --------------------------------------------------------------------------
|
||||
// This source is from:
|
||||
// http://www.opensource.apple.com/source/Libinfo/Libinfo-406.17/gen.subproj/getifmaddrs.c?txt
|
||||
// It's here because OSX 10.6 does not have this convenience function.
|
||||
|
||||
#define SALIGN (sizeof(uint32_t) - 1)
|
||||
#define SA_RLEN(sa) ((sa)->sa_len ? (((sa)->sa_len + SALIGN) & ~SALIGN) : \
|
||||
(SALIGN + 1))
|
||||
#define MAX_SYSCTL_TRY 5
|
||||
#define RTA_MASKS (RTA_GATEWAY | RTA_IFP | RTA_IFA)
|
||||
|
||||
/* FreeBSD uses NET_RT_IFMALIST and RTM_NEWMADDR from <sys/socket.h> */
|
||||
/* We can use NET_RT_IFLIST2 and RTM_NEWMADDR2 on Darwin */
|
||||
//#define DARWIN_COMPAT
|
||||
|
||||
//#ifdef DARWIN_COMPAT
|
||||
#define GIM_SYSCTL_MIB NET_RT_IFLIST2
|
||||
#define GIM_RTM_ADDR RTM_NEWMADDR2
|
||||
//#else
|
||||
//#define GIM_SYSCTL_MIB NET_RT_IFMALIST
|
||||
//#define GIM_RTM_ADDR RTM_NEWMADDR
|
||||
//#endif
|
||||
|
||||
// Not in 10.6 includes so use our own
|
||||
struct _intl_ifmaddrs {
|
||||
struct _intl_ifmaddrs *ifma_next;
|
||||
struct sockaddr *ifma_name;
|
||||
struct sockaddr *ifma_addr;
|
||||
struct sockaddr *ifma_lladdr;
|
||||
};
|
||||
|
||||
static inline int _intl_getifmaddrs(struct _intl_ifmaddrs **pif)
|
||||
{
|
||||
int icnt = 1;
|
||||
int dcnt = 0;
|
||||
int ntry = 0;
|
||||
size_t len;
|
||||
size_t needed;
|
||||
int mib[6];
|
||||
int i;
|
||||
char *buf;
|
||||
char *data;
|
||||
char *next;
|
||||
char *p;
|
||||
struct ifma_msghdr2 *ifmam;
|
||||
struct _intl_ifmaddrs *ifa, *ift;
|
||||
struct rt_msghdr *rtm;
|
||||
struct sockaddr *sa;
|
||||
|
||||
mib[0] = CTL_NET;
|
||||
mib[1] = PF_ROUTE;
|
||||
mib[2] = 0; /* protocol */
|
||||
mib[3] = 0; /* wildcard address family */
|
||||
mib[4] = GIM_SYSCTL_MIB;
|
||||
mib[5] = 0; /* no flags */
|
||||
do {
|
||||
if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0)
|
||||
return (-1);
|
||||
if ((buf = (char *)malloc(needed)) == NULL)
|
||||
return (-1);
|
||||
if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0) {
|
||||
if (errno != ENOMEM || ++ntry >= MAX_SYSCTL_TRY) {
|
||||
free(buf);
|
||||
return (-1);
|
||||
}
|
||||
free(buf);
|
||||
buf = NULL;
|
||||
}
|
||||
} while (buf == NULL);
|
||||
|
||||
for (next = buf; next < buf + needed; next += rtm->rtm_msglen) {
|
||||
rtm = (struct rt_msghdr *)(void *)next;
|
||||
if (rtm->rtm_version != RTM_VERSION)
|
||||
continue;
|
||||
switch (rtm->rtm_type) {
|
||||
case GIM_RTM_ADDR:
|
||||
ifmam = (struct ifma_msghdr2 *)(void *)rtm;
|
||||
if ((ifmam->ifmam_addrs & RTA_IFA) == 0)
|
||||
break;
|
||||
icnt++;
|
||||
p = (char *)(ifmam + 1);
|
||||
for (i = 0; i < RTAX_MAX; i++) {
|
||||
if ((RTA_MASKS & ifmam->ifmam_addrs &
|
||||
(1 << i)) == 0)
|
||||
continue;
|
||||
sa = (struct sockaddr *)(void *)p;
|
||||
len = SA_RLEN(sa);
|
||||
dcnt += len;
|
||||
p += len;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
data = (char *)malloc(sizeof(struct _intl_ifmaddrs) * icnt + dcnt);
|
||||
if (data == NULL) {
|
||||
free(buf);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
ifa = (struct _intl_ifmaddrs *)(void *)data;
|
||||
data += sizeof(struct _intl_ifmaddrs) * icnt;
|
||||
|
||||
memset(ifa, 0, sizeof(struct _intl_ifmaddrs) * icnt);
|
||||
ift = ifa;
|
||||
|
||||
for (next = buf; next < buf + needed; next += rtm->rtm_msglen) {
|
||||
rtm = (struct rt_msghdr *)(void *)next;
|
||||
if (rtm->rtm_version != RTM_VERSION)
|
||||
continue;
|
||||
|
||||
switch (rtm->rtm_type) {
|
||||
case GIM_RTM_ADDR:
|
||||
ifmam = (struct ifma_msghdr2 *)(void *)rtm;
|
||||
if ((ifmam->ifmam_addrs & RTA_IFA) == 0)
|
||||
break;
|
||||
|
||||
p = (char *)(ifmam + 1);
|
||||
for (i = 0; i < RTAX_MAX; i++) {
|
||||
if ((RTA_MASKS & ifmam->ifmam_addrs &
|
||||
(1 << i)) == 0)
|
||||
continue;
|
||||
sa = (struct sockaddr *)(void *)p;
|
||||
len = SA_RLEN(sa);
|
||||
switch (i) {
|
||||
case RTAX_GATEWAY:
|
||||
ift->ifma_lladdr =
|
||||
(struct sockaddr *)(void *)data;
|
||||
memcpy(data, p, len);
|
||||
data += len;
|
||||
break;
|
||||
|
||||
case RTAX_IFP:
|
||||
ift->ifma_name =
|
||||
(struct sockaddr *)(void *)data;
|
||||
memcpy(data, p, len);
|
||||
data += len;
|
||||
break;
|
||||
|
||||
case RTAX_IFA:
|
||||
ift->ifma_addr =
|
||||
(struct sockaddr *)(void *)data;
|
||||
memcpy(data, p, len);
|
||||
data += len;
|
||||
break;
|
||||
|
||||
default:
|
||||
data += len;
|
||||
break;
|
||||
}
|
||||
p += len;
|
||||
}
|
||||
ift->ifma_next = ift + 1;
|
||||
ift = ift->ifma_next;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
free(buf);
|
||||
|
||||
if (ift > ifa) {
|
||||
ift--;
|
||||
ift->ifma_next = NULL;
|
||||
*pif = ifa;
|
||||
} else {
|
||||
*pif = NULL;
|
||||
free(ifa);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
static inline void _intl_freeifmaddrs(struct _intl_ifmaddrs *ifmp)
|
||||
{
|
||||
free(ifmp);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <algorithm>
|
||||
|
||||
#include "../node/Constants.hpp"
|
||||
#include "../node/Utils.hpp"
|
||||
#include "../node/Mutex.hpp"
|
||||
#include "../node/Dictionary.hpp"
|
||||
#include "OSUtils.hpp"
|
||||
#include "OSXEthernetTap.hpp"
|
||||
|
||||
// ff:ff:ff:ff:ff:ff with no ADI
|
||||
static const ZeroTier::MulticastGroup _blindWildcardMulticastGroup(ZeroTier::MAC(0xff),0);
|
||||
|
||||
static inline bool _setIpv6Stuff(const char *ifname,bool performNUD,bool acceptRouterAdverts)
|
||||
{
|
||||
struct in6_ndireq nd;
|
||||
struct in6_ifreq ifr;
|
||||
|
||||
int s = socket(AF_INET6,SOCK_DGRAM,0);
|
||||
if (s <= 0)
|
||||
return false;
|
||||
|
||||
memset(&nd,0,sizeof(nd));
|
||||
strncpy(nd.ifname,ifname,sizeof(nd.ifname));
|
||||
|
||||
if (ioctl(s,SIOCGIFINFO_IN6,&nd)) {
|
||||
close(s);
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned long oldFlags = (unsigned long)nd.ndi.flags;
|
||||
|
||||
if (performNUD)
|
||||
nd.ndi.flags |= ND6_IFF_PERFORMNUD;
|
||||
else nd.ndi.flags &= ~ND6_IFF_PERFORMNUD;
|
||||
|
||||
if (oldFlags != (unsigned long)nd.ndi.flags) {
|
||||
if (ioctl(s,SIOCSIFINFO_FLAGS,&nd)) {
|
||||
close(s);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
memset(&ifr,0,sizeof(ifr));
|
||||
strncpy(ifr.ifr_name,ifname,sizeof(ifr.ifr_name));
|
||||
if (ioctl(s,acceptRouterAdverts ? SIOCAUTOCONF_START : SIOCAUTOCONF_STOP,&ifr)) {
|
||||
close(s);
|
||||
return false;
|
||||
}
|
||||
|
||||
close(s);
|
||||
return true;
|
||||
}
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
static std::set<std::string> globalDeviceNames;
|
||||
static Mutex globalTapCreateLock;
|
||||
|
||||
OSXEthernetTap::OSXEthernetTap(
|
||||
const char *homePath,
|
||||
const MAC &mac,
|
||||
unsigned int mtu,
|
||||
unsigned int metric,
|
||||
uint64_t nwid,
|
||||
const char *friendlyName,
|
||||
void (*handler)(void *,uint64_t,const MAC &,const MAC &,unsigned int,unsigned int,const void *data,unsigned int len),
|
||||
void *arg) :
|
||||
_handler(handler),
|
||||
_arg(arg),
|
||||
_pcap((void *)0),
|
||||
_nwid(nwid),
|
||||
_mac(mac),
|
||||
_homePath(homePath),
|
||||
_mtu(mtu),
|
||||
_metric(metric),
|
||||
_enabled(true)
|
||||
{
|
||||
char errbuf[PCAP_ERRBUF_SIZE];
|
||||
char devname[64],ethaddr[64],mtustr[32],metstr[32],nwids[32];
|
||||
|
||||
Utils::snprintf(nwids,sizeof(nwids),"%.16llx",nwid);
|
||||
|
||||
if (mtu > 2800)
|
||||
throw std::runtime_error("max tap MTU is 2800");
|
||||
|
||||
Mutex::Lock _gl(globalTapCreateLock);
|
||||
|
||||
std::string desiredDevice;
|
||||
Dictionary devmap;
|
||||
{
|
||||
std::string devmapbuf;
|
||||
if (OSUtils::readFile((_homePath + ZT_PATH_SEPARATOR_S + "devicemap").c_str(),devmapbuf)) {
|
||||
devmap.fromString(devmapbuf);
|
||||
desiredDevice = devmap.get(nwids,"");
|
||||
}
|
||||
}
|
||||
|
||||
if ((desiredDevice.length() >= 9)&&(desiredDevice.substr(0,6) == "bridge")) {
|
||||
// length() >= 9 matches bridge### or bridge####
|
||||
_dev = desiredDevice;
|
||||
} else {
|
||||
if (globalDeviceNames.size() >= (10000 - 128)) // sanity check... this would be nuts
|
||||
throw std::runtime_error("too many devices!");
|
||||
unsigned int pseudoBridgeNo = (unsigned int)((nwid ^ (nwid >> 32)) % (10000 - 128)) + 128; // range: bridge128 to bridge9999
|
||||
sprintf(devname,"bridge%u",pseudoBridgeNo);
|
||||
while (globalDeviceNames.count(std::string(devname)) > 0) {
|
||||
++pseudoBridgeNo;
|
||||
if (pseudoBridgeNo > 9999)
|
||||
pseudoBridgeNo = 64;
|
||||
sprintf(devname,"bridge%u",pseudoBridgeNo);
|
||||
}
|
||||
_dev = devname;
|
||||
}
|
||||
|
||||
// Configure MAC address and MTU, bring interface up
|
||||
long cpid = (long)vfork();
|
||||
if (cpid == 0) {
|
||||
::execl("/sbin/ifconfig","/sbin/ifconfig",_dev.c_str(),"create",(const char *)0);
|
||||
::_exit(-1);
|
||||
} else if (cpid > 0) {
|
||||
int exitcode = -1;
|
||||
::waitpid(cpid,&exitcode,0);
|
||||
if (exitcode != 0)
|
||||
throw std::runtime_error("ifconfig failure setting link-layer address and activating tap interface");
|
||||
} else throw std::runtime_error("unable to fork()");
|
||||
Utils::snprintf(ethaddr,sizeof(ethaddr),"%.2x:%.2x:%.2x:%.2x:%.2x:%.2x",(int)mac[0],(int)mac[1],(int)mac[2],(int)mac[3],(int)mac[4],(int)mac[5]);
|
||||
Utils::snprintf(mtustr,sizeof(mtustr),"%u",_mtu);
|
||||
Utils::snprintf(metstr,sizeof(metstr),"%u",_metric);
|
||||
cpid = (long)vfork();
|
||||
if (cpid == 0) {
|
||||
::execl("/sbin/ifconfig","/sbin/ifconfig",_dev.c_str(),"lladdr",ethaddr,"mtu",mtustr,"metric",metstr,"up",(const char *)0);
|
||||
::_exit(-1);
|
||||
} else if (cpid > 0) {
|
||||
int exitcode = -1;
|
||||
::waitpid(cpid,&exitcode,0);
|
||||
if (exitcode != 0)
|
||||
throw std::runtime_error("ifconfig failure setting link-layer address and activating tap interface");
|
||||
} else throw std::runtime_error("unable to fork()");
|
||||
|
||||
_setIpv6Stuff(_dev.c_str(),true,false);
|
||||
|
||||
_pcap = (void *)pcap_create(_dev.c_str(),errbuf);
|
||||
if (!_pcap) {
|
||||
cpid = (long)vfork();
|
||||
if (cpid == 0) {
|
||||
::execl("/sbin/ifconfig","/sbin/ifconfig",_dev.c_str(),"destroy",(const char *)0);
|
||||
::_exit(-1);
|
||||
} else if (cpid > 0) {
|
||||
int exitcode = -1;
|
||||
::waitpid(cpid,&exitcode,0);
|
||||
}
|
||||
throw std::runtime_error((std::string("pcap_create() on new bridge device failed: ") + errbuf).c_str());
|
||||
}
|
||||
pcap_set_promisc(reinterpret_cast<pcap_t *>(_pcap),1);
|
||||
pcap_set_timeout(reinterpret_cast<pcap_t *>(_pcap),120000);
|
||||
pcap_set_immediate_mode(reinterpret_cast<pcap_t *>(_pcap),1);
|
||||
if (pcap_set_buffer_size(reinterpret_cast<pcap_t *>(_pcap),1024 * 1024 * 16) != 0) // 16MB
|
||||
fprintf(stderr,"WARNING: pcap_set_buffer_size() failed!\n");
|
||||
if (pcap_set_snaplen(reinterpret_cast<pcap_t *>(_pcap),4096) != 0)
|
||||
fprintf(stderr,"WARNING: pcap_set_snaplen() failed!\n");
|
||||
if (pcap_activate(reinterpret_cast<pcap_t *>(_pcap)) != 0) {
|
||||
pcap_close(reinterpret_cast<pcap_t *>(_pcap));
|
||||
cpid = (long)vfork();
|
||||
if (cpid == 0) {
|
||||
::execl("/sbin/ifconfig","/sbin/ifconfig",_dev.c_str(),"destroy",(const char *)0);
|
||||
::_exit(-1);
|
||||
} else if (cpid > 0) {
|
||||
int exitcode = -1;
|
||||
::waitpid(cpid,&exitcode,0);
|
||||
}
|
||||
throw std::runtime_error("pcap_activate() on new bridge device failed.");
|
||||
}
|
||||
|
||||
globalDeviceNames.insert(_dev);
|
||||
|
||||
devmap[nwids] = _dev;
|
||||
OSUtils::writeFile((_homePath + ZT_PATH_SEPARATOR_S + "devicemap").c_str(),devmap.toString());
|
||||
|
||||
_thread = Thread::start(this);
|
||||
}
|
||||
|
||||
OSXEthernetTap::~OSXEthernetTap()
|
||||
{
|
||||
_enabled = false;
|
||||
|
||||
Mutex::Lock _gl(globalTapCreateLock);
|
||||
globalDeviceNames.erase(_dev);
|
||||
|
||||
long cpid = (long)vfork();
|
||||
if (cpid == 0) {
|
||||
::execl("/sbin/ifconfig","/sbin/ifconfig",_dev.c_str(),"destroy",(const char *)0);
|
||||
::_exit(-1);
|
||||
} else if (cpid > 0) {
|
||||
int exitcode = -1;
|
||||
::waitpid(cpid,&exitcode,0);
|
||||
if (exitcode == 0) {
|
||||
// Destroying the interface nukes pcap and terminates the thread.
|
||||
Thread::join(_thread);
|
||||
}
|
||||
}
|
||||
|
||||
pcap_close(reinterpret_cast<pcap_t *>(_pcap));
|
||||
}
|
||||
|
||||
static bool ___removeIp(const std::string &_dev,const InetAddress &ip)
|
||||
{
|
||||
long cpid = (long)vfork();
|
||||
if (cpid == 0) {
|
||||
execl("/sbin/ifconfig","/sbin/ifconfig",_dev.c_str(),"inet",ip.toIpString().c_str(),"-alias",(const char *)0);
|
||||
_exit(-1);
|
||||
} else if (cpid > 0) {
|
||||
int exitcode = -1;
|
||||
waitpid(cpid,&exitcode,0);
|
||||
return (exitcode == 0);
|
||||
}
|
||||
return false; // never reached, make compiler shut up about return value
|
||||
}
|
||||
|
||||
bool OSXEthernetTap::addIp(const InetAddress &ip)
|
||||
{
|
||||
if (!ip)
|
||||
return false;
|
||||
|
||||
std::vector<InetAddress> allIps(ips());
|
||||
if (std::binary_search(allIps.begin(),allIps.end(),ip))
|
||||
return true;
|
||||
|
||||
// Remove and reconfigure if address is the same but netmask is different
|
||||
for(std::vector<InetAddress>::iterator i(allIps.begin());i!=allIps.end();++i) {
|
||||
if ((i->ipsEqual(ip))&&(i->netmaskBits() != ip.netmaskBits())) {
|
||||
if (___removeIp(_dev,*i))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
long cpid = (long)vfork();
|
||||
if (cpid == 0) {
|
||||
::execl("/sbin/ifconfig","/sbin/ifconfig",_dev.c_str(),ip.isV4() ? "inet" : "inet6",ip.toString().c_str(),"alias",(const char *)0);
|
||||
::_exit(-1);
|
||||
} else if (cpid > 0) {
|
||||
int exitcode = -1;
|
||||
::waitpid(cpid,&exitcode,0);
|
||||
return (exitcode == 0);
|
||||
} // else return false...
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OSXEthernetTap::removeIp(const InetAddress &ip)
|
||||
{
|
||||
if (!ip)
|
||||
return true;
|
||||
std::vector<InetAddress> allIps(ips());
|
||||
if (!std::binary_search(allIps.begin(),allIps.end(),ip)) {
|
||||
if (___removeIp(_dev,ip))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<InetAddress> OSXEthernetTap::ips() const
|
||||
{
|
||||
struct ifaddrs *ifa = (struct ifaddrs *)0;
|
||||
if (getifaddrs(&ifa))
|
||||
return std::vector<InetAddress>();
|
||||
|
||||
std::vector<InetAddress> r;
|
||||
|
||||
struct ifaddrs *p = ifa;
|
||||
while (p) {
|
||||
if ((!strcmp(p->ifa_name,_dev.c_str()))&&(p->ifa_addr)&&(p->ifa_netmask)&&(p->ifa_addr->sa_family == p->ifa_netmask->sa_family)) {
|
||||
switch(p->ifa_addr->sa_family) {
|
||||
case AF_INET: {
|
||||
struct sockaddr_in *sin = (struct sockaddr_in *)p->ifa_addr;
|
||||
struct sockaddr_in *nm = (struct sockaddr_in *)p->ifa_netmask;
|
||||
r.push_back(InetAddress(&(sin->sin_addr.s_addr),4,Utils::countBits((uint32_t)nm->sin_addr.s_addr)));
|
||||
} break;
|
||||
case AF_INET6: {
|
||||
struct sockaddr_in6 *sin = (struct sockaddr_in6 *)p->ifa_addr;
|
||||
struct sockaddr_in6 *nm = (struct sockaddr_in6 *)p->ifa_netmask;
|
||||
uint32_t b[4];
|
||||
memcpy(b,nm->sin6_addr.s6_addr,sizeof(b));
|
||||
r.push_back(InetAddress(sin->sin6_addr.s6_addr,16,Utils::countBits(b[0]) + Utils::countBits(b[1]) + Utils::countBits(b[2]) + Utils::countBits(b[3])));
|
||||
} break;
|
||||
}
|
||||
}
|
||||
p = p->ifa_next;
|
||||
}
|
||||
|
||||
if (ifa)
|
||||
freeifaddrs(ifa);
|
||||
|
||||
std::sort(r.begin(),r.end());
|
||||
std::unique(r.begin(),r.end());
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
void OSXEthernetTap::put(const MAC &from,const MAC &to,unsigned int etherType,const void *data,unsigned int len)
|
||||
{
|
||||
char putBuf[4096];
|
||||
if ((len <= _mtu)&&(_enabled)) {
|
||||
to.copyTo(putBuf,6);
|
||||
from.copyTo(putBuf + 6,6);
|
||||
*((uint16_t *)(putBuf + 12)) = htons((uint16_t)etherType);
|
||||
memcpy(putBuf + 14,data,len);
|
||||
len += 14;
|
||||
int r = pcap_inject(reinterpret_cast<pcap_t *>(_pcap),putBuf,len);
|
||||
if (r <= 0) {
|
||||
printf("%s: pcap_inject() failed\n",_dev.c_str());
|
||||
return;
|
||||
}
|
||||
printf("%s: inject %s -> %s etherType==%u len=%u r==%d\n",_dev.c_str(),from.toString().c_str(),to.toString().c_str(),etherType,len,r);
|
||||
}
|
||||
}
|
||||
|
||||
std::string OSXEthernetTap::deviceName() const
|
||||
{
|
||||
return _dev;
|
||||
}
|
||||
|
||||
void OSXEthernetTap::setFriendlyName(const char *friendlyName)
|
||||
{
|
||||
}
|
||||
|
||||
void OSXEthernetTap::scanMulticastGroups(std::vector<MulticastGroup> &added,std::vector<MulticastGroup> &removed)
|
||||
{
|
||||
std::vector<MulticastGroup> newGroups;
|
||||
|
||||
struct _intl_ifmaddrs *ifmap = (struct _intl_ifmaddrs *)0;
|
||||
if (!_intl_getifmaddrs(&ifmap)) {
|
||||
struct _intl_ifmaddrs *p = ifmap;
|
||||
while (p) {
|
||||
if (p->ifma_addr->sa_family == AF_LINK) {
|
||||
struct sockaddr_dl *in = (struct sockaddr_dl *)p->ifma_name;
|
||||
struct sockaddr_dl *la = (struct sockaddr_dl *)p->ifma_addr;
|
||||
if ((la->sdl_alen == 6)&&(in->sdl_nlen <= _dev.length())&&(!memcmp(_dev.data(),in->sdl_data,in->sdl_nlen)))
|
||||
newGroups.push_back(MulticastGroup(MAC(la->sdl_data + la->sdl_nlen,6),0));
|
||||
}
|
||||
p = p->ifma_next;
|
||||
}
|
||||
_intl_freeifmaddrs(ifmap);
|
||||
}
|
||||
|
||||
std::vector<InetAddress> allIps(ips());
|
||||
for(std::vector<InetAddress>::iterator ip(allIps.begin());ip!=allIps.end();++ip)
|
||||
newGroups.push_back(MulticastGroup::deriveMulticastGroupForAddressResolution(*ip));
|
||||
|
||||
std::sort(newGroups.begin(),newGroups.end());
|
||||
std::unique(newGroups.begin(),newGroups.end());
|
||||
|
||||
for(std::vector<MulticastGroup>::iterator m(newGroups.begin());m!=newGroups.end();++m) {
|
||||
if (!std::binary_search(_multicastGroups.begin(),_multicastGroups.end(),*m))
|
||||
added.push_back(*m);
|
||||
}
|
||||
for(std::vector<MulticastGroup>::iterator m(_multicastGroups.begin());m!=_multicastGroups.end();++m) {
|
||||
if (!std::binary_search(newGroups.begin(),newGroups.end(),*m))
|
||||
removed.push_back(*m);
|
||||
}
|
||||
|
||||
_multicastGroups.swap(newGroups);
|
||||
}
|
||||
|
||||
static void _pcapHandler(u_char *ptr,const struct pcap_pkthdr *hdr,const u_char *data)
|
||||
{
|
||||
OSXEthernetTap *tap = reinterpret_cast<OSXEthernetTap *>(ptr);
|
||||
if (hdr->caplen > 14) {
|
||||
MAC to(data,6);
|
||||
MAC from(data + 6,6);
|
||||
if (from == tap->_mac) {
|
||||
unsigned int etherType = ntohs(((const uint16_t *)data)[6]);
|
||||
printf("%s: %s -> %s etherType==%u len==%u\n",tap->_dev.c_str(),from.toString().c_str(),to.toString().c_str(),etherType,(unsigned int)hdr->caplen);
|
||||
// TODO: VLAN support
|
||||
tap->_handler(tap->_arg,tap->_nwid,from,to,etherType,0,(const void *)(data + 14),hdr->len - 14);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OSXEthernetTap::threadMain()
|
||||
throw()
|
||||
{
|
||||
pcap_loop(reinterpret_cast<pcap_t *>(_pcap),-1,&_pcapHandler,reinterpret_cast<u_char *>(this));
|
||||
}
|
||||
|
||||
} // namespace ZeroTier
|
832
attic/OSXEthernetTap.cpp.utun-work-in-progress
Normal file
@ -0,0 +1,832 @@
|
||||
/*
|
||||
* 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 <errno.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sys_domain.h>
|
||||
#include <sys/kern_control.h>
|
||||
#include <net/if_utun.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <net/route.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_arp.h>
|
||||
#include <net/if_dl.h>
|
||||
#include <net/if_media.h>
|
||||
#include <netinet6/in6_var.h>
|
||||
#include <netinet/in_var.h>
|
||||
#include <netinet/icmp6.h>
|
||||
|
||||
// OSX compile fix... in6_var defines this in a struct which namespaces it for C++ ... why?!?
|
||||
struct prf_ra {
|
||||
u_char onlink : 1;
|
||||
u_char autonomous : 1;
|
||||
u_char reserved : 6;
|
||||
} prf_ra;
|
||||
|
||||
#include <netinet6/nd6.h>
|
||||
#include <ifaddrs.h>
|
||||
|
||||
// These are KERNEL_PRIVATE... why?
|
||||
#ifndef SIOCAUTOCONF_START
|
||||
#define SIOCAUTOCONF_START _IOWR('i', 132, struct in6_ifreq) /* accept rtadvd on this interface */
|
||||
#endif
|
||||
#ifndef SIOCAUTOCONF_STOP
|
||||
#define SIOCAUTOCONF_STOP _IOWR('i', 133, struct in6_ifreq) /* stop accepting rtadv for this interface */
|
||||
#endif
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// --------------------------------------------------------------------------
|
||||
// This source is from:
|
||||
// http://www.opensource.apple.com/source/Libinfo/Libinfo-406.17/gen.subproj/getifmaddrs.c?txt
|
||||
// It's here because OSX 10.6 does not have this convenience function.
|
||||
|
||||
#define SALIGN (sizeof(uint32_t) - 1)
|
||||
#define SA_RLEN(sa) ((sa)->sa_len ? (((sa)->sa_len + SALIGN) & ~SALIGN) : \
|
||||
(SALIGN + 1))
|
||||
#define MAX_SYSCTL_TRY 5
|
||||
#define RTA_MASKS (RTA_GATEWAY | RTA_IFP | RTA_IFA)
|
||||
|
||||
/* FreeBSD uses NET_RT_IFMALIST and RTM_NEWMADDR from <sys/socket.h> */
|
||||
/* We can use NET_RT_IFLIST2 and RTM_NEWMADDR2 on Darwin */
|
||||
//#define DARWIN_COMPAT
|
||||
|
||||
//#ifdef DARWIN_COMPAT
|
||||
#define GIM_SYSCTL_MIB NET_RT_IFLIST2
|
||||
#define GIM_RTM_ADDR RTM_NEWMADDR2
|
||||
//#else
|
||||
//#define GIM_SYSCTL_MIB NET_RT_IFMALIST
|
||||
//#define GIM_RTM_ADDR RTM_NEWMADDR
|
||||
//#endif
|
||||
|
||||
// Not in 10.6 includes so use our own
|
||||
struct _intl_ifmaddrs {
|
||||
struct _intl_ifmaddrs *ifma_next;
|
||||
struct sockaddr *ifma_name;
|
||||
struct sockaddr *ifma_addr;
|
||||
struct sockaddr *ifma_lladdr;
|
||||
};
|
||||
|
||||
static inline int _intl_getifmaddrs(struct _intl_ifmaddrs **pif)
|
||||
{
|
||||
int icnt = 1;
|
||||
int dcnt = 0;
|
||||
int ntry = 0;
|
||||
size_t len;
|
||||
size_t needed;
|
||||
int mib[6];
|
||||
int i;
|
||||
char *buf;
|
||||
char *data;
|
||||
char *next;
|
||||
char *p;
|
||||
struct ifma_msghdr2 *ifmam;
|
||||
struct _intl_ifmaddrs *ifa, *ift;
|
||||
struct rt_msghdr *rtm;
|
||||
struct sockaddr *sa;
|
||||
|
||||
mib[0] = CTL_NET;
|
||||
mib[1] = PF_ROUTE;
|
||||
mib[2] = 0; /* protocol */
|
||||
mib[3] = 0; /* wildcard address family */
|
||||
mib[4] = GIM_SYSCTL_MIB;
|
||||
mib[5] = 0; /* no flags */
|
||||
do {
|
||||
if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0)
|
||||
return (-1);
|
||||
if ((buf = (char *)malloc(needed)) == NULL)
|
||||
return (-1);
|
||||
if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0) {
|
||||
if (errno != ENOMEM || ++ntry >= MAX_SYSCTL_TRY) {
|
||||
free(buf);
|
||||
return (-1);
|
||||
}
|
||||
free(buf);
|
||||
buf = NULL;
|
||||
}
|
||||
} while (buf == NULL);
|
||||
|
||||
for (next = buf; next < buf + needed; next += rtm->rtm_msglen) {
|
||||
rtm = (struct rt_msghdr *)(void *)next;
|
||||
if (rtm->rtm_version != RTM_VERSION)
|
||||
continue;
|
||||
switch (rtm->rtm_type) {
|
||||
case GIM_RTM_ADDR:
|
||||
ifmam = (struct ifma_msghdr2 *)(void *)rtm;
|
||||
if ((ifmam->ifmam_addrs & RTA_IFA) == 0)
|
||||
break;
|
||||
icnt++;
|
||||
p = (char *)(ifmam + 1);
|
||||
for (i = 0; i < RTAX_MAX; i++) {
|
||||
if ((RTA_MASKS & ifmam->ifmam_addrs &
|
||||
(1 << i)) == 0)
|
||||
continue;
|
||||
sa = (struct sockaddr *)(void *)p;
|
||||
len = SA_RLEN(sa);
|
||||
dcnt += len;
|
||||
p += len;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
data = (char *)malloc(sizeof(struct _intl_ifmaddrs) * icnt + dcnt);
|
||||
if (data == NULL) {
|
||||
free(buf);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
ifa = (struct _intl_ifmaddrs *)(void *)data;
|
||||
data += sizeof(struct _intl_ifmaddrs) * icnt;
|
||||
|
||||
memset(ifa, 0, sizeof(struct _intl_ifmaddrs) * icnt);
|
||||
ift = ifa;
|
||||
|
||||
for (next = buf; next < buf + needed; next += rtm->rtm_msglen) {
|
||||
rtm = (struct rt_msghdr *)(void *)next;
|
||||
if (rtm->rtm_version != RTM_VERSION)
|
||||
continue;
|
||||
|
||||
switch (rtm->rtm_type) {
|
||||
case GIM_RTM_ADDR:
|
||||
ifmam = (struct ifma_msghdr2 *)(void *)rtm;
|
||||
if ((ifmam->ifmam_addrs & RTA_IFA) == 0)
|
||||
break;
|
||||
|
||||
p = (char *)(ifmam + 1);
|
||||
for (i = 0; i < RTAX_MAX; i++) {
|
||||
if ((RTA_MASKS & ifmam->ifmam_addrs &
|
||||
(1 << i)) == 0)
|
||||
continue;
|
||||
sa = (struct sockaddr *)(void *)p;
|
||||
len = SA_RLEN(sa);
|
||||
switch (i) {
|
||||
case RTAX_GATEWAY:
|
||||
ift->ifma_lladdr =
|
||||
(struct sockaddr *)(void *)data;
|
||||
memcpy(data, p, len);
|
||||
data += len;
|
||||
break;
|
||||
|
||||
case RTAX_IFP:
|
||||
ift->ifma_name =
|
||||
(struct sockaddr *)(void *)data;
|
||||
memcpy(data, p, len);
|
||||
data += len;
|
||||
break;
|
||||
|
||||
case RTAX_IFA:
|
||||
ift->ifma_addr =
|
||||
(struct sockaddr *)(void *)data;
|
||||
memcpy(data, p, len);
|
||||
data += len;
|
||||
break;
|
||||
|
||||
default:
|
||||
data += len;
|
||||
break;
|
||||
}
|
||||
p += len;
|
||||
}
|
||||
ift->ifma_next = ift + 1;
|
||||
ift = ift->ifma_next;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
free(buf);
|
||||
|
||||
if (ift > ifa) {
|
||||
ift--;
|
||||
ift->ifma_next = NULL;
|
||||
*pif = ifa;
|
||||
} else {
|
||||
*pif = NULL;
|
||||
free(ifa);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
static inline void _intl_freeifmaddrs(struct _intl_ifmaddrs *ifmp)
|
||||
{
|
||||
free(ifmp);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <algorithm>
|
||||
|
||||
#include "../node/Constants.hpp"
|
||||
#include "../node/Utils.hpp"
|
||||
#include "../node/Mutex.hpp"
|
||||
#include "../node/Dictionary.hpp"
|
||||
#include "Arp.hpp"
|
||||
#include "OSUtils.hpp"
|
||||
#include "OSXEthernetTap.hpp"
|
||||
|
||||
// ff:ff:ff:ff:ff:ff with no ADI
|
||||
static const ZeroTier::MulticastGroup _blindWildcardMulticastGroup(ZeroTier::MAC(0xff),0);
|
||||
|
||||
static inline bool _setIpv6Stuff(const char *ifname,bool performNUD,bool acceptRouterAdverts)
|
||||
{
|
||||
struct in6_ndireq nd;
|
||||
struct in6_ifreq ifr;
|
||||
|
||||
int s = socket(AF_INET6,SOCK_DGRAM,0);
|
||||
if (s <= 0)
|
||||
return false;
|
||||
|
||||
memset(&nd,0,sizeof(nd));
|
||||
strncpy(nd.ifname,ifname,sizeof(nd.ifname));
|
||||
|
||||
if (ioctl(s,SIOCGIFINFO_IN6,&nd)) {
|
||||
close(s);
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned long oldFlags = (unsigned long)nd.ndi.flags;
|
||||
|
||||
if (performNUD)
|
||||
nd.ndi.flags |= ND6_IFF_PERFORMNUD;
|
||||
else nd.ndi.flags &= ~ND6_IFF_PERFORMNUD;
|
||||
|
||||
if (oldFlags != (unsigned long)nd.ndi.flags) {
|
||||
if (ioctl(s,SIOCSIFINFO_FLAGS,&nd)) {
|
||||
close(s);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
memset(&ifr,0,sizeof(ifr));
|
||||
strncpy(ifr.ifr_name,ifname,sizeof(ifr.ifr_name));
|
||||
if (ioctl(s,acceptRouterAdverts ? SIOCAUTOCONF_START : SIOCAUTOCONF_STOP,&ifr)) {
|
||||
close(s);
|
||||
return false;
|
||||
}
|
||||
|
||||
close(s);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Create an OSX-native utun device (utun# where # is desiredNumber)
|
||||
// Adapted from public domain utun example code by Jonathan Levin
|
||||
static int _make_utun(int desiredNumber)
|
||||
{
|
||||
struct sockaddr_ctl sc;
|
||||
struct ctl_info ctlInfo;
|
||||
struct ifreq ifr;
|
||||
|
||||
memset(&ctlInfo, 0, sizeof(ctlInfo));
|
||||
if (strlcpy(ctlInfo.ctl_name, UTUN_CONTROL_NAME, sizeof(ctlInfo.ctl_name)) >= sizeof(ctlInfo.ctl_name)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int fd = socket(PF_SYSTEM, SOCK_DGRAM, SYSPROTO_CONTROL);
|
||||
if (fd == -1)
|
||||
return -1;
|
||||
if (ioctl(fd, CTLIOCGINFO, &ctlInfo) == -1) {
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
sc.sc_id = ctlInfo.ctl_id;
|
||||
sc.sc_len = sizeof(sc);
|
||||
sc.sc_family = AF_SYSTEM;
|
||||
sc.ss_sysaddr = AF_SYS_CONTROL;
|
||||
sc.sc_unit = desiredNumber + 1;
|
||||
|
||||
if (connect(fd, (struct sockaddr *)&sc, sizeof(sc)) == -1) {
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset(&ifr,0,sizeof(ifr));
|
||||
sprintf(ifr.ifr_name,"utun%d",desiredNumber);
|
||||
if (ioctl(fd,SIOCGIFFLAGS,(void *)&ifr) < 0) {
|
||||
printf("SIOCGIFFLAGS failed\n");
|
||||
}
|
||||
ifr.ifr_flags &= ~IFF_POINTOPOINT;
|
||||
if (ioctl(fd,SIOCSIFFLAGS,(void *)&ifr) < 0) {
|
||||
printf("clear IFF_POINTOPOINT failed\n");
|
||||
}
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
static long globalTapsRunning = 0;
|
||||
static Mutex globalTapCreateLock;
|
||||
|
||||
OSXEthernetTap::OSXEthernetTap(
|
||||
const char *homePath,
|
||||
const MAC &mac,
|
||||
unsigned int mtu,
|
||||
unsigned int metric,
|
||||
uint64_t nwid,
|
||||
const char *friendlyName,
|
||||
void (*handler)(void *,uint64_t,const MAC &,const MAC &,unsigned int,unsigned int,const void *data,unsigned int len),
|
||||
void *arg) :
|
||||
_handler(handler),
|
||||
_arg(arg),
|
||||
_arp((Arp *)0),
|
||||
_nwid(nwid),
|
||||
_homePath(homePath),
|
||||
_mtu(mtu),
|
||||
_metric(metric),
|
||||
_fd(0),
|
||||
_utun(false),
|
||||
_enabled(true)
|
||||
{
|
||||
char devpath[64],ethaddr[64],mtustr[32],metstr[32],nwids[32];
|
||||
struct stat stattmp;
|
||||
|
||||
Utils::snprintf(nwids,sizeof(nwids),"%.16llx",nwid);
|
||||
|
||||
if (mtu > 2800)
|
||||
throw std::runtime_error("max tap MTU is 2800");
|
||||
|
||||
Mutex::Lock _gl(globalTapCreateLock);
|
||||
|
||||
// Read remembered previous device name, if any -- we'll try to reuse
|
||||
Dictionary devmap;
|
||||
std::string desiredDevice;
|
||||
{
|
||||
std::string devmapbuf;
|
||||
if (OSUtils::readFile((_homePath + ZT_PATH_SEPARATOR_S + "devicemap").c_str(),devmapbuf)) {
|
||||
devmap.fromString(devmapbuf);
|
||||
desiredDevice = devmap.get(nwids,"");
|
||||
}
|
||||
}
|
||||
|
||||
if (::stat((_homePath + ZT_PATH_SEPARATOR_S + "tap.kext").c_str(),&stattmp) == 0) {
|
||||
// Try to init kext if it's there, otherwise revert to utun mode
|
||||
|
||||
if (::stat("/dev/zt0",&stattmp)) {
|
||||
long kextpid = (long)vfork();
|
||||
if (kextpid == 0) {
|
||||
::chdir(homePath);
|
||||
OSUtils::redirectUnixOutputs("/dev/null",(const char *)0);
|
||||
::execl("/sbin/kextload","/sbin/kextload","-q","-repository",homePath,"tap.kext",(const char *)0);
|
||||
::_exit(-1);
|
||||
} else if (kextpid > 0) {
|
||||
int exitcode = -1;
|
||||
::waitpid(kextpid,&exitcode,0);
|
||||
}
|
||||
::usleep(500); // give tap device driver time to start up and try again
|
||||
if (::stat("/dev/zt0",&stattmp))
|
||||
_utun = true;
|
||||
}
|
||||
|
||||
if (!_utun) {
|
||||
// See if we can re-use the last device we had.
|
||||
bool recalledDevice = false;
|
||||
if (desiredDevice.length() > 2) {
|
||||
Utils::snprintf(devpath,sizeof(devpath),"/dev/%s",desiredDevice.c_str());
|
||||
if (stat(devpath,&stattmp) == 0) {
|
||||
_fd = ::open(devpath,O_RDWR);
|
||||
if (_fd > 0) {
|
||||
_dev = desiredDevice;
|
||||
recalledDevice = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Open the first unused tap device if we didn't recall a previous one.
|
||||
if (!recalledDevice) {
|
||||
for(int i=0;i<64;++i) {
|
||||
Utils::snprintf(devpath,sizeof(devpath),"/dev/zt%d",i);
|
||||
if (stat(devpath,&stattmp)) {
|
||||
_utun = true;
|
||||
break;
|
||||
}
|
||||
_fd = ::open(devpath,O_RDWR);
|
||||
if (_fd > 0) {
|
||||
char foo[16];
|
||||
Utils::snprintf(foo,sizeof(foo),"zt%d",i);
|
||||
_dev = foo;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_fd <= 0)
|
||||
_utun = true;
|
||||
}
|
||||
} else {
|
||||
_utun = true;
|
||||
}
|
||||
|
||||
if (_utun) {
|
||||
// Use OSX built-in utun device if kext is not available or doesn't work
|
||||
|
||||
int utunNo = 0;
|
||||
|
||||
if ((desiredDevice.length() > 4)&&(desiredDevice.substr(0,4) == "utun")) {
|
||||
utunNo = Utils::strToInt(desiredDevice.substr(4).c_str());
|
||||
if (utunNo >= 0)
|
||||
_fd = _make_utun(utunNo);
|
||||
}
|
||||
|
||||
if (_fd <= 0) {
|
||||
// Start at utun8 to leave lower utuns unused since other stuff might
|
||||
// want them -- OpenVPN, cjdns, etc. I'm not sure if those are smart
|
||||
// enough to scan upward like this.
|
||||
for(utunNo=8;utunNo<=256;++utunNo) {
|
||||
if ((_fd = _make_utun(utunNo)) > 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (_fd <= 0)
|
||||
throw std::runtime_error("unable to find/load ZeroTier tap driver OR use built-in utun driver in OSX; permission or system problem or too many open devices?");
|
||||
|
||||
Utils::snprintf(devpath,sizeof(devpath),"utun%d",utunNo);
|
||||
_dev = devpath;
|
||||
|
||||
// Configure address and bring it up
|
||||
Utils::snprintf(mtustr,sizeof(mtustr),"%u",_mtu);
|
||||
Utils::snprintf(metstr,sizeof(metstr),"%u",_metric);
|
||||
long cpid = (long)vfork();
|
||||
if (cpid == 0) {
|
||||
::execl("/sbin/ifconfig","/sbin/ifconfig",_dev.c_str(),"mtu",mtustr,"metric",metstr,"up",(const char *)0);
|
||||
::_exit(-1);
|
||||
} else if (cpid > 0) {
|
||||
int exitcode = -1;
|
||||
::waitpid(cpid,&exitcode,0);
|
||||
if (exitcode) {
|
||||
::close(_fd);
|
||||
throw std::runtime_error("ifconfig failure activating utun interface");
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// Use our ZeroTier OSX tun/tap driver for zt# Ethernet tap device
|
||||
|
||||
if (fcntl(_fd,F_SETFL,fcntl(_fd,F_GETFL) & ~O_NONBLOCK) == -1) {
|
||||
::close(_fd);
|
||||
throw std::runtime_error("unable to set flags on file descriptor for TAP device");
|
||||
}
|
||||
|
||||
// Configure MAC address and MTU, bring interface up
|
||||
Utils::snprintf(ethaddr,sizeof(ethaddr),"%.2x:%.2x:%.2x:%.2x:%.2x:%.2x",(int)mac[0],(int)mac[1],(int)mac[2],(int)mac[3],(int)mac[4],(int)mac[5]);
|
||||
Utils::snprintf(mtustr,sizeof(mtustr),"%u",_mtu);
|
||||
Utils::snprintf(metstr,sizeof(metstr),"%u",_metric);
|
||||
long cpid = (long)vfork();
|
||||
if (cpid == 0) {
|
||||
::execl("/sbin/ifconfig","/sbin/ifconfig",_dev.c_str(),"lladdr",ethaddr,"mtu",mtustr,"metric",metstr,"up",(const char *)0);
|
||||
::_exit(-1);
|
||||
} else if (cpid > 0) {
|
||||
int exitcode = -1;
|
||||
::waitpid(cpid,&exitcode,0);
|
||||
if (exitcode) {
|
||||
::close(_fd);
|
||||
throw std::runtime_error("ifconfig failure setting link-layer address and activating tap interface");
|
||||
}
|
||||
}
|
||||
|
||||
_setIpv6Stuff(_dev.c_str(),true,false);
|
||||
}
|
||||
|
||||
// Set close-on-exec so that devices cannot persist if we fork/exec for update
|
||||
fcntl(_fd,F_SETFD,fcntl(_fd,F_GETFD) | FD_CLOEXEC);
|
||||
|
||||
::pipe(_shutdownSignalPipe);
|
||||
|
||||
++globalTapsRunning;
|
||||
|
||||
devmap[nwids] = _dev;
|
||||
OSUtils::writeFile((_homePath + ZT_PATH_SEPARATOR_S + "devicemap").c_str(),devmap.toString());
|
||||
|
||||
_thread = Thread::start(this);
|
||||
}
|
||||
|
||||
OSXEthernetTap::~OSXEthernetTap()
|
||||
{
|
||||
Mutex::Lock _gl(globalTapCreateLock);
|
||||
|
||||
::write(_shutdownSignalPipe[1],(const void *)this,1); // writing a byte causes thread to exit
|
||||
Thread::join(_thread);
|
||||
|
||||
::close(_fd);
|
||||
::close(_shutdownSignalPipe[0]);
|
||||
::close(_shutdownSignalPipe[1]);
|
||||
|
||||
if (_utun) {
|
||||
delete _arp;
|
||||
} else {
|
||||
if (--globalTapsRunning <= 0) {
|
||||
globalTapsRunning = 0; // sanity check -- should not be possible
|
||||
|
||||
char tmp[16384];
|
||||
sprintf(tmp,"%s/%s",_homePath.c_str(),"tap.kext");
|
||||
long kextpid = (long)vfork();
|
||||
if (kextpid == 0) {
|
||||
OSUtils::redirectUnixOutputs("/dev/null",(const char *)0);
|
||||
::execl("/sbin/kextunload","/sbin/kextunload",tmp,(const char *)0);
|
||||
::_exit(-1);
|
||||
} else if (kextpid > 0) {
|
||||
int exitcode = -1;
|
||||
::waitpid(kextpid,&exitcode,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OSXEthernetTap::setEnabled(bool en)
|
||||
{
|
||||
_enabled = en;
|
||||
// TODO: interface status change
|
||||
}
|
||||
|
||||
bool OSXEthernetTap::enabled() const
|
||||
{
|
||||
return _enabled;
|
||||
}
|
||||
|
||||
static bool ___removeIp(const std::string &_dev,const InetAddress &ip)
|
||||
{
|
||||
long cpid = (long)vfork();
|
||||
if (cpid == 0) {
|
||||
execl("/sbin/ifconfig","/sbin/ifconfig",_dev.c_str(),"inet",ip.toIpString().c_str(),"-alias",(const char *)0);
|
||||
_exit(-1);
|
||||
} else if (cpid > 0) {
|
||||
int exitcode = -1;
|
||||
waitpid(cpid,&exitcode,0);
|
||||
return (exitcode == 0);
|
||||
}
|
||||
return false; // never reached, make compiler shut up about return value
|
||||
}
|
||||
|
||||
bool OSXEthernetTap::addIp(const InetAddress &ip)
|
||||
{
|
||||
if (!ip)
|
||||
return false;
|
||||
|
||||
std::vector<InetAddress> allIps(ips());
|
||||
if (std::binary_search(allIps.begin(),allIps.end(),ip))
|
||||
return true;
|
||||
|
||||
// Remove and reconfigure if address is the same but netmask is different
|
||||
for(std::vector<InetAddress>::iterator i(allIps.begin());i!=allIps.end();++i) {
|
||||
if ((i->ipsEqual(ip))&&(i->netmaskBits() != ip.netmaskBits())) {
|
||||
if (___removeIp(_dev,*i))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (_utun) {
|
||||
long cpid = (long)vfork();
|
||||
if (cpid == 0) {
|
||||
if (ip.ss_family == AF_INET6) {
|
||||
::execl("/sbin/ifconfig","/sbin/ifconfig",_dev.c_str(),"inet6",ip.toString().c_str(),"alias",(const char *)0);
|
||||
} else {
|
||||
::execl("/sbin/ifconfig","/sbin/ifconfig",_dev.c_str(),ip.toString().c_str(),ip.toIpString().c_str(),"alias",(const char *)0);
|
||||
}
|
||||
::_exit(-1);
|
||||
} else if (cpid > 0) {
|
||||
int exitcode = -1;
|
||||
::waitpid(cpid,&exitcode,0);
|
||||
|
||||
if (exitcode == 0) {
|
||||
if (ip.ss_family == AF_INET) {
|
||||
// Add route to network over tun for IPv4 -- otherwise it behaves
|
||||
// as a simple point to point tunnel instead of a true route.
|
||||
cpid = (long)vfork();
|
||||
if (cpid == 0) {
|
||||
::close(STDERR_FILENO);
|
||||
::close(STDOUT_FILENO);
|
||||
::execl("/sbin/route","/sbin/route","add",ip.network().toString().c_str(),ip.toIpString().c_str(),(const char *)0);
|
||||
::exit(-1);
|
||||
} else if (cpid > 0) {
|
||||
int exitcode = -1;
|
||||
::waitpid(cpid,&exitcode,0);
|
||||
return (exitcode == 0);
|
||||
}
|
||||
} else return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
long cpid = (long)vfork();
|
||||
if (cpid == 0) {
|
||||
::execl("/sbin/ifconfig","/sbin/ifconfig",_dev.c_str(),ip.isV4() ? "inet" : "inet6",ip.toString().c_str(),"alias",(const char *)0);
|
||||
::_exit(-1);
|
||||
} else if (cpid > 0) {
|
||||
int exitcode = -1;
|
||||
::waitpid(cpid,&exitcode,0);
|
||||
return (exitcode == 0);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OSXEthernetTap::removeIp(const InetAddress &ip)
|
||||
{
|
||||
if (!ip)
|
||||
return true;
|
||||
std::vector<InetAddress> allIps(ips());
|
||||
if (!std::binary_search(allIps.begin(),allIps.end(),ip)) {
|
||||
if (___removeIp(_dev,ip))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<InetAddress> OSXEthernetTap::ips() const
|
||||
{
|
||||
struct ifaddrs *ifa = (struct ifaddrs *)0;
|
||||
if (getifaddrs(&ifa))
|
||||
return std::vector<InetAddress>();
|
||||
|
||||
std::vector<InetAddress> r;
|
||||
|
||||
struct ifaddrs *p = ifa;
|
||||
while (p) {
|
||||
if ((!strcmp(p->ifa_name,_dev.c_str()))&&(p->ifa_addr)&&(p->ifa_netmask)&&(p->ifa_addr->sa_family == p->ifa_netmask->sa_family)) {
|
||||
switch(p->ifa_addr->sa_family) {
|
||||
case AF_INET: {
|
||||
struct sockaddr_in *sin = (struct sockaddr_in *)p->ifa_addr;
|
||||
struct sockaddr_in *nm = (struct sockaddr_in *)p->ifa_netmask;
|
||||
r.push_back(InetAddress(&(sin->sin_addr.s_addr),4,Utils::countBits((uint32_t)nm->sin_addr.s_addr)));
|
||||
} break;
|
||||
case AF_INET6: {
|
||||
struct sockaddr_in6 *sin = (struct sockaddr_in6 *)p->ifa_addr;
|
||||
struct sockaddr_in6 *nm = (struct sockaddr_in6 *)p->ifa_netmask;
|
||||
uint32_t b[4];
|
||||
memcpy(b,nm->sin6_addr.s6_addr,sizeof(b));
|
||||
r.push_back(InetAddress(sin->sin6_addr.s6_addr,16,Utils::countBits(b[0]) + Utils::countBits(b[1]) + Utils::countBits(b[2]) + Utils::countBits(b[3])));
|
||||
} break;
|
||||
}
|
||||
}
|
||||
p = p->ifa_next;
|
||||
}
|
||||
|
||||
if (ifa)
|
||||
freeifaddrs(ifa);
|
||||
|
||||
std::sort(r.begin(),r.end());
|
||||
std::unique(r.begin(),r.end());
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
void OSXEthernetTap::put(const MAC &from,const MAC &to,unsigned int etherType,const void *data,unsigned int len)
|
||||
{
|
||||
char putBuf[4096];
|
||||
if ((_fd > 0)&&(len <= _mtu)&&(_enabled)) {
|
||||
to.copyTo(putBuf,6);
|
||||
from.copyTo(putBuf + 6,6);
|
||||
*((uint16_t *)(putBuf + 12)) = htons((uint16_t)etherType);
|
||||
memcpy(putBuf + 14,data,len);
|
||||
len += 14;
|
||||
::write(_fd,putBuf,len);
|
||||
}
|
||||
}
|
||||
|
||||
std::string OSXEthernetTap::deviceName() const
|
||||
{
|
||||
return _dev;
|
||||
}
|
||||
|
||||
void OSXEthernetTap::setFriendlyName(const char *friendlyName)
|
||||
{
|
||||
}
|
||||
|
||||
void OSXEthernetTap::scanMulticastGroups(std::vector<MulticastGroup> &added,std::vector<MulticastGroup> &removed)
|
||||
{
|
||||
std::vector<MulticastGroup> newGroups;
|
||||
|
||||
struct _intl_ifmaddrs *ifmap = (struct _intl_ifmaddrs *)0;
|
||||
if (!_intl_getifmaddrs(&ifmap)) {
|
||||
struct _intl_ifmaddrs *p = ifmap;
|
||||
while (p) {
|
||||
if (p->ifma_addr->sa_family == AF_LINK) {
|
||||
struct sockaddr_dl *in = (struct sockaddr_dl *)p->ifma_name;
|
||||
struct sockaddr_dl *la = (struct sockaddr_dl *)p->ifma_addr;
|
||||
if ((la->sdl_alen == 6)&&(in->sdl_nlen <= _dev.length())&&(!memcmp(_dev.data(),in->sdl_data,in->sdl_nlen)))
|
||||
newGroups.push_back(MulticastGroup(MAC(la->sdl_data + la->sdl_nlen,6),0));
|
||||
}
|
||||
p = p->ifma_next;
|
||||
}
|
||||
_intl_freeifmaddrs(ifmap);
|
||||
}
|
||||
|
||||
std::vector<InetAddress> allIps(ips());
|
||||
for(std::vector<InetAddress>::iterator ip(allIps.begin());ip!=allIps.end();++ip)
|
||||
newGroups.push_back(MulticastGroup::deriveMulticastGroupForAddressResolution(*ip));
|
||||
|
||||
std::sort(newGroups.begin(),newGroups.end());
|
||||
std::unique(newGroups.begin(),newGroups.end());
|
||||
|
||||
for(std::vector<MulticastGroup>::iterator m(newGroups.begin());m!=newGroups.end();++m) {
|
||||
if (!std::binary_search(_multicastGroups.begin(),_multicastGroups.end(),*m))
|
||||
added.push_back(*m);
|
||||
}
|
||||
for(std::vector<MulticastGroup>::iterator m(_multicastGroups.begin());m!=_multicastGroups.end();++m) {
|
||||
if (!std::binary_search(newGroups.begin(),newGroups.end(),*m))
|
||||
removed.push_back(*m);
|
||||
}
|
||||
|
||||
_multicastGroups.swap(newGroups);
|
||||
}
|
||||
|
||||
void OSXEthernetTap::threadMain()
|
||||
throw()
|
||||
{
|
||||
fd_set readfds,nullfds;
|
||||
MAC to,from;
|
||||
int n,nfds,r;
|
||||
char getBuf[8194];
|
||||
|
||||
Thread::sleep(500);
|
||||
|
||||
FD_ZERO(&readfds);
|
||||
FD_ZERO(&nullfds);
|
||||
nfds = (int)std::max(_shutdownSignalPipe[0],_fd) + 1;
|
||||
|
||||
r = 0;
|
||||
for(;;) {
|
||||
FD_SET(_shutdownSignalPipe[0],&readfds);
|
||||
FD_SET(_fd,&readfds);
|
||||
select(nfds,&readfds,&nullfds,&nullfds,(struct timeval *)0);
|
||||
|
||||
if (FD_ISSET(_shutdownSignalPipe[0],&readfds)) // writes to shutdown pipe terminate thread
|
||||
break;
|
||||
|
||||
if (FD_ISSET(_fd,&readfds)) {
|
||||
n = (int)::read(_fd,getBuf + r,sizeof(getBuf) - r);
|
||||
if (n < 0) {
|
||||
if ((errno != EINTR)&&(errno != ETIMEDOUT))
|
||||
break;
|
||||
} else {
|
||||
// Some tap drivers like to send the ethernet frame and the
|
||||
// payload in two chunks, so handle that by accumulating
|
||||
// data until we have at least a frame.
|
||||
r += n;
|
||||
if (r > 14) {
|
||||
if (r > ((int)_mtu + 14)) // sanity check for weird TAP behavior on some platforms
|
||||
r = _mtu + 14;
|
||||
|
||||
if (_enabled) {
|
||||
to.setTo(getBuf,6);
|
||||
from.setTo(getBuf + 6,6);
|
||||
unsigned int etherType = ntohs(((const uint16_t *)getBuf)[6]);
|
||||
// TODO: VLAN support
|
||||
_handler(_arg,_nwid,from,to,etherType,0,(const void *)(getBuf + 14),r - 14);
|
||||
}
|
||||
|
||||
r = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ZeroTier
|
96
attic/OSXEthernetTap.hpp.pcap-with-bridge-test
Normal file
@ -0,0 +1,96 @@
|
||||
/*
|
||||
* ZeroTier One - Network Virtualization Everywhere
|
||||
* Copyright (C) 2011-2015 ZeroTier, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --
|
||||
*
|
||||
* ZeroTier may be used and distributed under the terms of the GPLv3, which
|
||||
* are available at: http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
* If you would like to embed ZeroTier into a commercial application or
|
||||
* redistribute it in a modified binary form, please contact ZeroTier Networks
|
||||
* LLC. Start here: http://www.zerotier.com/
|
||||
*/
|
||||
|
||||
#ifndef ZT_OSXETHERNETTAP_HPP
|
||||
#define ZT_OSXETHERNETTAP_HPP
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "../node/Constants.hpp"
|
||||
#include "../node/MAC.hpp"
|
||||
#include "../node/InetAddress.hpp"
|
||||
#include "../node/MulticastGroup.hpp"
|
||||
|
||||
#include "Thread.hpp"
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
/**
|
||||
* OSX Ethernet tap using ZeroTier kernel extension zt# devices
|
||||
*/
|
||||
class OSXEthernetTap
|
||||
{
|
||||
public:
|
||||
OSXEthernetTap(
|
||||
const char *homePath,
|
||||
const MAC &mac,
|
||||
unsigned int mtu,
|
||||
unsigned int metric,
|
||||
uint64_t nwid,
|
||||
const char *friendlyName,
|
||||
void (*handler)(void *,uint64_t,const MAC &,const MAC &,unsigned int,unsigned int,const void *,unsigned int),
|
||||
void *arg);
|
||||
|
||||
~OSXEthernetTap();
|
||||
|
||||
inline void setEnabled(bool en) { _enabled = en; }
|
||||
inline bool enabled() const { return _enabled; }
|
||||
bool addIp(const InetAddress &ip);
|
||||
bool removeIp(const InetAddress &ip);
|
||||
std::vector<InetAddress> ips() const;
|
||||
void put(const MAC &from,const MAC &to,unsigned int etherType,const void *data,unsigned int len);
|
||||
std::string deviceName() const;
|
||||
void setFriendlyName(const char *friendlyName);
|
||||
void scanMulticastGroups(std::vector<MulticastGroup> &added,std::vector<MulticastGroup> &removed);
|
||||
|
||||
void threadMain()
|
||||
throw();
|
||||
|
||||
// Private members of OSXEthernetTap have public visibility to be accessable
|
||||
// from an internal bounce function; don't modify directly.
|
||||
void (*_handler)(void *,uint64_t,const MAC &,const MAC &,unsigned int,unsigned int,const void *,unsigned int);
|
||||
void *_arg;
|
||||
void *_pcap; // pcap_t *
|
||||
uint64_t _nwid;
|
||||
MAC _mac;
|
||||
Thread _thread;
|
||||
std::string _homePath;
|
||||
std::string _dev;
|
||||
std::vector<MulticastGroup> _multicastGroups;
|
||||
unsigned int _mtu;
|
||||
unsigned int _metric;
|
||||
volatile bool _enabled;
|
||||
};
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
||||
#endif
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* ZeroTier One - Global Peer to Peer Ethernet
|
||||
* Copyright (C) 2011-2014 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
|
||||
@ -32,57 +32,67 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "../node/EthernetTap.hpp"
|
||||
#include "../node/Thread.hpp"
|
||||
#include "../node/Constants.hpp"
|
||||
#include "../node/MAC.hpp"
|
||||
#include "../node/InetAddress.hpp"
|
||||
#include "../node/MulticastGroup.hpp"
|
||||
|
||||
#include "Thread.hpp"
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
class Arp;
|
||||
|
||||
/**
|
||||
* OSX Ethernet tap using ZeroTier kernel extension zt# devices
|
||||
*
|
||||
* This also installs a friendly-named network device in the system network
|
||||
* configuration, permitting network devices to be seen and configured in
|
||||
* the OSX system preferences app.
|
||||
* OSX Ethernet tap supporting either ZeroTier tun/tap kext or OSX-native utun
|
||||
*/
|
||||
class OSXEthernetTap : public EthernetTap
|
||||
class OSXEthernetTap
|
||||
{
|
||||
public:
|
||||
OSXEthernetTap(
|
||||
const char *homePath,
|
||||
const MAC &mac,
|
||||
unsigned int mtu,
|
||||
unsigned int metric,
|
||||
uint64_t nwid,
|
||||
const char *desiredDevice,
|
||||
const char *friendlyName,
|
||||
void (*handler)(void *,const MAC &,const MAC &,unsigned int,const Buffer<4096> &),
|
||||
void (*handler)(void *,uint64_t,const MAC &,const MAC &,unsigned int,unsigned int,const void *,unsigned int),
|
||||
void *arg);
|
||||
|
||||
virtual ~OSXEthernetTap();
|
||||
~OSXEthernetTap();
|
||||
|
||||
virtual void setEnabled(bool en);
|
||||
virtual bool enabled() const;
|
||||
virtual bool addIP(const InetAddress &ip);
|
||||
virtual bool removeIP(const InetAddress &ip);
|
||||
virtual std::set<InetAddress> ips() const;
|
||||
virtual void put(const MAC &from,const MAC &to,unsigned int etherType,const void *data,unsigned int len);
|
||||
virtual std::string deviceName() const;
|
||||
virtual void setFriendlyName(const char *friendlyName);
|
||||
virtual bool updateMulticastGroups(std::set<MulticastGroup> &groups);
|
||||
virtual bool injectPacketFromHost(const MAC &from,const MAC &to,unsigned int etherType,const void *data,unsigned int len);
|
||||
void setEnabled(bool en);
|
||||
bool enabled() const;
|
||||
bool addIp(const InetAddress &ip);
|
||||
bool removeIp(const InetAddress &ip);
|
||||
std::vector<InetAddress> ips() const;
|
||||
void put(const MAC &from,const MAC &to,unsigned int etherType,const void *data,unsigned int len);
|
||||
std::string deviceName() const;
|
||||
void setFriendlyName(const char *friendlyName);
|
||||
void scanMulticastGroups(std::vector<MulticastGroup> &added,std::vector<MulticastGroup> &removed);
|
||||
|
||||
inline bool isNativeUtun() const { return _utun; }
|
||||
|
||||
void threadMain()
|
||||
throw();
|
||||
|
||||
private:
|
||||
void (*_handler)(void *,const MAC &,const MAC &,unsigned int,const Buffer<4096> &);
|
||||
void (*_handler)(void *,uint64_t,const MAC &,const MAC &,unsigned int,unsigned int,const void *,unsigned int);
|
||||
void *_arg;
|
||||
Arp *_arp; // created and used if utun is enabled
|
||||
uint64_t _nwid;
|
||||
Thread _thread;
|
||||
std::string _homePath;
|
||||
std::string _dev;
|
||||
std::vector<MulticastGroup> _multicastGroups;
|
||||
unsigned int _mtu;
|
||||
unsigned int _metric;
|
||||
int _fd;
|
||||
int _shutdownSignalPipe[2];
|
||||
bool _utun;
|
||||
volatile bool _enabled;
|
||||
};
|
||||
|
84
attic/SECURITY.md
Normal file
@ -0,0 +1,84 @@
|
||||
ZeroTier Security
|
||||
======
|
||||
|
||||
## Summary
|
||||
|
||||
|
||||
## Using ZeroTier Securely
|
||||
|
||||
### Overall Recommendations
|
||||
|
||||
*TL;DR: same as anything else: defense in depth defense in depth defense in depth.*
|
||||
|
||||
We encourage our users to treat private ZeroTier networks as being rougly equivalent in security to WPA2-enterprise securied WiFi or on-premise wired Ethernet. (Public networks on the other hand are open by design.) That means they're networks with perimeters, but like all networks the compromise of any participating device or network controller allows an attacker to breach this perimeter.
|
||||
|
||||
**Never trust the network.** Many modern security professionals discourage reliance on network perimeters as major components in any security strategy, and we strongly agree regardless of whether your network is physical or virtual.
|
||||
|
||||
As part of a defense in depth approach **we specifically encourage the use of other secure protocols and authentication systems over ZeroTier networks**. While the use of secure encrypted protocols like SSH and SSL over ZeroTier adds a bit more overhead, it greatly reduces the chance of total compromise.
|
||||
|
||||
Imagine that the per-day probability of a major "0-day" security flaw in ZeroTier and OpenSSH are both roughly 0.001 or one per thousand days. Using both at the same time gives you a cumulative 0-day risk of roughly 0.000001 or one per one million days.
|
||||
|
||||
Those are made-up numbers. In reality these probabilities can't be known ahead of time. History shows that a 0-day could be found in anything tomorrow, next week, or never. But layers of security give you an overall posture that is the product -- more than the sum -- of its parts. That's how defense in depth works.
|
||||
|
||||
### ZeroTier Specifics
|
||||
|
||||
#### Protect Your Identity
|
||||
|
||||
Each ZeroTier device has an identity. The secret portion of this identity is stored in a file called "identity.secret." *Protect this file.* If it's stolen your device's identity (as represented by its 10-digit ZeroTier address) can easily be stolen or impersonated and your traffic can be decrypted or man-in-the-middle'd.
|
||||
|
||||
#### Protect Your Controller
|
||||
|
||||
The second major component of ZeroTier network security is the network controller. It's responsible for issuing certificates and configuration information to all network members. That makes it a certificate authority. Compromise of the controller allows an attacker to join or disrupt any network the controller controls. It does *not*, however, allow an attacker to decrypt peer to peer unicast traffic.
|
||||
|
||||
If you are using our controller-as-a-service at [my.zerotier.com](https://my.zerotier.com), you are delegating this responsibility to us.
|
||||
|
||||
## Security Priorities
|
||||
|
||||
These are our security "must-haves." If the system fails in any of these objectives it is broken.
|
||||
|
||||
* ZeroTier must be secure against remote vulnerabilities. This includes things like unauthorized remote control, remote penetration of the device using ZeroTier as a vector, or remote injection of malware.
|
||||
|
||||
* The content (but not meta-data) of communication must be secure against eavesdropping on the wire by any known means. (We can't warrant against secret vulnerabilities against ciphers, etc., or anything else we don't know about.)
|
||||
|
||||
* Communication must be secure against man-in-the-middle attacks and remote device impersonation.
|
||||
|
||||
## Security Non-Priorities
|
||||
|
||||
There are a few aspects of security we knowingly do not address, since doing so would be beyond scope or would conflict too greatly with other priorities.
|
||||
|
||||
* ZeroTier makes no effort to conceal communication meta-data such as source and destination addresses and the amount of information transferred between peers. To do this more or less requires onion routing or other "heavy" approaches to anonymity, and this is beyond scope.
|
||||
|
||||
* ZeroTier does not implement complex certificate chains, X.509, or other feature-rich (some would say feature-laden) cryptographic stuff. We only implement the crypto we need to get the job done.
|
||||
|
||||
* We don't take extraordinary measures to preserve security under conditions in which an endpoint device has been penetrated by other means (e.g. "rooted" by third party malware) or physicall compromised. If someone steals your keys they've stolen your keys, and if they've "pwned" your device they can easily eavesdrop on everything directly.
|
||||
|
||||
## Insecurities and Areas for Improvement
|
||||
|
||||
The only perfectly secure system is one that is off. All real world systems have potential security weaknesses. If possible, we like to know what these are and acknowledge their existence.
|
||||
|
||||
In some cases we plan to improve these. In other cases we have deliberately decided to "punt" on them in favor of some other priority (see philosophy). We may or may not revisit this decision in the future.
|
||||
|
||||
* We don't implement forward secrecy / ephemeral keys. A [discussion of this can be found at the closed GitHub issue for this feature](https://github.com/zerotier/ZeroTierOne/issues/204). In short: we've decided to "punt" on this feature because it introduces complexity and state negotiation. One of the design goals of ZeroTier is "reliability convergence" -- the reliability of ZeroTier virtual networks should rapidly converge with that of the underlying physical wire. Any state that must be negotiated prior to communication multiplies the probability of delay or failure due to packet loss. We *may* revisit this decision at a later date.
|
||||
|
||||
## Secure Coding Practices
|
||||
|
||||
The first line of defense employed against remote vulnerabilities and other major security flaws is the use of secure coding practices. These are, in no particular order:
|
||||
|
||||
* All parsing of remote messages is performed via higher level safe bounds-checked data structures and interfaces. See node/Buffer.hpp for one of the core elements of this.
|
||||
|
||||
* C++ exceptions are used to ensure that any unhandled failure or error condition (such as a bounds checking violation) results in the safe and complete termination of message processing. Invalid messages are dropped and ignored.
|
||||
|
||||
* Minimalism is a secure coding practice. There is an exponential relationship between complexity and the probability of bugs, and complex designs are much harder to audit and reason about.
|
||||
|
||||
* Our build scripts try to enable any OS and compiler level security features such as ASLR and "stack canaries" on non-debug builds.
|
||||
|
||||
## Cryptographic Security Practices
|
||||
|
||||
* We use [boring crypto](https://cr.yp.to/talks/2015.10.05/slides-djb-20151005-a4.pdf). A single symmetric algorithm (Salsa20/12), a single asymmetric algorithm (Curve25519 ECDH-256), and a single MAC (Poly1305). The way these algorithms are used is identical to how they're used in the NaCl reference implementation. The protocol supports selection of alternative algorithms but only for "future proofing" in the case that a serious flaw is discovered in any of these. Avoding algorithm bloat and cryptographic state negotiation helps guard against down-grade, "oracle," and other protocol level attacks.
|
||||
|
||||
* Authenticated encryption is employed with authentication being performed prior to any other operations on received messages. See also: [the cryptographic doom principle](https://moxie.org/blog/the-cryptographic-doom-principle/).
|
||||
|
||||
* "Never branch on anything secret" -- deterministic-time comparisons and other operations are used in cryptographic operations. See Utils::secureEq() in node/Utils.hpp.
|
||||
|
||||
* OS-derived crypographic random numbers (/dev/urandom or Windows CryptGenRandom) are further randomized using encryption by a secondary key with a secondary source of entropy to guard against CSPRNG bugs. Such OS-level CSPRNG bugs have been found in the past. See Utils::getSecureRandom() in node/Utils.hpp.
|
||||
|
BIN
attic/big-http-test/2015-11-10_01_50000.out.xz
Normal file
BIN
attic/big-http-test/2015-11-10_02_50000.out.xz
Normal file
BIN
attic/big-http-test/2015-11-10_03_12500_ec2-east-only.out.xz
Normal file
24
attic/big-http-test/Dockerfile
Normal file
@ -0,0 +1,24 @@
|
||||
FROM centos:latest
|
||||
|
||||
MAINTAINER https://www.zerotier.com/
|
||||
|
||||
EXPOSE 9993/udp
|
||||
|
||||
ADD nodesource-el.repo /etc/yum.repos.d/nodesource-el.repo
|
||||
RUN yum -y update && yum install -y nodejs && yum clean all
|
||||
|
||||
RUN mkdir -p /var/lib/zerotier-one
|
||||
RUN mkdir -p /var/lib/zerotier-one/networks.d
|
||||
RUN touch /var/lib/zerotier-one/networks.d/ffffffffffffffff.conf
|
||||
|
||||
ADD package.json /
|
||||
RUN npm install
|
||||
|
||||
ADD zerotier-one /
|
||||
RUN chmod a+x /zerotier-one
|
||||
|
||||
ADD agent.js /
|
||||
ADD docker-main.sh /
|
||||
RUN chmod a+x /docker-main.sh
|
||||
|
||||
CMD ["./docker-main.sh"]
|
12
attic/big-http-test/README.md
Normal file
@ -0,0 +1,12 @@
|
||||
HTTP one-to-all test
|
||||
======
|
||||
|
||||
*This is really internal use code. You're free to test it out but expect to do some editing/tweaking to make it work. We used this to run some massive scale tests of our new geo-cluster-based root server infrastructure prior to taking it live.*
|
||||
|
||||
Before using this code you will want to edit agent.js to change SERVER_HOST to the IP address of where you will run server.js. This should typically be an open Internet IP, since this makes reporting not dependent upon the thing being tested. Also note that this thing does no security of any kind. It's designed for one-off tests run over a short period of time, not to be anything that runs permanently. You will also want to edit the Dockerfile if you want to build containers and change the network ID to the network you want to run tests over.
|
||||
|
||||
This code can be deployed across a large number of VMs or containers to test and benchmark HTTP traffic within a virtual network at scale. The agent acts as a server and can query other agents, while the server collects agent data and tells agents about each other. It's designed to use RFC4193-based ZeroTier IPv6 addresses within the cluster, which allows the easy provisioning of a large cluster without IP conflicts.
|
||||
|
||||
The Dockerfile builds an image that launches the agent. The image must be "docker run" with "--device=/dev/net/tun --privileged" to permit it to open a tun/tap device within the container. (Unfortunately CAP_NET_ADMIN may not work due to a bug in Docker and/or Linux.) You can run a bunch with a command like:
|
||||
|
||||
for ((n=0;n<10;n++)); do docker run --device=/dev/net/tun --privileged -d zerotier/http-test; done
|
196
attic/big-http-test/agent.js
Normal file
@ -0,0 +1,196 @@
|
||||
// ZeroTier distributed HTTP test agent
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Customizable parameters:
|
||||
|
||||
// Time between startup and first test attempt
|
||||
var TEST_STARTUP_LAG = 10000;
|
||||
|
||||
// Maximum interval between test attempts (actual timing is random % this)
|
||||
var TEST_INTERVAL_MAX = (60000 * 10);
|
||||
|
||||
// Test timeout in ms
|
||||
var TEST_TIMEOUT = 30000;
|
||||
|
||||
// Where should I get other agents' IDs and POST results?
|
||||
var SERVER_HOST = '52.26.196.147';
|
||||
var SERVER_PORT = 18080;
|
||||
|
||||
// Which port do agents use to serve up test data to each other?
|
||||
var AGENT_PORT = 18888;
|
||||
|
||||
// Payload size in bytes
|
||||
var PAYLOAD_SIZE = 5000;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
var ipaddr = require('ipaddr.js');
|
||||
var os = require('os');
|
||||
var http = require('http');
|
||||
var async = require('async');
|
||||
|
||||
var express = require('express');
|
||||
var app = express();
|
||||
|
||||
// Find our ZeroTier-assigned RFC4193 IPv6 address
|
||||
var thisAgentId = null;
|
||||
var interfaces = os.networkInterfaces();
|
||||
if (!interfaces) {
|
||||
console.error('FATAL: os.networkInterfaces() failed.');
|
||||
process.exit(1);
|
||||
}
|
||||
for(var ifname in interfaces) {
|
||||
var ifaddrs = interfaces[ifname];
|
||||
if (Array.isArray(ifaddrs)) {
|
||||
for(var i=0;i<ifaddrs.length;++i) {
|
||||
if (ifaddrs[i].family == 'IPv6') {
|
||||
try {
|
||||
var ipbytes = ipaddr.parse(ifaddrs[i].address).toByteArray();
|
||||
if ((ipbytes.length === 16)&&(ipbytes[0] == 0xfd)&&(ipbytes[9] == 0x99)&&(ipbytes[10] == 0x93)) {
|
||||
thisAgentId = '';
|
||||
for(var j=0;j<16;++j) {
|
||||
var tmp = ipbytes[j].toString(16);
|
||||
if (tmp.length === 1)
|
||||
thisAgentId += '0';
|
||||
thisAgentId += tmp;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (thisAgentId === null) {
|
||||
console.error('FATAL: no ZeroTier-assigned RFC4193 IPv6 addresses found on any local interface!');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
//console.log(thisAgentId);
|
||||
|
||||
// Create a random (and therefore not very compressable) payload
|
||||
var payload = new Buffer(PAYLOAD_SIZE);
|
||||
for(var xx=0;xx<PAYLOAD_SIZE;++xx) {
|
||||
payload.writeUInt8(Math.round(Math.random() * 255.0),xx);
|
||||
}
|
||||
|
||||
function agentIdToIp(agentId)
|
||||
{
|
||||
var ip = '';
|
||||
ip += agentId.substr(0,4);
|
||||
ip += ':';
|
||||
ip += agentId.substr(4,4);
|
||||
ip += ':';
|
||||
ip += agentId.substr(8,4);
|
||||
ip += ':';
|
||||
ip += agentId.substr(12,4);
|
||||
ip += ':';
|
||||
ip += agentId.substr(16,4);
|
||||
ip += ':';
|
||||
ip += agentId.substr(20,4);
|
||||
ip += ':';
|
||||
ip += agentId.substr(24,4);
|
||||
ip += ':';
|
||||
ip += agentId.substr(28,4);
|
||||
return ip;
|
||||
};
|
||||
|
||||
var lastTestResult = null;
|
||||
var allOtherAgents = {};
|
||||
|
||||
function doTest()
|
||||
{
|
||||
var submit = http.request({
|
||||
host: SERVER_HOST,
|
||||
port: SERVER_PORT,
|
||||
path: '/'+thisAgentId,
|
||||
method: 'POST'
|
||||
},function(res) {
|
||||
var body = '';
|
||||
res.on('data',function(chunk) { body += chunk.toString(); });
|
||||
res.on('end',function() {
|
||||
|
||||
if (body) {
|
||||
try {
|
||||
var peers = JSON.parse(body);
|
||||
if (Array.isArray(peers)) {
|
||||
for(var xx=0;xx<peers.length;++xx)
|
||||
allOtherAgents[peers[xx]] = true;
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
var agents = Object.keys(allOtherAgents);
|
||||
if (agents.length > 1) {
|
||||
|
||||
var target = agents[Math.floor(Math.random() * agents.length)];
|
||||
while (target === thisAgentId)
|
||||
target = agents[Math.floor(Math.random() * agents.length)];
|
||||
|
||||
var testRequest = null;
|
||||
var timeoutId = null;
|
||||
timeoutId = setTimeout(function() {
|
||||
if (testRequest !== null)
|
||||
testRequest.abort();
|
||||
timeoutId = null;
|
||||
},TEST_TIMEOUT);
|
||||
var startTime = Date.now();
|
||||
|
||||
testRequest = http.get({
|
||||
host: agentIdToIp(target),
|
||||
port: AGENT_PORT,
|
||||
path: '/'
|
||||
},function(res) {
|
||||
var bytes = 0;
|
||||
res.on('data',function(chunk) { bytes += chunk.length; });
|
||||
res.on('end',function() {
|
||||
lastTestResult = {
|
||||
source: thisAgentId,
|
||||
target: target,
|
||||
time: (Date.now() - startTime),
|
||||
bytes: bytes,
|
||||
timedOut: (timeoutId === null),
|
||||
error: null
|
||||
};
|
||||
if (timeoutId !== null)
|
||||
clearTimeout(timeoutId);
|
||||
return setTimeout(doTest,Math.round(Math.random() * TEST_INTERVAL_MAX) + 1);
|
||||
});
|
||||
}).on('error',function(e) {
|
||||
lastTestResult = {
|
||||
source: thisAgentId,
|
||||
target: target,
|
||||
time: (Date.now() - startTime),
|
||||
bytes: 0,
|
||||
timedOut: (timeoutId === null),
|
||||
error: e.toString()
|
||||
};
|
||||
if (timeoutId !== null)
|
||||
clearTimeout(timeoutId);
|
||||
return setTimeout(doTest,Math.round(Math.random() * TEST_INTERVAL_MAX) + 1);
|
||||
});
|
||||
|
||||
} else {
|
||||
return setTimeout(doTest,1000);
|
||||
}
|
||||
|
||||
});
|
||||
}).on('error',function(e) {
|
||||
console.log('POST failed: '+e.toString());
|
||||
return setTimeout(doTest,1000);
|
||||
});
|
||||
if (lastTestResult !== null) {
|
||||
submit.write(JSON.stringify(lastTestResult));
|
||||
lastTestResult = null;
|
||||
}
|
||||
submit.end();
|
||||
};
|
||||
|
||||
// Agents just serve up a test payload
|
||||
app.get('/',function(req,res) { return res.status(200).send(payload); });
|
||||
|
||||
var expressServer = app.listen(AGENT_PORT,function () {
|
||||
// Start timeout-based loop
|
||||
setTimeout(doTest(),TEST_STARTUP_LAG);
|
||||
});
|
9
attic/big-http-test/big-test-kill.sh
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Kills all running Docker containers on all big-test-hosts
|
||||
|
||||
export PATH=/bin:/usr/bin:/usr/local/bin:/usr/sbin:/sbin
|
||||
|
||||
pssh -h big-test-hosts -x '-t -t' -i -OUserKnownHostsFile=/dev/null -OStrictHostKeyChecking=no -t 0 -p 256 "sudo docker ps -aq | xargs -r sudo docker rm -f"
|
||||
|
||||
exit 0
|
13
attic/big-http-test/big-test-start.sh
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
# More than 500 container seems to result in a lot of sporadic failures, probably due to Linux kernel scaling issues with virtual network ports
|
||||
# 250 with a 16GB RAM VM like Amazon m4.xlarge seems good
|
||||
NUM_CONTAINERS=250
|
||||
CONTAINER_IMAGE=zerotier/http-test
|
||||
SCALE_UP_DELAY=10
|
||||
|
||||
export PATH=/bin:/usr/bin:/usr/local/bin:/usr/sbin:/sbin
|
||||
|
||||
pssh -h big-test-hosts -x '-t -t' -i -OUserKnownHostsFile=/dev/null -OStrictHostKeyChecking=no -t 0 -p 256 "sudo sysctl -w net.netfilter.nf_conntrack_max=262144 ; for ((n=0;n<$NUM_CONTAINERS;n++)); do sudo docker run --device=/dev/net/tun --privileged -d $CONTAINER_IMAGE; sleep $SCALE_UP_DELAY; done"
|
||||
|
||||
exit 0
|
65
attic/big-http-test/crunch-results.js
Normal file
@ -0,0 +1,65 @@
|
||||
//
|
||||
// Pipe the output of server.js into this to convert raw test results into bracketed statistics
|
||||
// suitable for graphing.
|
||||
//
|
||||
|
||||
// Time duration per statistical bracket
|
||||
var BRACKET_SIZE = 10000;
|
||||
|
||||
// Number of bytes expected from each test
|
||||
var EXPECTED_BYTES = 5000;
|
||||
|
||||
var readline = require('readline');
|
||||
var rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout,
|
||||
terminal: false
|
||||
});
|
||||
|
||||
var count = 0.0;
|
||||
var overallCount = 0.0;
|
||||
var totalFailures = 0.0;
|
||||
var totalOverallFailures = 0.0;
|
||||
var totalMs = 0;
|
||||
var totalData = 0;
|
||||
var devices = {};
|
||||
var lastBracketTs = 0;
|
||||
|
||||
rl.on('line',function(line) {
|
||||
line = line.trim();
|
||||
var ls = line.split(',');
|
||||
if (ls.length == 7) {
|
||||
var ts = parseInt(ls[0]);
|
||||
var fromId = ls[1];
|
||||
var toId = ls[2];
|
||||
var ms = parseFloat(ls[3]);
|
||||
var bytes = parseInt(ls[4]);
|
||||
var timedOut = (ls[5] == 'true') ? true : false;
|
||||
var errMsg = ls[6];
|
||||
|
||||
count += 1.0;
|
||||
overallCount += 1.0;
|
||||
if ((bytes !== EXPECTED_BYTES)||(timedOut)) {
|
||||
totalFailures += 1.0;
|
||||
totalOverallFailures += 1.0;
|
||||
}
|
||||
totalMs += ms;
|
||||
totalData += bytes;
|
||||
|
||||
devices[fromId] = true;
|
||||
devices[toId] = true;
|
||||
|
||||
if (lastBracketTs === 0)
|
||||
lastBracketTs = ts;
|
||||
|
||||
if (((ts - lastBracketTs) >= BRACKET_SIZE)&&(count > 0.0)) {
|
||||
console.log(count.toString()+','+overallCount.toString()+','+(totalMs / count)+','+(totalFailures / count)+','+(totalOverallFailures / overallCount)+','+totalData+','+Object.keys(devices).length);
|
||||
|
||||
count = 0.0;
|
||||
totalFailures = 0.0;
|
||||
totalMs = 0;
|
||||
totalData = 0;
|
||||
lastBracketTs = ts;
|
||||
}
|
||||
} // else ignore junk
|
||||
});
|
16
attic/big-http-test/docker-main.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin
|
||||
|
||||
/zerotier-one -d >>zerotier-one.out 2>&1
|
||||
|
||||
# Wait for ZeroTier to start and join the network
|
||||
while [ ! -d "/proc/sys/net/ipv6/conf/zt0" ]; do
|
||||
sleep 0.25
|
||||
done
|
||||
|
||||
# Wait just a bit longer for stuff to settle
|
||||
sleep 5
|
||||
|
||||
exec node --harmony /agent.js >>agent.out 2>&1
|
||||
#exec node --harmony /agent.js
|
6
attic/big-http-test/nodesource-el.repo
Normal file
@ -0,0 +1,6 @@
|
||||
[nodesource]
|
||||
name=Node.js Packages for Enterprise Linux 7 - $basearch
|
||||
baseurl=https://rpm.nodesource.com/pub_4.x/el/7/$basearch
|
||||
failovermethod=priority
|
||||
enabled=1
|
||||
gpgcheck=0
|
16
attic/big-http-test/package.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "zerotier-test-http",
|
||||
"version": "1.0.0",
|
||||
"description": "ZeroTier in-network HTTP test",
|
||||
"main": "agent.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "ZeroTier, Inc.",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"async": "^1.5.0",
|
||||
"express": "^4.13.3",
|
||||
"ipaddr.js": "^1.0.3"
|
||||
}
|
||||
}
|
53
attic/big-http-test/server.js
Normal file
@ -0,0 +1,53 @@
|
||||
// ZeroTier distributed HTTP test coordinator and result-reporting server
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Customizable parameters:
|
||||
|
||||
var SERVER_PORT = 18080;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
var fs = require('fs');
|
||||
|
||||
var express = require('express');
|
||||
var app = express();
|
||||
|
||||
app.use(function(req,res,next) {
|
||||
req.rawBody = '';
|
||||
req.on('data', function(chunk) { req.rawBody += chunk.toString(); });
|
||||
req.on('end', function() { return next(); });
|
||||
});
|
||||
|
||||
var knownAgents = {};
|
||||
|
||||
app.post('/:agentId',function(req,res) {
|
||||
var agentId = req.params.agentId;
|
||||
if ((!agentId)||(agentId.length !== 32))
|
||||
return res.status(404).send('');
|
||||
|
||||
if (req.rawBody) {
|
||||
var receiveTime = Date.now();
|
||||
var resultData = null;
|
||||
try {
|
||||
resultData = JSON.parse(req.rawBody);
|
||||
console.log(Date.now().toString()+','+resultData.source+','+resultData.target+','+resultData.time+','+resultData.bytes+','+resultData.timedOut+',"'+((resultData.error) ? resultData.error : '')+'"');
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
knownAgents[agentId] = true;
|
||||
var thisUpdate = [];
|
||||
var agents = Object.keys(knownAgents);
|
||||
if (agents.length < 100)
|
||||
thisUpdate = agents;
|
||||
else {
|
||||
for(var xx=0;xx<100;++xx)
|
||||
thisUpdate.push(agents[Math.floor(Math.random() * agents.length)]);
|
||||
}
|
||||
|
||||
return res.status(200).send(JSON.stringify(thisUpdate));
|
||||
});
|
||||
|
||||
var expressServer = app.listen(SERVER_PORT,function () {
|
||||
console.log('LISTENING ON '+SERVER_PORT);
|
||||
console.log('');
|
||||
});
|
@ -1,32 +0,0 @@
|
||||
#!/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"
|
@ -1,32 +0,0 @@
|
||||
#!/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
@ -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,88 +0,0 @@
|
||||
CC=cc
|
||||
CXX=c++
|
||||
|
||||
INCLUDES=
|
||||
DEFS=
|
||||
LIBS=
|
||||
|
||||
include objects.mk
|
||||
OBJS+=
|
||||
TESTNET_OBJS=testnet/SimNet.o testnet/SimNetSocketManager.o testnet/TestEthernetTap.o testnet/TestEthernetTapFactory.o testnet/TestRoutingTable.o
|
||||
|
||||
# Enable SSE-optimized Salsa20 on x86 and x86_64 machines
|
||||
MACHINE=$(shell uname -m)
|
||||
ifeq ($(MACHINE),x86_64)
|
||||
DEFS+=-DZT_SALSA20_SSE
|
||||
endif
|
||||
ifeq ($(MACHINE),amd64)
|
||||
DEFS+=-DZT_SALSA20_SSE
|
||||
endif
|
||||
ifeq ($(MACHINE),i686)
|
||||
DEFS+=-DZT_SALSA20_SSE
|
||||
endif
|
||||
ifeq ($(MACHINE),i586)
|
||||
DEFS+=-DZT_SALSA20_SSE
|
||||
endif
|
||||
ifeq ($(MACHINE),i386)
|
||||
DEFS+=-DZT_SALSA20_SSE
|
||||
endif
|
||||
ifeq ($(MACHINE),x86)
|
||||
DEFS+=-DZT_SALSA20_SSE
|
||||
endif
|
||||
|
||||
# "make official" is a shortcut for this
|
||||
ifeq ($(ZT_OFFICIAL_RELEASE),1)
|
||||
ZT_AUTO_UPDATE=1
|
||||
DEFS+=-DZT_OFFICIAL_RELEASE
|
||||
endif
|
||||
ifeq ($(ZT_AUTO_UPDATE),1)
|
||||
DEFS+=-DZT_AUTO_UPDATE
|
||||
endif
|
||||
|
||||
# "make debug" is a shortcut for this
|
||||
ifeq ($(ZT_DEBUG),1)
|
||||
# DEFS+=-DZT_TRACE -DZT_LOG_STDOUT
|
||||
CFLAGS=-Wall -g -pthread $(INCLUDES) $(DEFS)
|
||||
LDFLAGS=
|
||||
STRIP=echo
|
||||
# The following line enables optimization for the crypto code, since
|
||||
# C25519 in particular is almost UNUSABLE in heavy testing without it.
|
||||
ext/lz4/lz4.o node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CFLAGS = -Wall -O2 -g -pthread $(INCLUDES) $(DEFS)
|
||||
else
|
||||
CFLAGS=-Wall -O3 -fPIE -fvisibility=hidden -fstack-protector -pthread $(INCLUDES) -DNDEBUG $(DEFS)
|
||||
LDFLAGS=-pie -Wl,-z,relro,-z,now
|
||||
STRIP=strip --strip-all
|
||||
endif
|
||||
|
||||
CXXFLAGS=$(CFLAGS) -fno-rtti
|
||||
|
||||
all: one
|
||||
|
||||
one: $(OBJS) main.o
|
||||
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o zerotier-one main.o $(OBJS) $(LIBS)
|
||||
$(STRIP) zerotier-one
|
||||
ln -sf zerotier-one zerotier-cli
|
||||
ln -sf zerotier-one zerotier-idtool
|
||||
|
||||
selftest: $(OBJS) selftest.o
|
||||
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o zerotier-selftest selftest.o $(OBJS) $(LIBS)
|
||||
$(STRIP) zerotier-selftest
|
||||
|
||||
testnet: $(TESTNET_OBJS) $(OBJS) testnet.o
|
||||
$(CXX) $(CXXFLAGS) -o zerotier-testnet testnet.o $(OBJS) $(TESTNET_OBJS) $(LIBS)
|
||||
$(STRIP) zerotier-testnet
|
||||
|
||||
installer: one FORCE
|
||||
./buildinstaller.sh
|
||||
|
||||
clean:
|
||||
rm -rf $(OBJS) $(TESTNET_OBJS) node/*.o osnet/*.o control/*.o testnet/*.o *.o zerotier-* build-* ZeroTierOneInstaller-*
|
||||
|
||||
debug: FORCE
|
||||
make -j 4 ZT_DEBUG=1
|
||||
|
||||
official: FORCE
|
||||
make -j 4 ZT_OFFICIAL_RELEASE=1
|
||||
./buildinstaller.sh
|
||||
|
||||
FORCE:
|
@ -41,7 +41,7 @@ case "$system" in
|
||||
machine="x64"
|
||||
debian_arch="amd64"
|
||||
;;
|
||||
armv6l|arm|armhf)
|
||||
armv6l|arm|armhf|arm7l|armv7l)
|
||||
machine="armv6l"
|
||||
debian_arch="armhf"
|
||||
;;
|
||||
@ -49,9 +49,12 @@ case "$system" in
|
||||
|
||||
echo "Assembling Linux installer for $machine and version $vmajor.$vminor.$revision"
|
||||
|
||||
mkdir -p 'build-installer/var/lib/zerotier-one'
|
||||
mkdir -p 'build-installer/var/lib/zerotier-one/ui'
|
||||
cp -fp 'ext/installfiles/linux/uninstall.sh' 'build-installer/var/lib/zerotier-one'
|
||||
cp -fp 'zerotier-one' 'build-installer/var/lib/zerotier-one'
|
||||
for f in ui/*.html ui/*.js ui/*.css ui/*.jsx ; do
|
||||
cp -fp "$f" 'build-installer/var/lib/zerotier-one/ui'
|
||||
done
|
||||
mkdir -p 'build-installer/tmp'
|
||||
cp -fp 'ext/installfiles/linux/init.d/zerotier-one' 'build-installer/tmp/init.d_zerotier-one'
|
||||
cp -fp 'ext/installfiles/linux/systemd/zerotier-one.service' 'build-installer/tmp/systemd_zerotier-one.service'
|
||||
@ -74,11 +77,11 @@ case "$system" in
|
||||
|
||||
rm -rf build-installer-deb
|
||||
|
||||
debbase="build-installer-deb/zerotier-one_${vmajor}.${vminor}.${revision}.autoupdating_$debian_arch"
|
||||
debbase="build-installer-deb/zerotier-one_${vmajor}.${vminor}.${revision}_$debian_arch"
|
||||
debfolder="${debbase}/DEBIAN"
|
||||
mkdir -p $debfolder
|
||||
|
||||
cat 'ext/installfiles/linux/DEBIAN/control.in' | sed "s/__VERSION__/${vmajor}.${vminor}.${revision}.autoupdating/" | sed "s/__ARCH__/${debian_arch}/" >$debfolder/control
|
||||
cat 'ext/installfiles/linux/DEBIAN/control.in' | sed "s/__VERSION__/${vmajor}.${vminor}.${revision}/" | sed "s/__ARCH__/${debian_arch}/" >$debfolder/control
|
||||
cat $debfolder/control
|
||||
cp -f 'ext/installfiles/linux/DEBIAN/conffiles' "${debfolder}/conffiles"
|
||||
|
||||
@ -88,14 +91,14 @@ case "$system" in
|
||||
rm -f "${debfolder}/postinst" "${debfolder}/prerm"
|
||||
|
||||
echo '#!/bin/bash' >${debfolder}/postinst
|
||||
echo "/var/lib/zerotier-one/updates.d/${targ}" >>${debfolder}/postinst
|
||||
echo "/var/lib/zerotier-one/updates.d/${targ} >>/dev/null 2>&1" >>${debfolder}/postinst
|
||||
echo "/bin/rm -f /var/lib/zerotier-one/updates.d/*" >>${debfolder}/postinst
|
||||
chmod a+x ${debfolder}/postinst
|
||||
|
||||
echo '#!/bin/bash' >${debfolder}/prerm
|
||||
echo 'export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin' >>${debfolder}/prerm
|
||||
echo 'if [ "$1" != "upgrade" ]; then' >>${debfolder}/prerm
|
||||
echo ' /var/lib/zerotier-one/uninstall.sh' >>${debfolder}/prerm
|
||||
echo ' /var/lib/zerotier-one/uninstall.sh >>/dev/null 2>&1' >>${debfolder}/prerm
|
||||
echo 'fi' >>${debfolder}/prerm
|
||||
chmod a+x ${debfolder}/prerm
|
||||
|
||||
@ -120,33 +123,6 @@ case "$system" in
|
||||
|
||||
;;
|
||||
|
||||
Darwin)
|
||||
echo "Assembling mac installer for x86/x64 (combined) version $vmajor.$vminor.$revision"
|
||||
|
||||
mkdir -p 'build-installer/Applications'
|
||||
cp -a 'build-ZeroTierUI-release/ZeroTier One.app' 'build-installer/Applications'
|
||||
mkdir -p 'build-installer/Library/Application Support/ZeroTier/One'
|
||||
cp -fp 'ext/installfiles/mac/uninstall.sh' 'build-installer/Library/Application Support/ZeroTier/One'
|
||||
cp -fp 'ext/installfiles/mac/launch.sh' 'build-installer/Library/Application Support/ZeroTier/One'
|
||||
cp -fp 'zerotier-one' 'build-installer/Library/Application Support/ZeroTier/One'
|
||||
cp -fRp ext/bin/tap-mac/* 'build-installer/Library/Application Support/ZeroTier/One'
|
||||
mkdir -p 'build-installer/Library/LaunchDaemons'
|
||||
cp -fp 'ext/installfiles/mac/com.zerotier.one.plist' 'build-installer/Library/LaunchDaemons'
|
||||
|
||||
targ="ZeroTierOneInstaller-mac-combined-${vmajor}_${vminor}_${revision}"
|
||||
rm -f build-installer-tmp.tar.bz2
|
||||
cd build-installer
|
||||
find . -type f -name .DS_Store -print0 | xargs -0 rm -f
|
||||
tar -cf - * | bzip2 -9 >../build-installer-tmp.tar.bz2
|
||||
cd ..
|
||||
rm -f $targ
|
||||
cat ext/installfiles/mac/install.tmpl.sh build-installer-tmp.tar.bz2 >$targ
|
||||
chmod 0755 $targ
|
||||
rm -f build-installer-tmp.tar.bz2
|
||||
ls -l $targ
|
||||
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unsupported platform: $system"
|
||||
exit 2
|
@ -6,28 +6,13 @@ shopt -s expand_aliases
|
||||
dryRun=0
|
||||
|
||||
echo "*** ZeroTier One install/update ***"
|
||||
echo
|
||||
|
||||
if [ "$UID" -ne 0 ]; then
|
||||
echo "Not running as root so doing dry run (no modifications to system)..."
|
||||
dryRun=1
|
||||
fi
|
||||
|
||||
# Detect systemd vs. regular init
|
||||
SYSTEMDUNITDIR=
|
||||
if [ -e /bin/systemctl -o -e /usr/bin/systemctl -o -e /usr/local/bin/systemctl -o -e /sbin/systemctl -o -e /usr/sbin/systemctl ]; then
|
||||
if [ -e /usr/bin/pkg-config ]; then
|
||||
SYSTEMDUNITDIR=`/usr/bin/pkg-config systemd --variable=systemdsystemunitdir`
|
||||
fi
|
||||
if [ -z "$SYSTEMDUNITDIR" -o ! -d "$SYSTEMDUNITDIR" ]; then
|
||||
if [ -d /usr/lib/systemd/system ]; then
|
||||
SYSTEMDUNITDIR=/usr/lib/systemd/system
|
||||
fi
|
||||
if [ -d /etc/systemd/system ]; then
|
||||
SYSTEMDUNITDIR=/etc/systemd/system
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $dryRun -gt 0 ]; then
|
||||
alias ln="echo '>> ln'"
|
||||
alias rm="echo '>> rm'"
|
||||
@ -51,6 +36,27 @@ if [ ! -r "$scriptPath" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check for systemd vs. old school SysV init
|
||||
SYSTEMDUNITDIR=
|
||||
if [ -e /bin/systemctl -o -e /usr/bin/systemctl -o -e /usr/local/bin/systemctl -o -e /sbin/systemctl -o -e /usr/sbin/systemctl ]; then
|
||||
# Second check: test if systemd appears to actually be running. Apparently Ubuntu
|
||||
# thought it was a good idea to ship with systemd installed but not used. Issue #133
|
||||
if [ -d /var/run/systemd/system -o -d /run/systemd/system ]; then
|
||||
if [ -e /usr/bin/pkg-config ]; then
|
||||
SYSTEMDUNITDIR=`/usr/bin/pkg-config systemd --variable=systemdsystemunitdir`
|
||||
fi
|
||||
if [ -z "$SYSTEMDUNITDIR" -o ! -d "$SYSTEMDUNITDIR" ]; then
|
||||
if [ -d /usr/lib/systemd/system ]; then
|
||||
SYSTEMDUNITDIR=/usr/lib/systemd/system
|
||||
fi
|
||||
if [ -d /etc/systemd/system ]; then
|
||||
SYSTEMDUNITDIR=/etc/systemd/system
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Find the end of this script, which is where we have appended binary data.
|
||||
endMarkerIndex=`grep -a -b -E '^################' "$scriptPath" | head -c 16 | cut -d : -f 1`
|
||||
if [ "$endMarkerIndex" -le 100 ]; then
|
||||
echo 'Internal error: unable to find end of script / start of binary data marker.'
|
||||
@ -86,7 +92,7 @@ echo -n 'Getting version of new install... '
|
||||
newVersion=`/var/lib/zerotier-one/zerotier-one -v`
|
||||
echo $newVersion
|
||||
|
||||
echo 'Installing zerotier-cli command line utility...'
|
||||
echo 'Creating symlinks...'
|
||||
|
||||
rm -f /usr/bin/zerotier-cli /usr/bin/zerotier-idtool
|
||||
ln -sf /var/lib/zerotier-one/zerotier-one /usr/bin/zerotier-cli
|
||||
@ -94,10 +100,9 @@ ln -sf /var/lib/zerotier-one/zerotier-one /usr/bin/zerotier-idtool
|
||||
|
||||
echo 'Installing zerotier-one service...'
|
||||
|
||||
# Note: ensure that service restarts are the last thing this script actually
|
||||
# does, since these may kill the script itself. Also note the & to allow
|
||||
# them to finish independently.
|
||||
if [ -n "$SYSTEMDUNITDIR" -a -d "$SYSTEMDUNITDIR" ]; then
|
||||
# SYSTEMD
|
||||
|
||||
# If this was updated or upgraded from an init.d based system, clean up the old
|
||||
# init.d stuff before installing directly via systemd.
|
||||
if [ -f /etc/init.d/zerotier-one ]; then
|
||||
@ -110,15 +115,19 @@ if [ -n "$SYSTEMDUNITDIR" -a -d "$SYSTEMDUNITDIR" ]; then
|
||||
cp -f /tmp/systemd_zerotier-one.service "$SYSTEMDUNITDIR/zerotier-one.service"
|
||||
chown 0 "$SYSTEMDUNITDIR/zerotier-one.service"
|
||||
chgrp 0 "$SYSTEMDUNITDIR/zerotier-one.service"
|
||||
chmod 0755 "$SYSTEMDUNITDIR/zerotier-one.service"
|
||||
chmod 0644 "$SYSTEMDUNITDIR/zerotier-one.service"
|
||||
rm -f /tmp/systemd_zerotier-one.service /tmp/init.d_zerotier-one
|
||||
|
||||
systemctl enable zerotier-one.service
|
||||
if [ "$origVersion" != "$newVersion" ]; then
|
||||
echo 'Version has changed, starting...'
|
||||
systemctl restart zerotier-one.service &
|
||||
fi
|
||||
|
||||
echo
|
||||
echo 'Done! Installed and service configured to start at system boot.'
|
||||
echo
|
||||
echo "To start now or restart the service if it's already running:"
|
||||
echo ' sudo systemctl restart zerotier-one.service'
|
||||
else
|
||||
# SYSV INIT -- also covers upstart which supports SysVinit backward compatibility
|
||||
|
||||
cp -f /tmp/init.d_zerotier-one /etc/init.d/zerotier-one
|
||||
chmod 0755 /etc/init.d/zerotier-one
|
||||
rm -f /tmp/systemd_zerotier-one.service /tmp/init.d_zerotier-one
|
||||
@ -126,6 +135,7 @@ else
|
||||
if [ -f /sbin/chkconfig -o -f /usr/sbin/chkconfig -o -f /usr/bin/chkconfig -o -f /bin/chkconfig ]; then
|
||||
chkconfig zerotier-one on
|
||||
else
|
||||
# Yes Virginia, some systems lack chkconfig.
|
||||
if [ -d /etc/rc0.d ]; then
|
||||
rm -f /etc/rc0.d/???zerotier-one
|
||||
ln -sf /etc/init.d/zerotier-one /etc/rc0.d/K89zerotier-one
|
||||
@ -156,18 +166,13 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$origVersion" != "$newVersion" ]; then
|
||||
echo 'Version has changed, starting...'
|
||||
if [ -f /sbin/service -o -f /usr/sbin/service ]; then
|
||||
service zerotier-one restart &
|
||||
else
|
||||
/etc/init.d/zerotier-one restart &
|
||||
fi
|
||||
fi
|
||||
echo
|
||||
echo 'Done! Installed and service configured to start at system boot.'
|
||||
echo
|
||||
echo "To start now or restart the service if it's already running:"
|
||||
echo ' sudo service zerotier-one restart'
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
|
||||
exit 0
|
||||
|
||||
# Do not remove the last line or add a carriage return to it! The installer
|
@ -59,7 +59,7 @@ fi
|
||||
echo "Erasing binary and support files..."
|
||||
if [ -d /var/lib/zerotier-one ]; then
|
||||
cd /var/lib/zerotier-one
|
||||
rm -rf zerotier-one *.persist identity.public *.log *.pid *.sh updates.d networks.d iddb.d root-topology
|
||||
rm -rf zerotier-one *.persist identity.public *.log *.pid *.sh updates.d networks.d iddb.d root-topology ui
|
||||
fi
|
||||
|
||||
echo "Erasing anything installed into system bin directories..."
|
6
cli/README.md
Normal file
@ -0,0 +1,6 @@
|
||||
ZeroTier Newer-Spiffier Command Line Interface
|
||||
======
|
||||
|
||||
This will be the future home of our new unified CLI for ZeroTier One, controllers, and Central (my.zerotier.com etc.).
|
||||
|
||||
IT IS NOT DONE AND DOES NOT WORK EVEN A LITTLE BIT. GO AWAY.
|
335
cli/zerotier.cpp
Normal file
@ -0,0 +1,335 @@
|
||||
/*
|
||||
* ZeroTier One - Network Virtualization Everywhere
|
||||
* Copyright (C) 2011-2016 ZeroTier, Inc. https://www.zerotier.com/
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
// Note: unlike the rest of ZT's code base, this requires C++11 due to
|
||||
// the JSON library it uses and other things.
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../node/Constants.hpp"
|
||||
#include "../version.h"
|
||||
#include "../osdep/OSUtils.hpp"
|
||||
#include "../ext/json/json.hpp"
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#include <WinSock2.h>
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
#include <wchar.h>
|
||||
#else
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <tuple>
|
||||
|
||||
#include <curl/curl.h>
|
||||
|
||||
using json = nlohmann::json;
|
||||
using namespace ZeroTier;
|
||||
|
||||
#define ZT_CLI_FLAG_VERBOSE 'v'
|
||||
#define ZT_CLI_FLAG_UNSAFE_SSL 'X'
|
||||
|
||||
struct CLIState
|
||||
{
|
||||
std::string atname;
|
||||
std::string command;
|
||||
std::vector<std::string> args;
|
||||
std::map<char,std::string> opts;
|
||||
json settings;
|
||||
};
|
||||
|
||||
namespace {
|
||||
|
||||
static std::string trimString(const std::string &s)
|
||||
{
|
||||
unsigned long end = (unsigned long)s.length();
|
||||
while (end) {
|
||||
char c = s[end - 1];
|
||||
if ((c == ' ')||(c == '\r')||(c == '\n')||(!c)||(c == '\t'))
|
||||
--end;
|
||||
else break;
|
||||
}
|
||||
unsigned long start = 0;
|
||||
while (start < end) {
|
||||
char c = s[start];
|
||||
if ((c == ' ')||(c == '\r')||(c == '\n')||(!c)||(c == '\t'))
|
||||
++start;
|
||||
else break;
|
||||
}
|
||||
return s.substr(start,end - start);
|
||||
}
|
||||
|
||||
static inline std::string getSettingsFilePath()
|
||||
{
|
||||
#ifdef __WINDOWS__
|
||||
#else
|
||||
const char *home = getenv("HOME");
|
||||
if (!home)
|
||||
home = "/";
|
||||
return (std::string(home) + "/.zerotierCliSettings");
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool saveSettings(const json &settings)
|
||||
{
|
||||
std::string sfp(getSettingsFilePath().c_str());
|
||||
std::string buf(settings.dump(2));
|
||||
if (OSUtils::writeFile(sfp.c_str(),buf)) {
|
||||
OSUtils::lockDownFile(sfp.c_str(),false);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void dumpHelp()
|
||||
{
|
||||
std::cout << "ZeroTier Newer-Spiffier CLI " << ZEROTIER_ONE_VERSION_MAJOR << "." << ZEROTIER_ONE_VERSION_MINOR << "." << ZEROTIER_ONE_VERSION_REVISION << std::endl;
|
||||
std::cout << "(c)2016 ZeroTier, Inc. / Licensed under the GNU GPL v3" << std::endl;
|
||||
std::cout << std::endl;
|
||||
std::cout << "Configuration path: " << getSettingsFilePath() << std::endl;
|
||||
std::cout << std::endl;
|
||||
std::cout << "Usage: zerotier [-option] [@name] <command> [<command options>]" << std::endl;
|
||||
std::cout << std::endl;
|
||||
std::cout << "Options:" << std::endl;
|
||||
std::cout << " -v - Verbose JSON output" << std::endl;
|
||||
std::cout << " -X - Do not check SSL certs (CAUTION!)" << std::endl;
|
||||
std::cout << std::endl;
|
||||
std::cout << "CLI Configuration Commands:" << std::endl;
|
||||
std::cout << " cli-set <setting> <value> - Set a CLI option ('cli-set help')" << std::endl;
|
||||
std::cout << " cli-ls - List configured @things" << std::endl;
|
||||
std::cout << " cli-rm @name - Remove a configured @thing" << std::endl;
|
||||
std::cout << " cli-add-zt @name <url> <auth> - Add a ZeroTier service" << std::endl;
|
||||
std::cout << " cli-add-central @name <url> <auth> - Add ZeroTier Central instance" << std::endl;
|
||||
std::cout << std::endl;
|
||||
std::cout << "ZeroTier One Service Commands:" << std::endl;
|
||||
std::cout << " ls - List currently joined networks" << std::endl;
|
||||
std::cout << " join <network> [opt=value ...] - Join a network" << std::endl;
|
||||
std::cout << " leave <network> - Leave a network" << std::endl;
|
||||
std::cout << " peers - List ZeroTier VL1 peers" << std::endl;
|
||||
std::cout << " show [<network/peer address>] - Get info about self or object" << std::endl;
|
||||
std::cout << std::endl;
|
||||
std::cout << "Network Controller Commands:" << std::endl;
|
||||
std::cout << " net-create - Create a new network" << std::endl;
|
||||
std::cout << " net-rm <network> - Delete a network (CAUTION!)" << std::endl;
|
||||
std::cout << " net-ls - List administered networks" << std::endl;
|
||||
std::cout << " net-members <network> - List members of a network" << std::endl;
|
||||
std::cout << " net-show <network> [<address>] - Get network or member info" << std::endl;
|
||||
std::cout << " net-auth <network> <address> - Authorize a member" << std::endl;
|
||||
std::cout << " net-set <path> <value> - See 'net-set help'" << std::endl;
|
||||
std::cout << std::endl;
|
||||
std::cout << "Identity Commands:" << std::endl;
|
||||
std::cout << " id-generate [<vanity prefix>] - Generate a ZeroTier identity" << std::endl;
|
||||
std::cout << " id-validate <identity> - Locally validate an identity" << std::endl;
|
||||
std::cout << " id-sign <identity> <file> - Sign a file" << std::endl;
|
||||
std::cout << " id-verify <secret> <file> <sig> - Verify a file's signature" << std::endl;
|
||||
std::cout << " id-getpublic <secret> - Get full identity's public portion" << std::endl;
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
static size_t _curlStringAppendCallback(void *contents,size_t size,size_t nmemb,void *stdstring)
|
||||
{
|
||||
size_t totalSize = size * nmemb;
|
||||
reinterpret_cast<std::string *>(stdstring)->append((const char *)contents,totalSize);
|
||||
return totalSize;
|
||||
}
|
||||
|
||||
static std::tuple<int,std::string> GET(const CLIState &state,const std::map<std::string,std::string> &headers,const std::string &url)
|
||||
{
|
||||
std::string body;
|
||||
char errbuf[CURL_ERROR_SIZE];
|
||||
char urlbuf[4096];
|
||||
|
||||
CURL *curl = curl_easy_init();
|
||||
if (!curl) {
|
||||
std::cerr << "FATAL: curl_easy_init() failed" << std::endl;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,_curlStringAppendCallback);
|
||||
curl_easy_setopt(curl,CURLOPT_WRITEDATA,(void *)&body);
|
||||
curl_easy_setopt(curl,CURLOPT_USERAGENT,"ZeroTier-CLI");
|
||||
curl_easy_setopt(curl,CURLOPT_SSL_VERIFYPEER,(state.opts.count(ZT_CLI_FLAG_UNSAFE_SSL) > 0) ? 0L : 1L);
|
||||
curl_easy_setopt(curl,CURLOPT_ERRORBUFFER,errbuf);
|
||||
curl_easy_setopt(curl,CURLOPT_FOLLOWLOCATION,0L);
|
||||
|
||||
Utils::scopy(urlbuf,sizeof(urlbuf),url.c_str());
|
||||
curl_easy_setopt(curl,CURLOPT_URL,urlbuf);
|
||||
|
||||
struct curl_slist *hdrs = (struct curl_slist *)0;
|
||||
for(std::map<std::string,std::string>::const_iterator i(headers.begin());i!=headers.end();++i) {
|
||||
std::string htmp(i->first);
|
||||
htmp.append(": ");
|
||||
htmp.append(i->second);
|
||||
hdrs = curl_slist_append(hdrs,htmp.c_str());
|
||||
}
|
||||
if (hdrs)
|
||||
curl_easy_setopt(curl,CURLOPT_HTTPHEADER,hdrs);
|
||||
|
||||
memset(errbuf,0,sizeof(errbuf));
|
||||
CURLcode res = curl_easy_perform(curl);
|
||||
errbuf[CURL_ERROR_SIZE-1] = (char)0; // sanity check
|
||||
|
||||
if (res != CURLE_OK)
|
||||
return std::make_tuple(-1,std::string(errbuf));
|
||||
|
||||
int rc = (int)curl_easy_getinfo(curl,CURLINFO_RESPONSE_CODE);
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
if (hdrs)
|
||||
curl_slist_free_all(hdrs);
|
||||
|
||||
return std::make_tuple(rc,body);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
#else
|
||||
int main(int argc,char **argv)
|
||||
#endif
|
||||
{
|
||||
#ifdef __WINDOWS__
|
||||
{
|
||||
WSADATA wsaData;
|
||||
WSAStartup(MAKEWORD(2,2),&wsaData);
|
||||
}
|
||||
#endif
|
||||
|
||||
curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||
|
||||
CLIState state;
|
||||
|
||||
for(int i=1;i<argc;++i) {
|
||||
if ((i == 1)&&(argv[i][0] == '@')) {
|
||||
state.atname = argv[i];
|
||||
} else if (state.command.length() == 0) {
|
||||
if (argv[i][0] == '-') {
|
||||
if (!argv[i][1]) {
|
||||
dumpHelp();
|
||||
return -1;
|
||||
} else if (argv[i][2]) {
|
||||
state.opts[argv[i][1]] = argv[i] + 2;
|
||||
} else {
|
||||
state.opts[argv[i][1]] = "";
|
||||
}
|
||||
} else {
|
||||
state.command = argv[i];
|
||||
}
|
||||
} else {
|
||||
state.args.push_back(std::string(argv[i]));
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
std::string buf;
|
||||
if (OSUtils::readFile(getSettingsFilePath().c_str(),buf))
|
||||
state.settings = json::parse(buf);
|
||||
|
||||
if (state.settings.empty()) {
|
||||
// Default settings
|
||||
state.settings = {
|
||||
{ "configVersion", 1 },
|
||||
{ "things", {
|
||||
{ "my.zerotier.com", {
|
||||
{ "type", "central" },
|
||||
{ "url", "https://my.zerotier.com/" },
|
||||
{ "auth", "" }
|
||||
}},
|
||||
{ "local", {
|
||||
{ "type", "one" },
|
||||
{ "url", "" },
|
||||
{ "auth", "" }
|
||||
}}
|
||||
}},
|
||||
{ "defaultController", "@my.zerotier.com" },
|
||||
{ "defaultOne", "@local" }
|
||||
};
|
||||
|
||||
std::string oneHome(OSUtils::platformDefaultHomePath());
|
||||
std::string authToken,portStr;
|
||||
bool initSuccess = false;
|
||||
if (OSUtils::readFile((oneHome + ZT_PATH_SEPARATOR_S + "authtoken.secret").c_str(),authToken)&&OSUtils::readFile((oneHome + ZT_PATH_SEPARATOR_S + "zerotier-one.port").c_str(),portStr)) {
|
||||
portStr = trimString(portStr);
|
||||
authToken = trimString(authToken);
|
||||
int port = Utils::strToInt(portStr.c_str());
|
||||
if (((port > 0)&&(port < 65536))&&(authToken.length() > 0)) {
|
||||
state.settings["things"]["local"]["url"] = (std::string("http://127.0.0.1:") + portStr + "/");
|
||||
state.settings["things"]["local"]["auth"] = authToken;
|
||||
initSuccess = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!saveSettings(state.settings)) {
|
||||
std::cerr << "FATAL: unable to write " << getSettingsFilePath() << std::endl;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (initSuccess) {
|
||||
std::cerr << "INFO: initialized new config at " << getSettingsFilePath() << std::endl;
|
||||
} else {
|
||||
std::cerr << "INFO: initialized new config at " << getSettingsFilePath() << " but could not auto-init local ZeroTier One service config from " << oneHome << " -- you will need to set local service URL and port manually if you want to control a local instance of ZeroTier One. (This happens if you are not root/administrator.)" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((state.command.length() == 0)||(state.command == "help")) {
|
||||
dumpHelp();
|
||||
return -1;
|
||||
} else if (state.command == "cli-set") {
|
||||
} else if (state.command == "cli-ls") {
|
||||
} else if (state.command == "cli-rm") {
|
||||
} else if (state.command == "cli-add-zt") {
|
||||
} else if (state.command == "cli-add-central") {
|
||||
} else if (state.command == "ls") {
|
||||
} else if (state.command == "join") {
|
||||
} else if (state.command == "leave") {
|
||||
} else if (state.command == "peers") {
|
||||
} else if (state.command == "show") {
|
||||
} else if (state.command == "net-create") {
|
||||
} else if (state.command == "net-rm") {
|
||||
} else if (state.command == "net-ls") {
|
||||
} else if (state.command == "net-members") {
|
||||
} else if (state.command == "net-show") {
|
||||
} else if (state.command == "net-auth") {
|
||||
} else if (state.command == "net-set") {
|
||||
} else if (state.command == "id-generate") {
|
||||
} else if (state.command == "id-validate") {
|
||||
} else if (state.command == "id-sign") {
|
||||
} else if (state.command == "id-verify") {
|
||||
} else if (state.command == "id-getpublic") {
|
||||
} else {
|
||||
dumpHelp();
|
||||
return -1;
|
||||
}
|
||||
|
||||
curl_global_cleanup();
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,281 +0,0 @@
|
||||
/*
|
||||
* ZeroTier One - Global Peer to Peer Ethernet
|
||||
* Copyright (C) 2011-2014 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/
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include "IpcConnection.hpp"
|
||||
|
||||
#ifndef __WINDOWS__
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
IpcConnection::IpcConnection(const char *endpoint,unsigned int timeout,void (*commandHandler)(void *,IpcConnection *,IpcConnection::EventType,const char *),void *arg) :
|
||||
_handler(commandHandler),
|
||||
_arg(arg),
|
||||
_timeout(timeout),
|
||||
#ifdef __WINDOWS__
|
||||
_sock(INVALID_HANDLE_VALUE),
|
||||
_incoming(false),
|
||||
#else
|
||||
_sock(-1),
|
||||
#endif
|
||||
_run(true),
|
||||
_running(true)
|
||||
{
|
||||
#ifdef __WINDOWS__
|
||||
_sock = CreateFileA(endpoint,GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,NULL,OPEN_EXISTING,0,NULL);
|
||||
if (_sock == INVALID_HANDLE_VALUE)
|
||||
throw std::runtime_error("IPC endpoint unreachable");
|
||||
DWORD pipeMode = PIPE_READMODE_BYTE;
|
||||
SetNamedPipeHandleState(_sock,&pipeMode,NULL,NULL);
|
||||
#else
|
||||
struct sockaddr_un unaddr;
|
||||
unaddr.sun_family = AF_UNIX;
|
||||
strncpy(unaddr.sun_path,endpoint,sizeof(unaddr.sun_path));
|
||||
unaddr.sun_path[sizeof(unaddr.sun_path) - 1] = (char)0;
|
||||
|
||||
_sock = socket(AF_UNIX,SOCK_STREAM,0);
|
||||
if (_sock <= 0)
|
||||
throw std::runtime_error("unable to create socket of type AF_UNIX");
|
||||
|
||||
if (connect(_sock,(struct sockaddr *)&unaddr,sizeof(unaddr))) {
|
||||
::close(_sock);
|
||||
throw std::runtime_error("IPC endpoint unreachable");
|
||||
}
|
||||
#endif
|
||||
|
||||
_thread = Thread::start(this);
|
||||
}
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
IpcConnection::IpcConnection(HANDLE s,unsigned int timeout,void (*commandHandler)(void *,IpcConnection *,IpcConnection::EventType,const char *),void *arg) :
|
||||
#else
|
||||
IpcConnection::IpcConnection(int s,unsigned int timeout,void (*commandHandler)(void *,IpcConnection *,IpcConnection::EventType,const char *),void *arg) :
|
||||
#endif
|
||||
_handler(commandHandler),
|
||||
_arg(arg),
|
||||
_timeout(timeout),
|
||||
_sock(s),
|
||||
#ifdef __WINDOWS__
|
||||
_incoming(true),
|
||||
#endif
|
||||
_run(true),
|
||||
_running(true)
|
||||
{
|
||||
_thread = Thread::start(this);
|
||||
}
|
||||
|
||||
IpcConnection::~IpcConnection()
|
||||
{
|
||||
_writeLock.lock();
|
||||
_run = false;
|
||||
_writeLock.unlock();
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
|
||||
while (_running) {
|
||||
Thread::cancelIO(_thread); // cause Windows to break from blocking read and detect shutdown
|
||||
Sleep(100);
|
||||
}
|
||||
|
||||
#else // !__WINDOWS__
|
||||
|
||||
int s = _sock;
|
||||
_sock = 0;
|
||||
if (s > 0) {
|
||||
::shutdown(s,SHUT_RDWR);
|
||||
::close(s);
|
||||
}
|
||||
Thread::join(_thread);
|
||||
|
||||
#endif // __WINDOWS__ / !__WINDOWS__
|
||||
}
|
||||
|
||||
void IpcConnection::printf(const char *format,...)
|
||||
{
|
||||
va_list ap;
|
||||
int n;
|
||||
char tmp[65536];
|
||||
|
||||
va_start(ap,format);
|
||||
n = (int)::vsnprintf(tmp,sizeof(tmp),format,ap);
|
||||
va_end(ap);
|
||||
if (n <= 0)
|
||||
return;
|
||||
|
||||
Mutex::Lock _l(_writeLock);
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
_writeBuf.append(tmp,n);
|
||||
Thread::cancelIO(_thread); // cause Windows to break from blocking read and service write buffer
|
||||
#else
|
||||
if (_sock > 0)
|
||||
::write(_sock,tmp,n);
|
||||
#endif
|
||||
}
|
||||
|
||||
void IpcConnection::threadMain()
|
||||
throw()
|
||||
{
|
||||
char tmp[16384];
|
||||
char linebuf[16384];
|
||||
unsigned int lineptr = 0;
|
||||
char c;
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
|
||||
DWORD n,i;
|
||||
std::string wbuf;
|
||||
|
||||
#else // !__WINDOWS__
|
||||
|
||||
int s,n,i;
|
||||
fd_set readfds,writefds,errorfds;
|
||||
struct timeval tout;
|
||||
|
||||
#ifdef SO_NOSIGPIPE
|
||||
if (_sock > 0) {
|
||||
i = 1;
|
||||
::setsockopt(_sock,SOL_SOCKET,SO_NOSIGPIPE,(char *)&i,sizeof(i));
|
||||
}
|
||||
#endif // SO_NOSIGPIPE
|
||||
|
||||
#endif // __WINDOWS__ / !__WINDOWS__
|
||||
|
||||
while (_run) {
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
|
||||
/* Note that we do not use fucking timeouts in Windows, since it does seem
|
||||
* to properly detect named pipe endpoint close. But we do use a write buffer
|
||||
* because Windows won't let you divorce reading and writing threads without
|
||||
* all that OVERLAPPED cruft. */
|
||||
{
|
||||
Mutex::Lock _l(_writeLock);
|
||||
if (!_run)
|
||||
break;
|
||||
if (_writeBuf.length() > 0) {
|
||||
wbuf.append(_writeBuf);
|
||||
_writeBuf.clear();
|
||||
}
|
||||
}
|
||||
if (wbuf.length() > 0) {
|
||||
n = 0;
|
||||
if ((WriteFile(_sock,wbuf.data(),(DWORD)(wbuf.length()),&n,NULL))&&(n > 0)) {
|
||||
if (n < (DWORD)wbuf.length())
|
||||
wbuf.erase(0,n);
|
||||
else wbuf.clear();
|
||||
} else if (GetLastError() != ERROR_OPERATION_ABORTED)
|
||||
break;
|
||||
FlushFileBuffers(_sock);
|
||||
}
|
||||
if (!_run)
|
||||
break;
|
||||
n = 0;
|
||||
if ((!ReadFile(_sock,tmp,sizeof(tmp),&n,NULL))||(n <= 0)) {
|
||||
if (GetLastError() == ERROR_OPERATION_ABORTED)
|
||||
n = 0;
|
||||
else break;
|
||||
}
|
||||
if (!_run)
|
||||
break;
|
||||
|
||||
#else // !__WINDOWS__
|
||||
|
||||
/* So today I learned that there is no reliable way to detect a half-closed
|
||||
* Unix domain socket. So to make sure we don't leave orphaned sockets around
|
||||
* we just use fucking timeouts. If a socket fucking times out, we break from
|
||||
* the I/O loop and terminate the thread. But this IpcConnection code is ugly
|
||||
* so maybe the OS is simply offended by it and refuses to reveal its mysteries
|
||||
* to me. Oh well... this IPC code will probably get canned when we go to
|
||||
* local HTTP RESTful interfaces or soemthing like that. */
|
||||
if ((s = _sock) <= 0)
|
||||
break;
|
||||
FD_ZERO(&readfds);
|
||||
FD_ZERO(&writefds);
|
||||
FD_ZERO(&errorfds);
|
||||
FD_SET(s,&readfds);
|
||||
FD_SET(s,&errorfds);
|
||||
tout.tv_sec = _timeout; // use a fucking timeout
|
||||
tout.tv_usec = 0;
|
||||
if (select(s+1,&readfds,&writefds,&errorfds,&tout) <= 0) {
|
||||
break; // socket has fucking timed out
|
||||
} else {
|
||||
if (FD_ISSET(s,&errorfds))
|
||||
break; // socket has an exception... sometimes works
|
||||
else {
|
||||
n = (int)::read(s,tmp,sizeof(tmp));
|
||||
if ((n <= 0)||(_sock <= 0))
|
||||
break; // read returned error... sometimes works
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __WINDOWS__ / !__WINDOWS__
|
||||
|
||||
for(i=0;i<n;++i) {
|
||||
c = (linebuf[lineptr] = tmp[i]);
|
||||
if ((c == '\r')||(c == '\n')||(c == (char)0)||(lineptr == (sizeof(linebuf) - 1))) {
|
||||
if (lineptr) {
|
||||
linebuf[lineptr] = (char)0;
|
||||
_handler(_arg,this,IPC_EVENT_COMMAND,linebuf);
|
||||
lineptr = 0;
|
||||
}
|
||||
} else ++lineptr;
|
||||
}
|
||||
}
|
||||
|
||||
_writeLock.lock();
|
||||
bool r = _run;
|
||||
_writeLock.unlock();
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
|
||||
if (_incoming)
|
||||
DisconnectNamedPipe(_sock);
|
||||
CloseHandle(_sock);
|
||||
_running = false;
|
||||
|
||||
#endif // __WINDOWS__
|
||||
|
||||
if (r)
|
||||
_handler(_arg,this,IPC_EVENT_CONNECTION_CLOSED,(const char *)0);
|
||||
}
|
||||
|
||||
} // namespace ZeroTier
|
@ -1,107 +0,0 @@
|
||||
/*
|
||||
* ZeroTier One - Global Peer to Peer Ethernet
|
||||
* Copyright (C) 2011-2014 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_IPCCONNECTION_HPP
|
||||
#define ZT_IPCCONNECTION_HPP
|
||||
|
||||
#include "../node/Constants.hpp"
|
||||
#include "../node/Thread.hpp"
|
||||
#include "../node/NonCopyable.hpp"
|
||||
#include "../node/Mutex.hpp"
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#include <WinSock2.h>
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
class IpcListener;
|
||||
|
||||
/**
|
||||
* Interprocess communication connection
|
||||
*/
|
||||
class IpcConnection : NonCopyable
|
||||
{
|
||||
friend class IpcListener;
|
||||
|
||||
public:
|
||||
enum EventType
|
||||
{
|
||||
IPC_EVENT_COMMAND,
|
||||
IPC_EVENT_NEW_CONNECTION,
|
||||
IPC_EVENT_CONNECTION_CLOSED
|
||||
};
|
||||
|
||||
/**
|
||||
* Connect to an IPC endpoint
|
||||
*
|
||||
* @param endpoint Endpoint path
|
||||
* @param timeout Inactivity timeout in seconds
|
||||
* @param commandHandler Command handler function
|
||||
* @param arg First argument to command handler
|
||||
* @throws std::runtime_error Unable to connect
|
||||
*/
|
||||
IpcConnection(const char *endpoint,unsigned int timeout,void (*commandHandler)(void *,IpcConnection *,IpcConnection::EventType,const char *),void *arg);
|
||||
~IpcConnection();
|
||||
|
||||
/**
|
||||
* @param format Printf format string
|
||||
* @param ... Printf arguments
|
||||
*/
|
||||
void printf(const char *format,...);
|
||||
|
||||
void threadMain()
|
||||
throw();
|
||||
|
||||
private:
|
||||
// Used by IpcListener to construct incoming connections
|
||||
#ifdef __WINDOWS__
|
||||
IpcConnection(HANDLE s,unsigned int timeout,void (*commandHandler)(void *,IpcConnection *,IpcConnection::EventType,const char *),void *arg);
|
||||
#else
|
||||
IpcConnection(int s,unsigned int timeout,void (*commandHandler)(void *,IpcConnection *,IpcConnection::EventType,const char *),void *arg);
|
||||
#endif
|
||||
|
||||
void (*_handler)(void *,IpcConnection *,IpcConnection::EventType,const char *);
|
||||
void *_arg;
|
||||
unsigned int _timeout;
|
||||
#ifdef __WINDOWS__
|
||||
HANDLE _sock;
|
||||
std::string _writeBuf;
|
||||
bool _incoming;
|
||||
#else
|
||||
volatile int _sock;
|
||||
#endif
|
||||
Mutex _writeLock;
|
||||
Thread _thread;
|
||||
volatile bool _run;
|
||||
volatile bool _running;
|
||||
};
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
||||
#endif
|
@ -1,165 +0,0 @@
|
||||
/*
|
||||
* ZeroTier One - Global Peer to Peer Ethernet
|
||||
* Copyright (C) 2011-2014 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/
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "IpcListener.hpp"
|
||||
|
||||
#ifndef __WINDOWS__
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
IpcListener::IpcListener(const char *ep,unsigned int timeout,void (*commandHandler)(void *,IpcConnection *,IpcConnection::EventType,const char *),void *arg) :
|
||||
_endpoint(ep),
|
||||
_handler(commandHandler),
|
||||
_arg(arg),
|
||||
_timeout(timeout),
|
||||
#ifdef __WINDOWS__
|
||||
_run(true),
|
||||
_running(true)
|
||||
#else
|
||||
_sock(0)
|
||||
#endif
|
||||
{
|
||||
#ifndef __WINDOWS__
|
||||
struct sockaddr_un unaddr;
|
||||
unaddr.sun_family = AF_UNIX;
|
||||
strncpy(unaddr.sun_path,_endpoint.c_str(),sizeof(unaddr.sun_path));
|
||||
unaddr.sun_path[sizeof(unaddr.sun_path) - 1] = (char)0;
|
||||
|
||||
struct stat stattmp;
|
||||
if (stat(_endpoint.c_str(),&stattmp)) {
|
||||
int testSock = socket(AF_UNIX,SOCK_STREAM,0);
|
||||
if (testSock <= 0)
|
||||
throw std::runtime_error("unable to create socket of type AF_UNIX");
|
||||
if (connect(testSock,(struct sockaddr *)&unaddr,sizeof(unaddr))) {
|
||||
// error means nothing is listening, orphaned name
|
||||
::close(testSock);
|
||||
} else {
|
||||
// success means endpoint is being actively listened to by a process
|
||||
::close(testSock);
|
||||
throw std::runtime_error("IPC endpoint address in use");
|
||||
}
|
||||
}
|
||||
::unlink(_endpoint.c_str());
|
||||
|
||||
_sock = socket(AF_UNIX,SOCK_STREAM,0);
|
||||
if (_sock <= 0)
|
||||
throw std::runtime_error("unable to create socket of type AF_UNIX");
|
||||
if (bind(_sock,(struct sockaddr *)&unaddr,sizeof(unaddr))) {
|
||||
::close(_sock);
|
||||
throw std::runtime_error("IPC endpoint could not be bound");
|
||||
}
|
||||
if (listen(_sock,8)) {
|
||||
::close(_sock);
|
||||
throw std::runtime_error("listen() failed for bound AF_UNIX socket");
|
||||
}
|
||||
::chmod(_endpoint.c_str(),0777);
|
||||
#endif
|
||||
|
||||
_thread = Thread::start(this);
|
||||
}
|
||||
|
||||
IpcListener::~IpcListener()
|
||||
{
|
||||
#ifdef __WINDOWS__
|
||||
_run = false;
|
||||
while (_running) {
|
||||
Thread::cancelIO(_thread);
|
||||
HANDLE tmp = CreateFileA(_endpoint.c_str(),GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,NULL,OPEN_EXISTING,0,NULL);
|
||||
if (tmp != INVALID_HANDLE_VALUE)
|
||||
CloseHandle(tmp);
|
||||
Sleep(250);
|
||||
}
|
||||
#else
|
||||
int s = _sock;
|
||||
_sock = 0;
|
||||
if (s > 0) {
|
||||
::shutdown(s,SHUT_RDWR);
|
||||
::close(s);
|
||||
}
|
||||
Thread::join(_thread);
|
||||
::unlink(_endpoint.c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
void IpcListener::threadMain()
|
||||
throw()
|
||||
{
|
||||
#ifdef __WINDOWS__
|
||||
HANDLE s;
|
||||
while (_run) {
|
||||
s = CreateNamedPipeA(_endpoint.c_str(),PIPE_ACCESS_DUPLEX,PIPE_READMODE_BYTE|PIPE_TYPE_BYTE|PIPE_WAIT,PIPE_UNLIMITED_INSTANCES,1024,1024,0,NULL);
|
||||
if (s != INVALID_HANDLE_VALUE) {
|
||||
if ((ConnectNamedPipe(s,NULL))||(GetLastError() == ERROR_PIPE_CONNECTED)) {
|
||||
if (!_run) {
|
||||
DisconnectNamedPipe(s);
|
||||
CloseHandle(s);
|
||||
break;
|
||||
}
|
||||
try {
|
||||
_handler(_arg,new IpcConnection(s,_timeout,_handler,_arg),IpcConnection::IPC_EVENT_NEW_CONNECTION,(const char *)0);
|
||||
} catch ( ... ) {} // handlers should not throw
|
||||
} else {
|
||||
CloseHandle(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
_running = false;
|
||||
#else
|
||||
struct sockaddr_un unaddr;
|
||||
socklen_t socklen;
|
||||
int s;
|
||||
while (_sock > 0) {
|
||||
unaddr.sun_family = AF_UNIX;
|
||||
strncpy(unaddr.sun_path,_endpoint.c_str(),sizeof(unaddr.sun_path));
|
||||
unaddr.sun_path[sizeof(unaddr.sun_path) - 1] = (char)0;
|
||||
socklen = sizeof(unaddr);
|
||||
s = accept(_sock,(struct sockaddr *)&unaddr,&socklen);
|
||||
if (s <= 0)
|
||||
break;
|
||||
if (!_sock) {
|
||||
::close(s);
|
||||
break;
|
||||
}
|
||||
try {
|
||||
_handler(_arg,new IpcConnection(s,_timeout,_handler,_arg),IpcConnection::IPC_EVENT_NEW_CONNECTION,(const char *)0);
|
||||
} catch ( ... ) {} // handlers should not throw
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace ZeroTier
|
@ -1,91 +0,0 @@
|
||||
/*
|
||||
* ZeroTier One - Global Peer to Peer Ethernet
|
||||
* Copyright (C) 2011-2014 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_IPCLISTENER_HPP
|
||||
#define ZT_IPCLISTENER_HPP
|
||||
|
||||
#include "../node/Constants.hpp"
|
||||
#include "../node/Thread.hpp"
|
||||
#include "../node/NonCopyable.hpp"
|
||||
#include "IpcConnection.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
/**
|
||||
* IPC incoming connection listener (Unix domain sockets or named pipes on Windows)
|
||||
*/
|
||||
class IpcListener : NonCopyable
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Listen for IPC connections
|
||||
*
|
||||
* The supplied handler is passed on to incoming instances of IpcConnection. When
|
||||
* a connection is first opened, it is called with IPC_EVENT_NEW_CONNECTION. The
|
||||
* receiver must take ownership of the connection object. When a connection is
|
||||
* closed, IPC_EVENT_CONNECTION_CLOSED is generated. At this point (or after) the
|
||||
* receiver must delete the object. IPC_EVENT_COMMAND is generated when lines of
|
||||
* text are read, and in this cases the last argument is not NULL. No closed event
|
||||
* is generated in the event of manual delete if the connection is still open.
|
||||
*
|
||||
* Yeah, this whole callback model sort of sucks. Might rethink and replace with
|
||||
* some kind of actor model or something if it gets too unweildy. But for now the
|
||||
* use cases are simple enough that it's not too bad.
|
||||
*
|
||||
* @param IPC endpoint name (OS-specific)
|
||||
* @param timeout Endpoint inactivity timeout in seconds
|
||||
* @param commandHandler Function to call for each command
|
||||
* @param arg First argument to pass to handler
|
||||
* @throws std::runtime_error Unable to bind to endpoint
|
||||
*/
|
||||
IpcListener(const char *ep,unsigned int timeout,void (*commandHandler)(void *,IpcConnection *,IpcConnection::EventType,const char *),void *arg);
|
||||
|
||||
~IpcListener();
|
||||
|
||||
void threadMain()
|
||||
throw();
|
||||
|
||||
private:
|
||||
std::string _endpoint;
|
||||
void (*_handler)(void *,IpcConnection *,IpcConnection::EventType,const char *);
|
||||
void *_arg;
|
||||
unsigned int _timeout;
|
||||
#ifdef __WINDOWS__
|
||||
volatile bool _run;
|
||||
volatile bool _running;
|
||||
#else
|
||||
volatile int _sock;
|
||||
#endif
|
||||
Thread _thread;
|
||||
};
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
||||
#endif
|
@ -1,167 +0,0 @@
|
||||
/*
|
||||
* ZeroTier One - Global Peer to Peer Ethernet
|
||||
* Copyright (C) 2011-2014 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/
|
||||
*/
|
||||
|
||||
#include "NodeControlClient.hpp"
|
||||
#include "../node/Constants.hpp"
|
||||
#include "../node/Utils.hpp"
|
||||
#include "../node/Defaults.hpp"
|
||||
#include "IpcConnection.hpp"
|
||||
#include "IpcListener.hpp"
|
||||
#include "NodeControlService.hpp"
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#include <WinSock2.h>
|
||||
#include <Windows.h>
|
||||
#include <tchar.h>
|
||||
#include <wchar.h>
|
||||
#include <ShlObj.h>
|
||||
#endif // __WINDOWS__
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
struct _NodeControlClientImpl
|
||||
{
|
||||
void (*resultHandler)(void *,const char *);
|
||||
void *arg;
|
||||
bool ignoreNextBreak;
|
||||
IpcConnection *ipcc;
|
||||
std::string err;
|
||||
};
|
||||
|
||||
static void _CBipcResultHandler(void *arg,IpcConnection *ipcc,IpcConnection::EventType event,const char *result)
|
||||
{
|
||||
if ((event == IpcConnection::IPC_EVENT_COMMAND)&&(result)) {
|
||||
if (!strcmp(result,"200 auth OK")) {
|
||||
((_NodeControlClientImpl *)arg)->ignoreNextBreak = true;
|
||||
} else if ((((_NodeControlClientImpl *)arg)->ignoreNextBreak)&&(!strcmp(result,"."))) {
|
||||
((_NodeControlClientImpl *)arg)->ignoreNextBreak = false;
|
||||
} else ((_NodeControlClientImpl *)arg)->resultHandler(((_NodeControlClientImpl *)arg)->arg,result);
|
||||
}
|
||||
}
|
||||
|
||||
NodeControlClient::NodeControlClient(const char *ep,const char *authToken,void (*resultHandler)(void *,const char *),void *arg)
|
||||
throw() :
|
||||
_impl((void *)new _NodeControlClientImpl)
|
||||
{
|
||||
_NodeControlClientImpl *impl = (_NodeControlClientImpl *)_impl;
|
||||
impl->resultHandler = resultHandler;
|
||||
impl->arg = arg;
|
||||
impl->ignoreNextBreak = false;
|
||||
try {
|
||||
impl->ipcc = new IpcConnection(ep,ZT_IPC_TIMEOUT,&_CBipcResultHandler,_impl);
|
||||
impl->ipcc->printf("auth %s"ZT_EOL_S,authToken);
|
||||
} catch ( ... ) {
|
||||
impl->ipcc = (IpcConnection *)0;
|
||||
impl->err = "failure connecting to running ZeroTier One service";
|
||||
}
|
||||
}
|
||||
|
||||
NodeControlClient::~NodeControlClient()
|
||||
{
|
||||
if (_impl) {
|
||||
delete ((_NodeControlClientImpl *)_impl)->ipcc;
|
||||
delete (_NodeControlClientImpl *)_impl;
|
||||
}
|
||||
}
|
||||
|
||||
const char *NodeControlClient::error() const
|
||||
throw()
|
||||
{
|
||||
if (((_NodeControlClientImpl *)_impl)->err.length())
|
||||
return ((_NodeControlClientImpl *)_impl)->err.c_str();
|
||||
return (const char *)0;
|
||||
}
|
||||
|
||||
void NodeControlClient::send(const char *command)
|
||||
throw()
|
||||
{
|
||||
try {
|
||||
if (((_NodeControlClientImpl *)_impl)->ipcc)
|
||||
((_NodeControlClientImpl *)_impl)->ipcc->printf("%s"ZT_EOL_S,command);
|
||||
} catch ( ... ) {}
|
||||
}
|
||||
|
||||
std::vector<std::string> NodeControlClient::splitLine(const char *line)
|
||||
{
|
||||
return Utils::split(line," ","\\","\"");
|
||||
}
|
||||
|
||||
const char *NodeControlClient::authTokenDefaultUserPath()
|
||||
{
|
||||
static std::string dlp;
|
||||
static Mutex dlp_m;
|
||||
|
||||
Mutex::Lock _l(dlp_m);
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
|
||||
if (!dlp.length()) {
|
||||
char buf[16384];
|
||||
if (SUCCEEDED(SHGetFolderPathA(NULL,CSIDL_APPDATA,NULL,0,buf)))
|
||||
dlp = (std::string(buf) + "\\ZeroTier\\One\\authtoken.secret");
|
||||
}
|
||||
|
||||
#else // not __WINDOWS__
|
||||
|
||||
if (!dlp.length()) {
|
||||
const char *home = getenv("HOME");
|
||||
if (home) {
|
||||
#ifdef __APPLE__
|
||||
dlp = (std::string(home) + "/Library/Application Support/ZeroTier/One/authtoken.secret");
|
||||
#else
|
||||
dlp = (std::string(home) + "/.zeroTierOneAuthToken");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __WINDOWS__ or not __WINDOWS__
|
||||
|
||||
return dlp.c_str();
|
||||
}
|
||||
|
||||
std::string NodeControlClient::getAuthToken(const char *path,bool generateIfNotFound)
|
||||
{
|
||||
unsigned char randbuf[24];
|
||||
std::string token;
|
||||
|
||||
if (Utils::readFile(path,token))
|
||||
return Utils::trim(token);
|
||||
else token = "";
|
||||
|
||||
if (generateIfNotFound) {
|
||||
Utils::getSecureRandom(randbuf,sizeof(randbuf));
|
||||
for(unsigned int i=0;i<sizeof(randbuf);++i)
|
||||
token.push_back(("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")[(unsigned int)randbuf[i] % 62]);
|
||||
if (!Utils::writeFile(path,token))
|
||||
return std::string();
|
||||
Utils::lockDownFile(path,false);
|
||||
}
|
||||
|
||||
return token;
|
||||
}
|
||||
|
||||
} // namespace ZeroTier
|
@ -1,118 +0,0 @@
|
||||
/*
|
||||
* ZeroTier One - Global Peer to Peer Ethernet
|
||||
* Copyright (C) 2011-2014 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_NODECONTROLCLIENT_HPP
|
||||
#define ZT_NODECONTROLCLIENT_HPP
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "../node/Constants.hpp"
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#define ZT_IPC_ENDPOINT_BASE "\\\\.\\pipe\\ZeroTierOne-"
|
||||
#else
|
||||
#define ZT_IPC_ENDPOINT_BASE "/tmp/.ZeroTierOne-"
|
||||
#endif
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
/**
|
||||
* Client for controlling a local ZeroTier One node
|
||||
*/
|
||||
class NodeControlClient
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Create a new node config client
|
||||
*
|
||||
* Initialization may fail. Call error() to check.
|
||||
*
|
||||
* @param ep Endpoint to connect to (OS-dependent)
|
||||
* @param resultHandler Function to call when commands provide results
|
||||
* @param arg First argument to result handler
|
||||
*/
|
||||
NodeControlClient(const char *ep,const char *authToken,void (*resultHandler)(void *,const char *),void *arg)
|
||||
throw();
|
||||
|
||||
~NodeControlClient();
|
||||
|
||||
/**
|
||||
* @return Initialization error or NULL if none
|
||||
*/
|
||||
const char *error() const
|
||||
throw();
|
||||
|
||||
/**
|
||||
* Send a command to the local node
|
||||
*
|
||||
* Note that the returned conversation ID will never be 0. A return value
|
||||
* of 0 indicates a fatal error such as failure to bind to any local UDP
|
||||
* port.
|
||||
*
|
||||
* @param command
|
||||
* @return Conversation ID that will be provided to result handler when/if results are sent back
|
||||
*/
|
||||
void send(const char *command)
|
||||
throw();
|
||||
inline void send(const std::string &command)
|
||||
throw() { return send(command.c_str()); }
|
||||
|
||||
/**
|
||||
* Split a line of results
|
||||
*
|
||||
* @param line Line to split
|
||||
* @return Vector of fields
|
||||
*/
|
||||
static std::vector<std::string> splitLine(const char *line);
|
||||
static inline std::vector<std::string> splitLine(const std::string &line) { return splitLine(line.c_str()); }
|
||||
|
||||
/**
|
||||
* @return Default path for current user's authtoken.secret or ~/.zeroTierOneAuthToken (location is platform-dependent)
|
||||
*/
|
||||
static const char *authTokenDefaultUserPath();
|
||||
|
||||
/**
|
||||
* Load (or generate) the authentication token
|
||||
*
|
||||
* @param path Full path to authtoken.secret
|
||||
* @param generateIfNotFound If true, generate and save if not found or readable (requires appropriate privileges, returns empty on failure)
|
||||
* @return Authentication token or empty string on failure
|
||||
*/
|
||||
static std::string getAuthToken(const char *path,bool generateIfNotFound);
|
||||
|
||||
private:
|
||||
// NodeControlClient is not copyable
|
||||
NodeControlClient(const NodeControlClient&);
|
||||
const NodeControlClient& operator=(const NodeControlClient&);
|
||||
|
||||
void *_impl;
|
||||
};
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
||||
#endif
|
@ -1,250 +0,0 @@
|
||||
/*
|
||||
* ZeroTier One - Global Peer to Peer Ethernet
|
||||
* Copyright (C) 2011-2014 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/
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "NodeControlService.hpp"
|
||||
#include "NodeControlClient.hpp"
|
||||
|
||||
#include "../node/Constants.hpp"
|
||||
#include "../node/MAC.hpp"
|
||||
#include "../node/Node.hpp"
|
||||
#include "../node/Utils.hpp"
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
NodeControlService::NodeControlService(Node *node,const char *authToken) :
|
||||
_node(node),
|
||||
_listener((IpcListener *)0),
|
||||
_authToken(authToken),
|
||||
_running(true),
|
||||
_thread(Thread::start(this))
|
||||
{
|
||||
}
|
||||
|
||||
NodeControlService::~NodeControlService()
|
||||
{
|
||||
_running = false;
|
||||
Thread::join(_thread);
|
||||
{
|
||||
Mutex::Lock _l(_connections_m);
|
||||
for(std::map< IpcConnection *,bool >::iterator c(_connections.begin());c!=_connections.end();++c)
|
||||
delete c->first;
|
||||
_connections.clear();
|
||||
}
|
||||
delete _listener;
|
||||
}
|
||||
|
||||
void NodeControlService::threadMain()
|
||||
throw()
|
||||
{
|
||||
char tmp[1024];
|
||||
try {
|
||||
while (_running) {
|
||||
if (!_node->running()) {
|
||||
if (_node->started())
|
||||
break;
|
||||
} else if ((_node->initialized())&&(_node->address())) {
|
||||
Utils::snprintf(tmp,sizeof(tmp),"%s%.10llx",ZT_IPC_ENDPOINT_BASE,(unsigned long long)_node->address());
|
||||
_listener = new IpcListener(tmp,ZT_IPC_TIMEOUT,&_CBcommandHandler,this);
|
||||
break;
|
||||
}
|
||||
Thread::sleep(100); // wait for Node to start
|
||||
}
|
||||
} catch ( ... ) {
|
||||
delete _listener;
|
||||
_listener = (IpcListener *)0;
|
||||
}
|
||||
}
|
||||
|
||||
void NodeControlService::_CBcommandHandler(void *arg,IpcConnection *ipcc,IpcConnection::EventType event,const char *commandLine)
|
||||
{
|
||||
switch(event) {
|
||||
case IpcConnection::IPC_EVENT_COMMAND: {
|
||||
if ((!((NodeControlService *)arg)->_running)||(!commandLine)||(!commandLine[0]))
|
||||
return;
|
||||
((NodeControlService *)arg)->_doCommand(ipcc,commandLine);
|
||||
} break;
|
||||
|
||||
case IpcConnection::IPC_EVENT_NEW_CONNECTION: {
|
||||
Mutex::Lock _l(((NodeControlService *)arg)->_connections_m);
|
||||
((NodeControlService *)arg)->_connections[ipcc] = false; // not yet authenticated
|
||||
} break;
|
||||
|
||||
case IpcConnection::IPC_EVENT_CONNECTION_CLOSED: {
|
||||
Mutex::Lock _l(((NodeControlService *)arg)->_connections_m);
|
||||
((NodeControlService *)arg)->_connections.erase(ipcc);
|
||||
delete ipcc;
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
void NodeControlService::_doCommand(IpcConnection *ipcc,const char *commandLine)
|
||||
{
|
||||
std::vector<std::string> r;
|
||||
std::vector<std::string> cmd(Utils::split(commandLine,"\r\n \t","\\","'"));
|
||||
|
||||
if ((cmd.empty())||(cmd[0] == "help")) {
|
||||
ipcc->printf("200 help help"ZT_EOL_S);
|
||||
ipcc->printf("200 help auth <token>"ZT_EOL_S);
|
||||
ipcc->printf("200 help info"ZT_EOL_S);
|
||||
ipcc->printf("200 help listpeers"ZT_EOL_S);
|
||||
ipcc->printf("200 help listnetworks"ZT_EOL_S);
|
||||
ipcc->printf("200 help join <network ID>"ZT_EOL_S);
|
||||
ipcc->printf("200 help leave <network ID>"ZT_EOL_S);
|
||||
ipcc->printf("200 help terminate [<reason>]"ZT_EOL_S);
|
||||
ipcc->printf("200 help updatecheck"ZT_EOL_S);
|
||||
} else if (cmd[0] == "auth") {
|
||||
if ((cmd.size() > 1)&&(_authToken.length() > 0)&&(_authToken == cmd[1])) {
|
||||
Mutex::Lock _l(_connections_m);
|
||||
_connections[ipcc] = true;
|
||||
ipcc->printf("200 auth OK"ZT_EOL_S);
|
||||
} else ipcc->printf("403 auth failed"ZT_EOL_S);
|
||||
} else {
|
||||
{
|
||||
Mutex::Lock _l(_connections_m);
|
||||
if (!_connections[ipcc]) {
|
||||
ipcc->printf("403 %s unauthorized"ZT_EOL_S"."ZT_EOL_S,cmd[0].c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (cmd[0] == "info") {
|
||||
ipcc->printf("200 info %.10llx %s %s"ZT_EOL_S,_node->address(),(_node->online() ? "ONLINE" : "OFFLINE"),Node::versionString());
|
||||
} else if (cmd[0] == "listpeers") {
|
||||
ipcc->printf("200 listpeers <ztaddr> <paths> <latency> <version> <role>"ZT_EOL_S);
|
||||
ZT1_Node_PeerList *pl = _node->listPeers();
|
||||
if (pl) {
|
||||
for(unsigned int i=0;i<pl->numPeers;++i) {
|
||||
ipcc->printf("200 listpeers %.10llx ",(unsigned long long)pl->peers[i].rawAddress);
|
||||
if (pl->peers[i].numPaths == 0)
|
||||
ipcc->printf("-");
|
||||
else {
|
||||
for(unsigned int j=0;j<pl->peers[i].numPaths;++j) {
|
||||
if (j > 0)
|
||||
ipcc->printf(",");
|
||||
switch(pl->peers[i].paths[j].type) {
|
||||
default:
|
||||
ipcc->printf("unknown;");
|
||||
break;
|
||||
case ZT1_Node_PhysicalPath_TYPE_UDP:
|
||||
ipcc->printf("udp;");
|
||||
break;
|
||||
case ZT1_Node_PhysicalPath_TYPE_TCP_OUT:
|
||||
ipcc->printf("tcp_out;");
|
||||
break;
|
||||
case ZT1_Node_PhysicalPath_TYPE_TCP_IN:
|
||||
ipcc->printf("tcp_in;");
|
||||
break;
|
||||
case ZT1_Node_PhysicalPath_TYPE_ETHERNET:
|
||||
ipcc->printf("eth;");
|
||||
break;
|
||||
}
|
||||
ipcc->printf("%s/%d;%ld;%ld;%ld;%s",
|
||||
pl->peers[i].paths[j].address.ascii,
|
||||
(int)pl->peers[i].paths[j].address.port,
|
||||
pl->peers[i].paths[j].lastSend,
|
||||
pl->peers[i].paths[j].lastReceive,
|
||||
pl->peers[i].paths[j].lastPing,
|
||||
(pl->peers[i].paths[j].fixed ? "fixed" : (pl->peers[i].paths[j].active ? "active" : "inactive")));
|
||||
}
|
||||
}
|
||||
const char *rolestr;
|
||||
switch(pl->peers[i].role) {
|
||||
case ZT1_Node_Peer_SUPERNODE: rolestr = "SUPERNODE"; break;
|
||||
case ZT1_Node_Peer_HUB: rolestr = "HUB"; break;
|
||||
case ZT1_Node_Peer_NODE: rolestr = "NODE"; break;
|
||||
default: rolestr = "?"; break;
|
||||
}
|
||||
ipcc->printf(" %u %s %s"ZT_EOL_S,
|
||||
pl->peers[i].latency,
|
||||
((pl->peers[i].remoteVersion[0]) ? pl->peers[i].remoteVersion : "-"),
|
||||
rolestr);
|
||||
}
|
||||
_node->freeQueryResult(pl);
|
||||
}
|
||||
} else if (cmd[0] == "listnetworks") {
|
||||
ipcc->printf("200 listnetworks <nwid> <name> <mac> <status> <config age> <type> <dev> <ips>"ZT_EOL_S);
|
||||
ZT1_Node_NetworkList *nl = _node->listNetworks();
|
||||
if (nl) {
|
||||
for(unsigned int i=0;i<nl->numNetworks;++i) {
|
||||
ipcc->printf("200 listnetworks %s %s %s %s %ld %s %s ",
|
||||
nl->networks[i].nwidHex,
|
||||
nl->networks[i].name,
|
||||
nl->networks[i].macStr,
|
||||
nl->networks[i].statusStr,
|
||||
nl->networks[i].configAge,
|
||||
(nl->networks[i].isPrivate ? "private" : "public"),
|
||||
nl->networks[i].device);
|
||||
if (nl->networks[i].numIps > 0) {
|
||||
for(unsigned int j=0;j<nl->networks[i].numIps;++j) {
|
||||
if (j > 0)
|
||||
ipcc->printf(",");
|
||||
ipcc->printf("%s/%d",nl->networks[i].ips[j].ascii,(int)nl->networks[i].ips[j].port);
|
||||
}
|
||||
} else ipcc->printf("-");
|
||||
ipcc->printf(ZT_EOL_S);
|
||||
}
|
||||
_node->freeQueryResult(nl);
|
||||
}
|
||||
} else if (cmd[0] == "join") {
|
||||
if (cmd.size() > 1) {
|
||||
uint64_t nwid = Utils::hexStrToU64(cmd[1].c_str());
|
||||
_node->join(nwid);
|
||||
ipcc->printf("200 join %.16llx OK"ZT_EOL_S,(unsigned long long)nwid);
|
||||
} else {
|
||||
ipcc->printf("400 join requires a network ID (>0) in hexadecimal format"ZT_EOL_S);
|
||||
}
|
||||
} else if (cmd[0] == "leave") {
|
||||
if (cmd.size() > 1) {
|
||||
uint64_t nwid = Utils::hexStrToU64(cmd[1].c_str());
|
||||
_node->leave(nwid);
|
||||
ipcc->printf("200 leave %.16llx OK"ZT_EOL_S,(unsigned long long)nwid);
|
||||
} else {
|
||||
ipcc->printf("400 leave requires a network ID (>0) in hexadecimal format"ZT_EOL_S);
|
||||
}
|
||||
} else if (cmd[0] == "terminate") {
|
||||
if (cmd.size() > 1)
|
||||
_node->terminate(Node::NODE_NORMAL_TERMINATION,cmd[1].c_str());
|
||||
else _node->terminate(Node::NODE_NORMAL_TERMINATION,"terminate via IPC command");
|
||||
} else if (cmd[0] == "updatecheck") {
|
||||
if (_node->updateCheck()) {
|
||||
ipcc->printf("500 software updates are not enabled"ZT_EOL_S);
|
||||
} else {
|
||||
ipcc->printf("200 OK"ZT_EOL_S);
|
||||
}
|
||||
} else {
|
||||
ipcc->printf("404 %s No such command. Use 'help' for help."ZT_EOL_S,cmd[0].c_str());
|
||||
}
|
||||
}
|
||||
|
||||
ipcc->printf("."ZT_EOL_S);
|
||||
}
|
||||
|
||||
} // namespace ZeroTier
|
@ -1,84 +0,0 @@
|
||||
/*
|
||||
* ZeroTier One - Global Peer to Peer Ethernet
|
||||
* Copyright (C) 2011-2014 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_NODECONTROLSERVICE_HPP
|
||||
#define ZT_NODECONTROLSERVICE_HPP
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include "IpcConnection.hpp"
|
||||
#include "IpcListener.hpp"
|
||||
|
||||
#include "../node/Constants.hpp"
|
||||
#include "../node/NonCopyable.hpp"
|
||||
#include "../node/Thread.hpp"
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
class Node;
|
||||
|
||||
/**
|
||||
* Background controller service that controls and configures a node
|
||||
*
|
||||
* This is used with system-installed instances of ZeroTier One to
|
||||
* provide the IPC-based control bus service for node configuration.
|
||||
*/
|
||||
class NodeControlService : NonCopyable
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @param node Node to control and configure
|
||||
* @param authToken Authorization token for clients
|
||||
*/
|
||||
NodeControlService(Node *node,const char *authToken);
|
||||
|
||||
~NodeControlService();
|
||||
|
||||
// Background thread waits for node to initialize, then creates IpcListener and
|
||||
// terminates. It also terminates on delete if it hasn't bootstrapped yet.
|
||||
void threadMain()
|
||||
throw();
|
||||
|
||||
private:
|
||||
static void _CBcommandHandler(void *arg,IpcConnection *ipcc,IpcConnection::EventType event,const char *commandLine);
|
||||
void _doCommand(IpcConnection *ipcc,const char *commandLine);
|
||||
|
||||
Node *_node;
|
||||
IpcListener *_listener;
|
||||
std::string _authToken;
|
||||
|
||||
std::map< IpcConnection *,bool > _connections;
|
||||
Mutex _connections_m;
|
||||
|
||||
volatile bool _running;
|
||||
Thread _thread;
|
||||
};
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
||||
#endif
|
@ -1,4 +0,0 @@
|
||||
ZeroTier Control Plane
|
||||
======
|
||||
|
||||
This code is responsible for the local command bus used to control the ZeroTier One service on a local machine via zerotier-cli or the Qt GUI. It's not part of the core node implementation. It uses Unix domain sockets on unix-like OSes and named pipes on Windows. Authentication is via a simple token mechanism. (Eventually this part of the software is getting a rework.)
|
261
controller/README.md
Normal file
@ -0,0 +1,261 @@
|
||||
Network Controller Microservice
|
||||
======
|
||||
|
||||
ZeroTier's 16-digit network IDs are really just a concatenation of the 10-digit ZeroTier address of a network controller followed by a 6-digit (24-bit) network number on that controller. Fans of software defined networking will recognize this as a variation of the familiar [separation of data plane and control plane](http://sdntutorials.com/difference-between-control-plane-and-data-plane/) SDN design pattern.
|
||||
|
||||
This code implements the *node/NetworkController.hpp* interface and provides a SQLite3-backed network controller microservice. Including it in the build allows ZeroTier One to act as a controller and create/manage networks.
|
||||
|
||||
This is the same code we use to run [my.zerotier.com](https://my.zerotier.com/), which is a web UI and API that runs in front of a pool of controllers.
|
||||
|
||||
### Building
|
||||
|
||||
On Linux, Mac, or BSD you can create a controller-enabled build with:
|
||||
|
||||
make ZT_ENABLE_NETWORK_CONTROLLER=1
|
||||
|
||||
You will need the development headers and libraries for SQLite3 installed.
|
||||
|
||||
### Running
|
||||
|
||||
After building and installing (`make install`) a controller-enabled build of ZeroTier One, start it and try:
|
||||
|
||||
sudo zerotier-cli /controller
|
||||
|
||||
You should see something like:
|
||||
|
||||
{
|
||||
"controller": true,
|
||||
"apiVersion": 2,
|
||||
"clock": 1468002975497,
|
||||
"instanceId": "8ab354604debe1da27ee627c9ef94a48"
|
||||
}
|
||||
|
||||
When started, a controller-enabled build of ZeroTier One will automatically create and initialize a `controller.db` file in its home folder. This is where all the controller's data and persistent state lives. If you're upgrading an old controller it will upgrade its database schema automatically on first launch. Make a backup of the old controller's database first since you can't go backward.
|
||||
|
||||
Controllers periodically make backups of their database as `controller.db.backup`. This is done so that this file can be more easily copied/rsync'ed to other systems without worrying about corruption. SQLite3 supports multiple processes accessing the same database file, so `sqlite3 /path/to/controller.db .dump` also works but can be slow on a busy controller.
|
||||
|
||||
Controllers can in theory host up to 2^24 networks and serve many millions of devices (or more), but we recommend running multiple controllers for a lot of networks to spread load and be more fault tolerant.
|
||||
|
||||
### Dockerizing Controllers
|
||||
|
||||
ZeroTier network controllers can easily be run in Docker or other container systems. Since containers do not need to actually join networks, extra privilege options like "--device=/dev/net/tun --privileged" are not needed. You'll just need to map the local JSON API port of the running controller and allow it to access the Internet (over UDP/9993 at a minimum) so things can reach and query it.
|
||||
|
||||
### Implementing High Availability Fail-Over
|
||||
|
||||
ZeroTier network controllers are not single points of failure for networks-- in the sense that if a controller goes down *existing* members of a network can continue to communicate. But new members (or those that have been offline for a while) can't join, existing members can't be de-authorized, and other changes to the network's configuration can't be made. This means that short "glitches" in controller availability are not a major problem but long periods of unavailability can be.
|
||||
|
||||
Because controllers are just regular ZeroTier nodes and controller queries are in-band, controllers can trivially be moved without worrying about changes to underlying physical IPs. This makes high-availability fail-over very easy to implement.
|
||||
|
||||
Just set up two cloud hosts, preferably in different data centers (e.g. two different AWS regions or Digital Ocean SF and NYC). Now set up the hot spare controller to constantly mirror `controller.db.backup` from its active sibling.
|
||||
|
||||
If the active controller goes down, rename `controller.db.backup` to `controller.db` on the hot spare and start the ZeroTier One service there. The spare will take over and has now become the active controller. If the original active node comes back, it should take on the role of spare and should not start its service. Instead it should start mirroring the active controller's backup and wait until it is needed.
|
||||
|
||||
The details of actually implementing this kind of HA fail-over on Linux or other OSes are beyond the scope of these docs and there are many ways to do it. Docker orchestration tools like Kubernetes can also be used to accomplish this if you've dockerized your controller.
|
||||
|
||||
### Network Controller API
|
||||
|
||||
The controller API is hosted via the same JSON API endpoint that ZeroTier One uses for local control (usually at 127.0.0.1 port 9993). All controller options are routed under the `/controller` base path.
|
||||
|
||||
The controller microservice does not implement any fine-grained access control (authentication is via authtoken.secret just like the regular JSON API) or other complex mangement features. It just takes network and network member configurations and reponds to controller queries. We have an enterprise product called [ZeroTier Central](https://my.zerotier.com/) that we host as a service (and that companies can license to self-host) that does this.
|
||||
|
||||
All working network IDs on a controller must begin with the controller's ZeroTier address. The API will *allow* "foreign" networks to be added but the controller will have no way of doing anything with them.
|
||||
|
||||
Also note that the API is *very* sensitive about types. Integers must be integers and strings strings, etc. Incorrectly typed and unrecognized fields are just ignored.
|
||||
|
||||
#### `/controller`
|
||||
|
||||
* Purpose: Check for controller function and return controller status
|
||||
* Methods: GET
|
||||
* Returns: { object }
|
||||
|
||||
| Field | Type | Description | Writable |
|
||||
| ------------------ | ----------- | ------------------------------------------------- | -------- |
|
||||
| controller | boolean | Always 'true' | no |
|
||||
| apiVersion | integer | Controller API version, currently 2 | no |
|
||||
| clock | integer | Current clock on controller, ms since epoch | no |
|
||||
| instanceId | string | A random ID generated on first controller DB init | no |
|
||||
|
||||
The instance ID can be used to check whether a controller's database has been reset or otherwise switched.
|
||||
|
||||
#### `/controller/network`
|
||||
|
||||
* Purpose: List all networks hosted by this controller
|
||||
* Methods: GET
|
||||
* Returns: [ string, ... ]
|
||||
|
||||
This returns an array of 16-digit hexadecimal network IDs.
|
||||
|
||||
#### `/controller/network/<network ID>`
|
||||
|
||||
* Purpose: Create, configure, and delete hosted networks
|
||||
* Methods: GET, POST, DELETE
|
||||
* Returns: { object }
|
||||
|
||||
By making queries to this path you can create, configure, and delete networks. DELETE is final, so don't do it unless you really mean it.
|
||||
|
||||
When POSTing new networks take care that their IDs are not in use, otherwise you may overwrite an existing one. To create a new network with a random unused ID, POST to `/controller/network/##########______`. The #'s are the controller's 10-digit ZeroTier address and they're followed by six underscores. Check the `nwid` field of the returned JSON object for your network's newly allocated ID. Subsequent POSTs to this network must refer to its actual path.
|
||||
|
||||
| Field | Type | Description | Writable |
|
||||
| --------------------- | ------------- | ------------------------------------------------- | -------- |
|
||||
| nwid | string | 16-digit network ID | no |
|
||||
| controllerInstanceId | string | Controller database instance ID | no |
|
||||
| clock | integer | Current clock, ms since epoch | no |
|
||||
| name | string | A short name for this network | YES |
|
||||
| private | boolean | Is access control enabled? | YES |
|
||||
| enableBroadcast | boolean | Ethernet ff:ff:ff:ff:ff:ff allowed? | YES |
|
||||
| allowPassiveBridging | boolean | Allow any member to bridge (very experimental) | YES |
|
||||
| v4AssignMode | string | If 'zt', auto-assign IPv4 from pool(s) | YES |
|
||||
| v6AssignMode | string | IPv6 address auto-assign modes; see below | YES |
|
||||
| multicastLimit | integer | Maximum recipients for a multicast packet | YES |
|
||||
| creationTime | integer | Time network was first created | no |
|
||||
| revision | integer | Network config revision counter | no |
|
||||
| memberRevisionCounter | integer | Network member revision counter | no |
|
||||
| authorizedMemberCount | integer | Number of authorized members (for private nets) | no |
|
||||
| relays | array[object] | Alternative relays; see below | YES |
|
||||
| routes | array[object] | Managed IPv4 and IPv6 routes; see below | YES |
|
||||
| ipAssignmentPools | array[object] | IP auto-assign ranges; see below | YES |
|
||||
| rules | array[object] | Traffic rules; see below | YES |
|
||||
|
||||
(The `ipLocalRoutes` field appeared in older versions but is no longer present. Routes will now show up in `routes`.)
|
||||
|
||||
Two important things to know about networks:
|
||||
|
||||
- Networks without rules won't carry any traffic. See below for an example with rules to permit IPv4 and IPv6.
|
||||
- Managed IP address assignments and IP assignment pools that do not fall within a route configured in `routes` are ignored and won't be used or sent to members.
|
||||
- The default for `private` is `true` and this is probably what you want. Turning `private` off means *anyone* can join your network with only its 16-digit network ID. It's also impossible to de-authorize a member as these networks don't issue or enforce certificates. Such "party line" networks are used for decentralized app backplanes, gaming, and testing but are not common in ordinary use.
|
||||
|
||||
**IPv6 Auto-Assign Modes:**
|
||||
|
||||
This field is (for legacy reasons) a comma-delimited list of strings. These can be `rfc4193`, `6plane`, and `zt`. RFC4193 and 6PLANE are special addressing modes that deterministically assign IPv6 addresses based on the network ID and the ZeroTier address of each member. The `zt` mode enables IPv6 auto-assignment from arbitrary IPv6 IP ranges configured in `ipAssignmentPools`.
|
||||
|
||||
**Relay object format:**
|
||||
|
||||
Relay objects define network-specific preferred relay nodes. Traffic to peers on this network will preferentially use these relays if they are available, and otherwise will fall back to the global rootserver infrastructure.
|
||||
|
||||
| Field | Type | Description | Writable |
|
||||
| --------------------- | ------------- | ------------------------------------------------- | -------- |
|
||||
| address | string | 10-digit ZeroTier address of relay | YES |
|
||||
| phyAddress | string | Optional IP/port suggestion for finding relay | YES |
|
||||
|
||||
**IP assignment pool object format:**
|
||||
|
||||
| Field | Type | Description | Writable |
|
||||
| --------------------- | ------------- | ------------------------------------------------- | -------- |
|
||||
| ipRangeStart | string | Starting IP address in range | YES |
|
||||
| ipRangeEnd | string | Ending IP address in range (inclusive) | YES |
|
||||
|
||||
Pools are only used if auto-assignment is on for the given address type (IPv4 or IPv6) and if the entire range falls within a managed route.
|
||||
|
||||
IPv6 ranges work just like IPv4 ranges and look like this:
|
||||
|
||||
{
|
||||
"ipRangeStart": "fd00:feed:feed:beef:0000:0000:0000:0000",
|
||||
"ipRangeEnd": "fd00:feed:feed:beef:ffff:ffff:ffff:ffff"
|
||||
}
|
||||
|
||||
(You can POST a shortened-form IPv6 address but the API will always report back un-shortened canonical form addresses.)
|
||||
|
||||
That defines a range within network `fd00:feed:feed:beef::/64` that contains up to 2^64 addresses. If an IPv6 range is large enough, the controller will assign addresses by placing each member's device ID into the address in a manner similar to the RFC4193 and 6PLANE modes. Otherwise it will assign addresses at random.
|
||||
|
||||
**Rule object format:**
|
||||
|
||||
Rules are matched in order of ruleNo. If no rules match, the default action is `drop`. To allow all traffic, create a single rule with all *null* fields and an action of `accept`.
|
||||
|
||||
In the future there will be many, many more types of rules. As of today only filtering by Ethernet packet type is supported.
|
||||
|
||||
| Field | Type | Description | Writable |
|
||||
| --------------------- | ------------- | ------------------------------------------------- | -------- |
|
||||
| ruleNo | integer | Rule sorting key | YES |
|
||||
| etherType | integer | Ethernet frame type (e.g. 34525 for IPv6) | YES |
|
||||
| action | string | Currently either `allow` or `drop` | YES |
|
||||
|
||||
**An Example: The Configuration for Earth**
|
||||
|
||||
Here is an example of a correctly configured ZeroTier network with IPv4 auto-assigned addresses from 28.0.0.0/7 (a "de-facto private" space) and RFC4193 IPv6 addressing. Users might recognize this as *Earth*, our public "global LAN party" that's used for demos and testing and occasionally gaming.
|
||||
|
||||
For your own networks you'll probably want to change `private` to `true` unless you like company. These rules on the other hand probably are what you want. These allow IPv4, IPv4 ARP, and IPv6 Ethernet frames. To allow only IPv4 omit the one for Ethernet type 34525 (IPv6).
|
||||
|
||||
{
|
||||
"nwid": "8056c2e21c000001",
|
||||
"controllerInstanceId": "8ab354604debe1da27ee627c9ef94a48",
|
||||
"clock": 1468004857100,
|
||||
"name": "earth.zerotier.net",
|
||||
"private": false,
|
||||
"enableBroadcast": false,
|
||||
"allowPassiveBridging": false,
|
||||
"v4AssignMode": "zt",
|
||||
"v6AssignMode": "rfc4193",
|
||||
"multicastLimit": 64,
|
||||
"creationTime": 1442292573165,
|
||||
"revision": 234,
|
||||
"memberRevisionCounter": 3326,
|
||||
"authorizedMemberCount": 2873,
|
||||
"relays": [],
|
||||
"routes": [
|
||||
{"target":"28.0.0.0/7","via":null,"flags":0,"metric":0}],
|
||||
"ipAssignmentPools": [
|
||||
{"ipRangeStart":"28.0.0.1","ipRangeEnd":"29.255.255.254"}],
|
||||
"rules": [
|
||||
{
|
||||
"ruleNo": 20,
|
||||
"etherType": 2048,
|
||||
"action": "accept"
|
||||
},{
|
||||
"ruleNo": 21,
|
||||
"etherType": 2054,
|
||||
"action": "accept"
|
||||
},{
|
||||
"ruleNo": 30,
|
||||
"etherType": 34525,
|
||||
"action": "accept"
|
||||
}]
|
||||
}
|
||||
|
||||
#### `/controller/network/<network ID>/member`
|
||||
|
||||
* Purpose: Get a set of all members on this network
|
||||
* Methods: GET
|
||||
* Returns: { object }
|
||||
|
||||
This returns a JSON object containing all member IDs as keys and their `memberRevisionCounter` values as values.
|
||||
|
||||
#### `/controller/network/<network ID>/active`
|
||||
|
||||
* Purpose: Get a set of all active members on this network
|
||||
* Methods: GET
|
||||
* Returns: { object }
|
||||
|
||||
This returns an object containing all currently online members and the most recent `recentLog` entries for their last request.
|
||||
|
||||
#### `/controller/network/<network ID>/member/<address>`
|
||||
|
||||
* Purpose: Create, authorize, or remove a network member
|
||||
* Methods: GET, POST, DELETE
|
||||
* Returns: { object }
|
||||
|
||||
| Field | Type | Description | Writable |
|
||||
| --------------------- | ------------- | ------------------------------------------------- | -------- |
|
||||
| nwid | string | 16-digit network ID | no |
|
||||
| clock | integer | Current clock, ms since epoch | no |
|
||||
| address | string | Member's 10-digit ZeroTier address | no |
|
||||
| authorized | boolean | Is member authorized? (for private networks) | YES |
|
||||
| activeBridge | boolean | Member is able to bridge to other Ethernet nets | YES |
|
||||
| identity | string | Member's public ZeroTier identity (if known) | no |
|
||||
| ipAssignments | array[string] | Managed IP address assignments | YES |
|
||||
| memberRevision | integer | Member revision counter | no |
|
||||
| recentLog | array[object] | Recent member activity log; see below | no |
|
||||
|
||||
Note that managed IP assignments are only used if they fall within a managed route. Otherwise they are ignored.
|
||||
|
||||
**Recent log object format:**
|
||||
|
||||
| Field | Type | Description |
|
||||
| --------------------- | ------------- | ------------------------------------------------- |
|
||||
| ts | integer | Time of request, ms since epoch |
|
||||
| authorized | boolean | Was member authorized? |
|
||||
| clientMajorVersion | integer | Client major version or -1 if unknown |
|
||||
| clientMinorVersion | integer | Client minor version or -1 if unknown |
|
||||
| clientRevision | integer | Client revision or -1 if unknown |
|
||||
| fromAddr | string | Physical address if known |
|
||||
|
||||
The controller can only know a member's `fromAddr` if it's able to establish a direct path to it. Members behind very restrictive firewalls may not have this information since the controller will be receiving the member's requests by way of a relay. ZeroTier does not back-trace IP paths as packets are relayed since this would add a lot of protocol overhead.
|