mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-08-19 04:50:37 -07:00
Compare commits
1452 commits
Author | SHA1 | Date | |
---|---|---|---|
|
a548c7ea71 |
||
|
969e8ff0ec |
||
|
a8ead37312 |
||
|
ecec45697b | ||
|
815c20c822 | ||
|
307c4ed4b6 |
||
|
14c0ccc94c | ||
|
4aea588eef | ||
|
4c4a360469 | ||
|
a0253a0970 | ||
|
7662ffb64a | ||
|
9375c48e33 | ||
|
5494c44a30 | ||
|
3f19712178 |
||
|
4a15671e84 |
||
|
51b2f284f0 | ||
|
67c2336176 |
||
|
6667c57e89 | ||
|
4edeacd1f0 | ||
|
01bd4373b6 | ||
|
2db20f0a6c | ||
|
7934fef84c | ||
|
4b6ff77fea | ||
|
a0cc7babdf | ||
|
cf77a6a805 | ||
|
b3da8d9aa1 | ||
|
d8272b7370 |
||
|
5329326591 | ||
|
06bc1e5e6b | ||
|
9b31fe1e98 | ||
|
0ae551a970 | ||
|
8e733ff0da | ||
|
52b6355a54 | ||
|
54fb480ade | ||
|
b292d4f06d |
||
|
076ed83b81 | ||
|
b12bc59b57 | ||
|
8e5522647a | ||
|
3fd42ad2a0 | ||
|
99cd9d174b | ||
|
f71a85a675 | ||
|
b9de551e0c | ||
|
0e87c21d87 | ||
|
2c2574e182 | ||
|
5c3daca2a0 | ||
|
5232af0a61 |
||
|
7f835b414a |
||
|
8895ad182f | ||
|
3784b66cdb |
||
|
0c7afe3d0a |
||
|
478cd2840b |
||
|
fbac205e65 |
||
|
67e8f344ac |
||
|
5fb8d2aa37 |
||
|
d50ec3094f |
||
|
7473d1942d |
||
|
e22c80dce6 |
||
|
8affcb0e3d |
||
|
16dd3fd7af | ||
|
a46fb73260 |
||
|
db6045fe9c |
||
|
4efd206dd4 |
||
|
b0889e1454 |
||
|
69de477d0b |
||
|
5eb3cd2699 |
||
|
226bb1d4ef |
||
|
8753829c1b |
||
|
55e9320299 |
||
|
c4af2d79c5 |
||
|
ce708df877 |
||
|
342fa9d33f |
||
|
fd9a23f30f |
||
|
d72b98b434 |
||
|
813fb7a394 |
||
|
6d532944bd |
||
|
ba2a4a605c |
||
|
d45f280cb7 |
||
|
7cf0d7a5d8 |
||
|
8b77ef538a |
||
|
e366661a09 |
||
|
8636fe3c33 |
||
|
08e0da7921 |
||
|
27021ff425 |
||
|
ecedddb19b |
||
|
ee73ac1a74 |
||
|
169250d484 |
||
|
4fea4fc76f |
||
|
6fa849c956 | ||
|
3cef1b0842 |
||
|
08b1ceb9a1 |
||
|
af0a9118c1 | ||
|
568da750bb | ||
|
d5f6f6b98e | ||
|
10ac0c2e1a | ||
|
1ffadf31de | ||
|
224ee88b91 |
||
|
b42067e654 |
||
|
c9e08c951a |
||
|
42f760d72f |
||
|
c68acebe31 |
||
|
4b7c5159a3 | ||
|
4a8daf43e4 | ||
|
182148a26c | ||
|
af715ca0ff | ||
|
990ecb5eb1 | ||
|
7c88b3f124 | ||
|
f4053c8af3 |
||
|
af3f8b00a4 |
||
|
db06c98608 | ||
|
332a7d1488 | ||
|
48f9f7de14 | ||
|
35d37559c8 | ||
|
1a6c0a5f12 | ||
|
2c8f032a76 | ||
|
bcc766f70d |
||
|
dcadc2c4d4 |
||
|
55ed5d61e0 |
||
|
86f424130d |
||
|
4e9b69f0a7 |
||
|
0a17738f39 |
||
|
fb7b07fc42 | ||
|
1d2130610c | ||
|
0b04f772ef | ||
|
5c73fe9304 | ||
|
2af105000f |
||
|
cadfa0bc4d |
||
|
f2521c8536 |
||
|
d353e0c6fa |
||
|
346731ea5d |
||
|
2ef38d84d1 |
||
|
5630d48a66 | ||
|
b44a9b8b62 |
||
|
f5b0fc6a8f |
||
|
a20bc772f2 |
||
|
010c4b0d64 |
||
|
dcb4bc5ef4 |
||
|
47e05d5a23 |
||
|
17abb58651 |
||
|
05b60bd818 |
||
|
5998f1497a |
||
|
269c8d415a |
||
|
cd191778c2 |
||
|
3e7aacf301 |
||
|
6b113c8270 |
||
|
a2162c01e3 |
||
|
870c221690 |
||
|
87ad848202 |
||
|
b736b6835d |
||
|
91bec01da8 |
||
|
a0c3f432c4 | ||
|
b5c51796b9 |
||
|
724002f142 |
||
|
377a9d6f41 |
||
|
003b4cf876 |
||
|
b12dd19d44 |
||
|
82c6454950 |
||
|
969c0ee6e3 |
||
|
c092b63987 |
||
|
47efee1df4 |
||
|
18a5452de8 |
||
|
c3794ba8d4 |
||
|
75a5b4438b |
||
|
185a3a2c76 |
||
|
3fcef51137 | ||
|
f959c2f4ca |
||
|
b7a6e106fd |
||
|
7dca7fac11 |
||
|
4ef2d4cc8e |
||
|
55bbd2aec6 | ||
|
36b4659f77 |
||
|
0b5666bde2 |
||
|
e1c72e6d51 |
||
|
5799d9a15b |
||
|
74404f56ee |
||
|
e53abe8bde |
||
|
29ef10e759 |
||
|
1e679cc94d |
||
|
96ba1079b2 |
||
|
f190df8621 |
||
|
6b078ee935 |
||
|
3de5cbd105 |
||
|
6faee38395 |
||
|
a44fd40889 |
||
|
5b7e1ceb68 |
||
|
d9d58c8bde |
||
|
d34481d830 |
||
|
307befa892 |
||
|
7647c8e8d1 |
||
|
b2d71f900a |
||
|
9e4ce68444 |
||
|
4920b68d2c |
||
|
5ce3d1e7a1 |
||
|
a0acc82e99 |
||
|
98e532de20 |
||
|
e1ee3eb494 |
||
|
4a485df0c7 |
||
|
2522d29fdc |
||
|
560d6fba1b | ||
|
223ec0c59d | ||
|
6bc785e771 |
||
|
fb8cbb69aa |
||
|
861147b845 |
||
|
763caaebab |
||
|
276259394a |
||
|
46c0d1a732 |
||
|
31d2dcec17 |
||
|
c9234ee027 |
||
|
9a8d715666 |
||
|
8d474e1395 |
||
|
52e3d9b804 |
||
|
8f5cc4ed33 |
||
|
059d05f41f |
||
|
c86b91c5f0 |
||
|
e42848d37d |
||
|
bf7dddbd84 |
||
|
95983ba168 |
||
|
c97943d69d |
||
|
b813ea70a5 |
||
|
e734019216 |
||
|
b7d9290de9 |
||
|
b1a30ae4ff |
||
|
8283a6d6d4 | ||
|
36adae3d82 |
||
|
f176e2539e |
||
|
d6bfb8889a |
||
|
24fb1ced3c |
||
|
82b8a4f584 |
||
|
979bca57d5 |
||
|
93fd93da5c |
||
|
508527f7cd |
||
|
64634c916c |
||
|
34cc26176c |
||
|
e2840b0eb8 | ||
|
f4edb092b7 | ||
|
8caede300c | ||
|
f9c6ee0181 | ||
|
f5cc7746b6 |
||
|
41a4690372 |
||
|
9d57ccd7b1 |
||
|
ad60d708e1 |
||
|
f79af92599 | ||
|
f368fdbc76 |
||
|
2f3ea8882b |
||
|
e32fecd16d | ||
|
dca77cb0d2 | ||
|
9ec6c2901c |
||
|
e915d10953 |
||
|
ddb2759a52 |
||
|
28cf1423c9 |
||
|
0fb9d43998 |
||
|
91e7ce87f0 |
||
|
e59790b401 | ||
|
d0b8f76ecb | ||
|
fe05372c67 | ||
|
4394ab58d7 | ||
|
fcaf008beb | ||
|
1e15a510fd | ||
|
9de2b90528 | ||
|
a71e0bf551 | ||
|
280cc77e23 |
||
|
a681fbf533 |
||
|
448df73a35 |
||
|
1982071d46 | ||
|
4dfb15e37c |
||
|
154b72b4f1 | ||
|
de4ee08ad4 | ||
|
5ae862ff54 |
||
|
859031dcd9 |
||
|
39e1aabd2a | ||
|
9f499827af |
||
|
9bde5b9065 | ||
|
acaebbd75e |
||
|
3ed6379c4c |
||
|
b4eb39fb16 | ||
|
6be0e67a5c |
||
|
abad7d8fe1 | ||
|
72cf3f2315 | ||
|
c02ea1bf60 | ||
|
b9d0cf9c89 |
||
|
80cfc2bd26 |
||
|
08d85d4ae1 |
||
|
43b141547e |
||
|
d658c1187c |
||
|
1f4c00c7b5 |
||
|
bbe97dd080 |
||
|
9724e04e6e |
||
|
364ac499eb | ||
|
8b15fa2422 |
||
|
41cb6fb0d5 |
||
|
5d8bd674cd |
||
|
2e6cda38f6 |
||
|
6e8fcce777 | ||
|
559e8a907b | ||
|
024649c175 |
||
|
7fb3711ed6 |
||
|
1dff0c6b5f |
||
|
768c6242cd | ||
|
bca650e1fc | ||
|
0bf67bf67c | ||
|
99ef1e2696 |
||
|
57b6b790c1 | ||
|
3593a2d49f | ||
|
dad33c9bde |
||
|
683d332abc |
||
|
ac6d532651 | ||
|
d1a306a021 | ||
|
4cd1dcfee1 | ||
|
3ab31545f4 | ||
|
197bbbb267 |
||
|
58adecc3a1 |
||
|
830d96d2ed |
||
|
f027d8f519 | ||
|
8b44ac984c |
||
|
5542dbcc0b | ||
|
0ca8ae7970 | ||
|
0b83f850e4 | ||
|
06399c86f6 | ||
|
663ed73768 |
||
|
d37dce508a |
||
|
2e882b4af2 |
||
|
1aa31e0414 | ||
|
a477688e51 | ||
|
5533b82450 | ||
|
1bd2fecbf6 |
||
|
8b5ac93388 |
||
|
2fd50b104c |
||
|
0088cef2fc |
||
|
85cab3d0f1 |
||
|
f89cde8186 |
||
|
e171384c19 |
||
|
c89683fb0f |
||
|
e7ed1e4f93 |
||
|
c6d5dc1534 |
||
|
9ae8b0b3b6 |
||
|
327eb9013b | ||
|
42f290b037 | ||
|
b7fb4eeda5 |
||
|
f03aae7a34 | ||
|
78eb35010f | ||
|
fd9afdce34 | ||
|
21e4e2924e | ||
|
e3d1565261 |
||
|
557b92a167 | ||
|
e299eea2b1 |
||
|
e1f1d05e08 | ||
|
125257f264 |
||
|
2d49931300 |
||
|
8426677c55 |
||
|
d322f332e8 |
||
|
f8359f554b |
||
|
60fb8c941a |
||
|
cb6a99408c | ||
|
d865c42ef8 |
||
|
69c590ff81 |
||
|
72533cbd13 |
||
|
c974a159af |
||
|
54efb62731 |
||
|
464bca5d20 |
||
|
7637ef10d7 |
||
|
0e5651f353 |
||
|
ffb63f3ee5 |
||
|
0859a0d1e5 |
||
|
e41a6f2ec4 | ||
|
c53c6bd9c3 |
||
|
707d7deed2 | ||
|
ed0a388bcd |
||
|
826a1ee346 | ||
|
d4e63fcdfe | ||
|
0806b881ea | ||
|
5becb41bd4 |
||
|
ead68038a3 |
||
|
b8b5d0bff8 |
||
|
e18172d434 |
||
|
a15883d49b |
||
|
714ef59814 |
||
|
1d095e81d9 | ||
|
d976a9f5a0 | ||
|
f2060e0c76 | ||
|
b81ad9a84d | ||
|
53bc05fe89 |
||
|
a6d5c452d5 |
||
|
515fdc22a5 |
||
|
424e276150 |
||
|
b071d6bbec | ||
|
27a9cc6254 |
||
|
bb9ad5e41a |
||
|
d91f80464d |
||
|
d826ddb294 |
||
|
a7600c8072 |
||
|
82a9122fc3 |
||
|
0e9e7f2ebc |
||
|
14671009f8 | ||
|
802c9907a1 |
||
|
88b96265d7 |
||
|
0bc10923a1 | ||
|
0dc92c2d7b |
||
|
04a3206e53 |
||
|
98360d94a5 |
||
|
a9c8307d97 |
||
|
581489f67b |
||
|
5e89d5a03f |
||
|
d71d051c53 |
||
|
d2aeff6752 |
||
|
36be14de06 |
||
|
f9af9a15f2 |
||
|
4674bb5c8b |
||
|
a6b764bf7c |
||
|
c6f07ee19f |
||
|
e36127283c |
||
|
230ae6bd16 | ||
|
5b5ef07350 | ||
|
fb6af1971b | ||
|
41f9bdc5db |
||
|
12e64aa191 |
||
|
22ab673480 | ||
|
03841dcb81 |
||
|
64c2634b71 |
||
|
f1019dc4ee |
||
|
50ede37a58 | ||
|
60ddca1354 | ||
|
19f1f02d91 | ||
|
5a36b315a3 |
||
|
b67cd2cf7a |
||
|
97492eec7c |
||
|
fdc2e0f692 | ||
|
2672d037a8 |
||
|
ee663d61cd | ||
|
008a768f15 |
||
|
33b2e6a856 |
||
|
6540107ccb |
||
|
1ce08a62a9 |
||
|
b82bdc7782 |
||
|
e0e21dfdda |
||
|
981d09cc28 |
||
|
2fbd5dc828 |
||
|
931b02dbb1 | ||
|
0962af5e72 |
||
|
9b7d13476f |
||
|
3efb731b40 |
||
|
ce989d0d67 |
||
|
405f96c4b7 |
||
|
5ad0212b93 |
||
|
30799dd73f |
||
|
8ebe2c563a |
||
|
57588dec7a |
||
|
9a8b74d744 |
||
|
e11d70e408 | ||
|
60d2138f30 | ||
|
259ee610a6 | ||
|
4192f6a6d9 | ||
|
54decda7a4 | ||
|
f42841a6ab |
||
|
524363dcf7 |
||
|
17f6b3a10b |
||
|
da71e2524c |
||
|
f3da2b4031 |
||
|
e2dad367b4 | ||
|
9b7ff43118 | ||
|
adfbbc3fb0 |
||
|
f621261ff9 |
||
|
00d55fc4b4 |
||
|
74dc41c7c7 |
||
|
925599cab0 |
||
|
a43048a1ad |
||
|
d6c5a6cd59 |
||
|
54f339f0c0 |
||
|
115b9147b9 |
||
|
6b5c9b1b8e |
||
|
06b487119d |
||
|
4ca3f27293 |
||
|
785a121825 |
||
|
f73e51e94c |
||
|
e6802690b8 |
||
|
595e033776 |
||
|
e5fc89821f |
||
|
411e54023a |
||
|
8f05c85838 |
||
|
e4cb74896b |
||
|
8e6e4ede6d |
||
|
0b03ad9a21 |
||
|
0e6a314d86 |
||
|
1b59712c48 |
||
|
7c8d5b0afd |
||
|
7f63d896f9 |
||
|
2115b18ae3 |
||
|
4ac3e7b864 |
||
|
03bd96d1d1 |
||
|
4a85cf5e74 |
||
|
a8fde9e530 |
||
|
1f9a15dd18 |
||
|
a872cc3418 |
||
|
646147c275 |
||
|
314099a267 |
||
|
ce9330e9bb |
||
|
b2a981f353 |
||
|
a372619fee |
||
|
12cdf39165 | ||
|
19c5343a0a | ||
|
4a4c8f84d5 | ||
|
f94208f493 | ||
|
f2cb9b36b2 | ||
|
1c5897895b |
||
|
64423f3a09 | ||
|
9fb3f04385 | ||
|
dd627cd7f4 | ||
|
eedf270127 |
||
|
a1af94f4e9 |
||
|
9f5bf06f95 | ||
|
40705caf7e |
||
|
9d5b9efc2f |
||
|
cc4251c5b7 |
||
|
8d74d34f2a | ||
|
7f996ea6d5 | ||
|
0aa4a4ba7a | ||
|
1ab36d891c | ||
|
5b5625a6f0 | ||
|
33a9cd02ba | ||
|
ca73651e12 | ||
|
fbd834716f | ||
|
914b4fae7b | ||
|
a1bf139188 | ||
|
a2f753986b | ||
|
d28f44335a | ||
|
0a925a6f21 | ||
|
132bff25df | ||
|
e1c16a8e68 | ||
|
4ee73fa272 | ||
|
30cfe65b39 | ||
|
40d5f9b5d2 | ||
|
809022b273 | ||
|
d0c0585553 | ||
|
d60929514b | ||
|
920e1f56c2 | ||
|
86122e1646 | ||
|
f9a27d6778 | ||
|
8b0be5c1fc | ||
|
686561dc5b | ||
|
b8b8e58586 | ||
|
54fd7c7e9a | ||
|
e060ae3176 | ||
|
7392a32cd8 | ||
|
8b724493cc | ||
|
9cb16accfd | ||
|
d5944ae69c | ||
|
6102c70855 | ||
|
6cc055dbba | ||
|
f51ce077a3 | ||
|
2de4c95446 | ||
|
63f70ba465 | ||
|
7ef68a9d6a | ||
|
90bf300bd8 | ||
|
f9528f1248 | ||
|
4861ec5a40 | ||
|
acf5b3579b | ||
|
d1460ab65b | ||
|
85bd773c55 | ||
|
ed3918b508 | ||
|
7c2766096c | ||
|
acd8b95114 | ||
|
34ff813e2a | ||
|
056cef7292 | ||
|
7c5f256d4a | ||
|
82749e4442 | ||
|
7890185e81 | ||
|
71fc0dd097 | ||
|
8373a0fa60 | ||
|
21264baaae | ||
|
703f9290c9 | ||
|
dd1b52c7d9 | ||
|
01003617cd | ||
|
bfe4bc2894 | ||
|
1c88037ea0 | ||
|
0027e6bdab | ||
|
87edbb2d3a | ||
|
5be92a96df | ||
|
0733af5239 | ||
|
216ed8c8ea | ||
|
58e3b8c5ad | ||
|
c6adfd9d67 |
||
|
672c58be01 |
||
|
6cf3b65953 |
||
|
936dda4773 |
||
|
047e327f01 |
||
|
032dc5c108 |
||
|
dc54e0e1c4 | ||
|
9124b0a7a3 |
||
|
dea47f601d |
||
|
67cf4c42d5 | ||
|
dc762196dc |
||
|
0a900dc275 |
||
|
6f58510431 |
||
|
666fb7ea2d |
||
|
f0778860e5 |
||
|
6aea546d6f |
||
|
e0a3291235 |
||
|
b88d7091c8 |
||
|
15cfa3bf62 |
||
|
9c9d1650d1 | ||
|
0ae09577f6 |
||
|
a59f82093a |
||
|
be95b56c10 |
||
|
ea0f7dde95 | ||
|
a59626c971 |
||
|
67a7534c21 |
||
|
39f3f5b2d9 | ||
|
eccc31a4b9 | ||
|
d31f238be0 |
||
|
27c26a77a2 | ||
|
ab503902c8 |
||
|
ed53b62f1b |
||
|
ad5ba54cd4 |
||
|
a6742b7f82 | ||
|
91bae4b1a8 | ||
|
4959d8079b | ||
|
a558bd9312 |
||
|
3e41163bbe |
||
|
10170b41c3 | ||
|
e0e91e8397 | ||
|
d2de0292cc |
||
|
0210ba9c13 | ||
|
117d7194af |
||
|
7587ef5136 |
||
|
087a797257 |
||
|
a02f42188c |
||
|
98e0bf22d3 | ||
|
1e2ff042b4 | ||
|
b8eb9196e8 | ||
|
db1df58955 | ||
|
2f5dc10399 |
||
|
4100615cd6 | ||
|
e27c3edaba | ||
|
3c9ea2b667 |
||
|
065f42af1d |
||
|
1d503f45ad |
||
|
5b5f9a069a | ||
|
77c7f9133f | ||
|
475281935e | ||
|
cdf248b1e2 | ||
|
85c0322313 |
||
|
ebc1ed4015 | ||
|
a25da7f771 |
||
|
c78f103ca6 |
||
|
4d50ed0b9d | ||
|
9ac2cfe611 | ||
|
85da0b419c | ||
|
3ddaa60de9 |
||
|
25641d956e |
||
|
3b8c33d49a | ||
|
f74a594e98 | ||
|
668ab8b85c |
||
|
98b190c626 |
||
|
9568a4f2b4 | ||
|
b41e0910b0 |
||
|
6448189d20 |
||
|
1694d510ec |
||
|
af7ccff846 | ||
|
381460fd97 |
||
|
b02a41751c |
||
|
e0acccc3c9 | ||
|
bcf27d78e5 | ||
|
ad54d0ed52 | ||
|
880a99adf8 |
||
|
3b11915eab | ||
|
82c799b9d1 | ||
|
99c0ca621b | ||
|
e1f60e3f83 |
||
|
5a6c229b27 | ||
|
86a436e9bf | ||
|
7516fd03a3 |
||
|
9826c20d1a |
||
|
12392b5190 |
||
|
4e57abb159 |
||
|
2b1ba60f24 |
||
|
638c868a07 |
||
|
b909330518 |
||
|
802072ec17 |
||
|
3c343eb775 |
||
|
8b67d06272 |
||
|
bc521504ca |
||
|
0797adf223 |
||
|
718039561e | ||
|
85698860ae | ||
|
50e131a4ff |
||
|
b733bb8ead | ||
|
e18d206248 |
||
|
2248b1f846 |
||
|
58e19e86f4 |
||
|
04d1862e3a | ||
|
7ecfc37854 | ||
|
21d7806064 | ||
|
c5b2d6cbc8 | ||
|
75c7e501ef | ||
|
dba0931b58 | ||
|
e0a7d6bfb9 | ||
|
add854d31b |
||
|
66b70a8043 |
||
|
1d1843bf3b |
||
|
0e23ba8f1a |
||
|
b6074da498 |
||
|
7e92d478a1 |
||
|
a9ec057b91 |
||
|
64a5e0d93f |
||
|
378e4ea34e | ||
|
ff670d044a |
||
|
fac212fafa |
||
|
e83c7e6691 | ||
|
e0c4877d76 | ||
|
457b5d2fe8 | ||
|
9cf8dacfbb |
||
|
b5d7d71e1e |
||
|
6fdc7be502 |
||
|
8fe858c5c6 |
||
|
0d7197381a |
||
|
651f45fe29 | ||
|
02270e0e3d | ||
|
cb692d73c8 | ||
|
1300cf23c5 |
||
|
3cb24410a8 |
||
|
be7ce4110e |
||
|
c07e4a8c01 |
||
|
ff8da9d246 |
||
|
b1faebae4a | ||
|
e96515433d | ||
|
5a8d2c3cb4 |
||
|
183a9d7088 |
||
|
c1384422c3 |
||
|
ccc0ebd0f9 |
||
|
9d4336d296 |
||
|
17bc9d3085 |
||
|
436f481a34 |
||
|
9e8215b213 |
||
|
e958a83dd4 |
||
|
f44b122262 |
||
|
26d1cf9186 |
||
|
895ee77c38 |
||
|
caf8b15f6d |
||
|
bc7f18064f |
||
|
355d3f44fb |
||
|
9de863e68b |
||
|
64b7f8e445 |
||
|
626f488cb4 |
||
|
10212e376a |
||
|
81462cd530 |
||
|
7d4e4ac646 |
||
|
0ed339f19d |
||
|
c6fc3560f2 |
||
|
b4cec0b4a8 |
||
|
d7030b6e9c |
||
|
7ed5bde426 |
||
|
75652ce667 |
||
|
91f801ee72 | ||
|
c6f567ae4a | ||
|
e1ca3c995d |
||
|
addc327f17 |
||
|
f2c12d548d |
||
|
ef36acb970 |
||
|
d5ca4e5f52 | ||
|
373ca30269 |
||
|
0d9d3a90de |
||
|
363481b0f1 | ||
|
38058450ce | ||
|
e672dc8094 |
||
|
c6682f2a3f |
||
|
4508a6687e |
||
|
a47c3cb16f |
||
|
9b42ced27f |
||
|
1a400d33fd |
||
|
96ee7252c2 |
||
|
b0624d3fd1 |
||
|
c329fab966 |
||
|
127c19fecd | ||
|
4c22793850 |
||
|
da74b9651c |
||
|
ce23a8dd32 |
||
|
30d106766a |
||
|
c4df88354b |
||
|
b65c1ed3a0 |
||
|
b329fb68a9 |
||
|
da179d9930 |
||
|
e7fee4c6ce |
||
|
4151749dc9 |
||
|
aee9521c91 |
||
|
7e46c83592 |
||
|
ba74abb753 | ||
|
9ddc0327d4 |
||
|
c34325fee7 |
||
|
db8443ef7d |
||
|
6c85f8c7a7 |
||
|
eea93d2607 |
||
|
e9f8ecbf7e |
||
|
48852e8cb4 | ||
|
55ec325961 |
||
|
59151fbf86 |
||
|
1c700b7b41 |
||
|
ff18bacd94 |
||
|
caf1de3bcf |
||
|
a9ad2924ac |
||
|
7ea2354540 |
||
|
760bba67e7 |
||
|
1fe3a4402d | ||
|
166c7978ee | ||
|
4f80e79886 |
||
|
b47a2c9ac5 |
||
|
1a5274b86b |
||
|
66236e91a2 |
||
|
36475aebc7 | ||
|
acd1f24a3f |
||
|
a74532fa0b |
||
|
59d4aef7c2 |
||
|
dfb291090d |
||
|
dac32f863e |
||
|
f3b56d3d94 |
||
|
eb95a427fa |
||
|
f16299b10b |
||
|
76bce44280 |
||
|
ee0a194b25 |
||
|
ef08346a74 |
||
|
fe0068da52 |
||
|
cd70fefc5e |
||
|
877f86a896 |
||
|
912036b260 |
||
|
a4e8847664 |
||
|
c492bf7eea |
||
|
cb086ff97f |
||
|
7e4da53c0b |
||
|
fe376f6a1e |
||
|
55a99f34d0 |
||
|
99df637aae |
||
|
d0c68096df |
||
|
1c464c2da1 |
||
|
5b15da98b4 |
||
|
d5a95f9224 |
||
|
a7dcfa18a2 |
||
|
4389b9feff |
||
|
cf03996bf2 |
||
|
e1a3bd3a92 |
||
|
58119598ae |
||
|
42a2afaef9 |
||
|
c2cfb4d1dc |
||
|
f0b0172434 |
||
|
8217cadc08 |
||
|
6ad047a8fc |
||
|
23ef742e08 |
||
|
1294767b44 | ||
|
eca645fc52 |
||
|
8598f34ebf |
||
|
cade483a00 |
||
|
df46248a0c |
||
|
6cddb94509 | ||
|
0e658828fb |
||
|
de04240ca6 |
||
|
40681328ec |
||
|
4dbdfb6972 |
||
|
bd9c8d65ef |
||
|
24ec634005 |
||
|
ff0e6a53fc |
||
|
ffb444dbeb | ||
|
d6f32516d8 |
||
|
29566bfe7d |
||
|
16d2b85c71 |
||
|
193b357a0c | ||
|
8ee8870c27 |
||
|
3c59de7c00 |
||
|
e87bf87046 |
||
|
b4f7a9a4f4 |
||
|
a360416655 |
||
|
26dbebbba7 |
||
|
04b77773c4 |
||
|
6f4a69703b |
||
|
d67f59f5b5 |
||
|
00d9abb612 | ||
|
c8920cff19 |
||
|
7293ba7d71 |
||
|
e73d7d9349 |
||
|
0e3be9b837 |
||
|
c600590aa6 | ||
|
1343f15a07 |
||
|
5fcaed086d |
||
|
130689d82b |
||
|
1efceb86fc |
||
|
1d92974447 |
||
|
de56f571c7 |
||
|
3670b8cefd |
||
|
425f5201a2 |
||
|
df3b29e6ff |
||
|
96a49bf476 |
||
|
2d975f275c |
||
|
76e30cf165 |
||
|
da603208b4 |
||
|
6dc7bdf72e |
||
|
d52ebaa412 |
||
|
c30a1f60ea |
||
|
2388c9f4e4 |
||
|
f41372680d |
||
|
7efb1cf7d3 | ||
|
0547fd3593 | ||
|
2800534445 |
||
|
e464050a40 |
||
|
73ec8cddd7 |
||
|
1c171b5d99 |
||
|
32f49b44b0 |
||
|
e2d4571ade |
||
|
3f19e7d73c |
||
|
93076dde56 |
||
|
3e78785dea |
||
|
68c9398f71 |
||
|
4b3a13797a | ||
|
4a2c75a609 |
||
|
34a64f30de |
||
|
4bdf0317c3 |
||
|
8624972d01 |
||
|
6bfaaaa557 |
||
|
b42c998095 |
||
|
56357c077b |
||
|
3def00370e |
||
|
e1a3285273 |
||
|
59b392af10 |
||
|
a8dde7b89b |
||
|
ecde26c823 |
||
|
567969d33c |
||
|
544a4de1e0 |
||
|
c341bf6d8c |
||
|
297869163e |
||
|
3ead6b67cd |
||
|
3cbea6c898 |
||
|
1f73ab4b05 |
||
|
8148c658cf |
||
|
15ddf28c6a |
||
|
16b5274963 |
||
|
f8e24f4629 |
||
|
1cf8a1f493 |
||
|
bc2c4cf80a | ||
|
9933d83cf8 |
||
|
1918c29fd7 |
||
|
84705aafc7 |
||
|
618202d426 |
||
|
8b9a7d2c8f |
||
|
d1335dca11 |
||
|
5e13b42abc |
||
|
b4b5a70a03 | ||
|
96aa1c30a6 |
||
|
1b0c183913 |
||
|
5d4a9a4aa1 | ||
|
31c12aebb5 |
||
|
40269c2a97 |
||
|
ed74ed6ed2 |
||
|
26e684eb0e |
||
|
fc66f79988 | ||
|
3c85a7f074 |
||
|
62d2a00e74 |
||
|
bb2b109707 |
||
|
c5008031b9 |
||
|
1d15d4e8d3 |
||
|
da898d5a19 | ||
|
f9c84c8c52 |
||
|
5d63ed6739 |
||
|
fdf4ebd43c |
||
|
dc9fdb7da8 |
||
|
2652c71c9e |
||
|
806d1fff42 |
||
|
c065e88e1e |
||
|
4641a44029 |
||
|
f544f75c36 |
||
|
720168f0a0 |
||
|
6dfecca91e |
||
|
10b38b5b0a |
||
|
dbc5d5c453 |
||
|
a3e0ba16f5 |
||
|
3c906102e1 |
||
|
566ac113e4 | ||
|
5abc8bd2af |
||
|
926b2e168e |
||
|
e475e8151d |
||
|
440f10e353 |
||
|
30256c7106 |
||
|
21946f38d0 |
||
|
549673664d |
||
|
b45d0c5a36 | ||
|
4df05c2890 | ||
|
d886089091 | ||
|
51158dde93 |
||
|
09fff7f1cb |
||
|
91f435f32f | ||
|
726ffddce2 | ||
|
4ecf692f46 |
||
|
2a461a9aac | ||
|
211b1fc23c |
||
|
df6bbb0b0c |
||
|
cfae20e0df |
||
|
3c0adde0c7 |
||
|
f511c9c938 |
||
|
20f88b37ef | ||
|
269501eaa0 | ||
|
330e1de3d1 | ||
|
25e14e2164 | ||
|
aa97aabb4e |
||
|
59cd2766e3 | ||
|
b7952d7f39 |
||
|
c380a4e4bd |
||
|
9c487cbfb8 |
||
|
6fc636535f |
||
|
4190318c85 |
||
|
2f554fd6f8 |
||
|
ae93cccde6 | ||
|
46e955e3a1 |
||
|
60057d7072 |
||
|
2850f131e2 |
||
|
440568a516 |
||
|
e31088aaf9 | ||
|
63b36e8569 |
||
|
726d359335 |
||
|
fc0858a4a3 |
||
|
f80103778a |
||
|
c09010c25a |
||
|
9cd1466e6b |
||
|
801be64ed3 |
||
|
d719137565 |
||
|
58aba96494 |
||
|
f8d7796099 |
||
|
241c41267b |
||
|
2ac1ff9be2 |
||
|
cb31b3987f |
||
|
c256398095 |
||
|
7bb8703bf9 | ||
|
0da00bf546 |
||
|
4866490cdf |
||
|
1547b1a581 |
||
|
511c77aa99 | ||
|
692a0e7ac2 | ||
|
fa25b45198 | ||
|
cdd25c389e |
||
|
133a6ff7b3 |
||
|
96add0ba65 |
||
|
f5096a1f26 |
||
|
3d4d087f07 |
||
|
953e62f103 |
||
|
084727c54a |
||
|
8ea192fcab |
||
|
dceba1f2f1 |
||
|
73878fbdc4 |
||
|
87d17088cc |
||
|
cc6c48fca8 |
||
|
e556a2ee23 |
||
|
50b866c5cf |
||
|
f83eed9ef9 |
||
|
cb9313a454 |
||
|
cf411efd1d |
||
|
1c956494a4 |
||
|
dbe3aa1efc |
||
|
4128d80974 |
||
|
057356a725 |
||
|
a69e91c541 |
||
|
8fccf3136c |
||
|
2435ab70ab |
||
|
f489862500 |
||
|
2642fa1ee2 |
||
|
2293b0703f |
||
|
1375e3e2f5 |
||
|
0ab5cce878 |
||
|
b567e91f68 |
||
|
eee31605b1 |
||
|
df9a7497b1 |
||
|
c6adb6df12 |
||
|
aeec7dae36 | ||
|
fa58909d44 |
||
|
06ed114fb6 |
||
|
bdef9d3bd7 |
||
|
b154b7296c |
||
|
8019f13479 | ||
|
1c6fd4125d |
||
|
1f99f1d5f4 |
||
|
30c77cfee5 |
||
|
afdc91f21f | ||
|
3470c5314d | ||
|
f0e824416b |
||
|
52ff67fb2c |
||
|
e9375b50b0 |
||
|
1f43a736b2 |
||
|
05a0a20197 |
||
|
2ee595553a |
||
|
2d4fe9e6d0 | ||
|
dc12bde068 | ||
|
b3fbbd3124 |
||
|
983336911c |
||
|
48b39ab005 |
||
|
5095d73de3 |
||
|
1192b1b422 |
||
|
43c528fdb6 |
||
|
da4b9922d4 |
||
|
7a8c89be9d |
||
|
3b37db1a36 |
||
|
5ae0f9d03f |
||
|
1dd1bf8bac |
||
|
8966002685 |
||
|
4ce810b421 |
||
|
730482e62f |
||
|
eac56a2e25 |
||
|
5c3a2357ef |
||
|
663a09b38d |
||
|
eaccce743f |
||
|
7cce23ae79 |
||
|
73c186b111 |
||
|
5ce0019ee5 | ||
|
ca8d315924 |
||
|
dfdac7adbd |
||
|
a33d7c64fe |
||
|
e37c9055b3 | ||
|
d15516f0ef |
||
|
4a1d6f4cc8 |
||
|
6393a4beec |
||
|
06125c48bc | ||
|
8cda04cc98 | ||
|
f20b7e8cee |
||
|
19dded141a |
||
|
d19cf1eaac | ||
|
d6b00bcd40 | ||
|
1b1fe61fd0 | ||
|
3bce783cbc |
||
|
5966f7d9d2 |
||
|
aed0b4941f | ||
|
9ef75c0e13 |
||
|
5f548705dd |
||
|
39d3c8402e | ||
|
5cb6265547 |
||
|
03dd537ea4 | ||
|
4af8f1bf03 |
||
|
ae8df648d5 |
||
|
5e24166318 |
||
|
4e10b4e017 |
||
|
87fdd644d4 |
||
|
2e356613ec |
||
|
91e9b736dd |
||
|
7f4cc1a239 |
||
|
3e3d46e72e | ||
|
460c2552a8 |
||
|
1a7fb83882 |
||
|
dfac6303bc |
||
|
8b77a93d60 |
||
|
fabfb10b97 |
||
|
65549cb0da |
||
|
bee137c6d9 |
||
|
a2a7122da9 |
||
|
0e798222a7 |
||
|
c890f1762a |
||
|
ea4d7ae92f |
||
|
1ef385b685 |
||
|
0875fb5fe0 |
||
|
b5186f7293 |
||
|
fa21fdc1cc |
||
|
3f4cd7f5a2 |
||
|
272fb2ca96 |
||
|
a7116bc971 |
||
|
502cbc2175 |
||
|
953d22de14 |
||
|
cacfc294d9 | ||
|
f8ca7002c2 |
||
|
6c728313f5 | ||
|
1a2dc67702 |
||
|
f7dbd050af | ||
|
c16b03c8b8 |
||
|
357e1aca54 |
||
|
c15890b4db |
||
|
f268237372 |
||
|
4d021e16a5 |
||
|
62ce6e6a60 | ||
|
c7109c646a |
||
|
43433cdb5a | ||
|
8d39c9a861 |
||
|
f8bf91426b |
||
|
f7934972ea |
||
|
4cadfd736f |
||
|
c46309ea8a |
||
|
37f26beb50 | ||
|
1c7a5439d5 |
||
|
ebc4c898ff |
||
|
56cf874d99 |
||
|
079ff50622 |
||
|
31888f5ef8 |
||
|
7a626abf15 |
||
|
3c7bd65bc9 |
||
|
01bf3b8245 |
||
|
a6c1998c81 |
||
|
0069b1bac3 |
||
|
25c5cad1d1 | ||
|
c689c0bd8c |
||
|
271dfc0d2b |
||
|
0032df3bf1 |
||
|
993e58773a |
||
|
8f4c038e23 |
||
|
81f2c57656 |
||
|
594853e251 |
||
|
cce8411c22 |
||
|
786906b0f7 |
||
|
aed37a391d | ||
|
cc6de583be |
||
|
b277e04efa |
||
|
95032cc74d |
||
|
3818351287 |
||
|
4d26b5a868 |
||
|
ac0dc7844f |
||
|
27e3597d5e |
||
|
9e8de2a702 |
||
|
165757176a |
||
|
a411b83a65 |
||
|
12900d914a |
||
|
190e9464ce | ||
|
57dd26baa9 | ||
|
19f3a97a8d |
||
|
375e5ee7dd |
||
|
05df378dce |
||
|
f1efea6800 |
||
|
eb1cafcd01 | ||
|
81de6d2dfa | ||
|
9e38c31b64 | ||
|
7d1f447458 |
||
|
1b66a1cd2f |
||
|
eabe091038 |
||
|
b403f106fb |
||
|
75a45eeb27 |
||
|
452b1e806b |
||
|
9f9a870399 |
||
|
48ce7632fa |
||
|
30d5d5a892 |
||
|
9bc79f94df |
||
|
a0239e17e9 |
||
|
c8a58b4b04 |
||
|
b72e5e8386 |
||
|
565885a4c0 |
||
|
134d33c218 |
||
|
9cfb807fcb |
||
|
46adc1f059 |
||
|
9002555596 |
||
|
3b375b55c2 |
||
|
3f49570f45 |
||
|
7c3166e9be |
||
|
39b97f9163 |
||
|
af79be5002 |
||
|
a20a290836 |
||
|
e822463916 |
||
|
d2c3ea6901 |
||
|
83265768c1 |
||
|
27ce787fbd |
||
|
9c6ec2c52e |
||
|
3a4425fd4e |
||
|
6bb1598fa3 |
||
|
4eb6a4286e | ||
|
a9942ca412 | ||
|
8d21ae9813 | ||
|
ff8044f0c0 |
||
|
1b8917a57c |
||
|
a91c49fa52 | ||
|
e607348c7e |
||
|
b6ed919fbc |
||
|
109252be4e |
||
|
a4b98518e3 |
||
|
c3a42bf590 |
||
|
8b95afa96a |
||
|
6a49a766ca |
||
|
932584f8fc |
||
|
d7ba2957cd |
||
|
16ff14bda7 |
||
|
57c1d96b71 |
||
|
40f376e2b9 |
||
|
1a1d7d9ada |
||
|
d1c88971ae |
||
|
dc61f78916 |
||
|
a2ffe8c05e |
||
|
e1af003e4f |
||
|
19391858d4 |
||
|
5005244d1b |
||
|
15380cfc14 |
||
|
11b352458e |
||
|
b6680b18e7 |
||
|
ec4c2aa12f |
||
|
0e8c43cfdd | ||
|
958420ee44 | ||
|
2d8a54f05d |
||
|
d0f4cfe6b4 |
||
|
3ec23f92ec |
||
|
6baac1b4e0 |
||
|
1d8b8d8e9c |
||
|
50b0b2e2e9 |
||
|
20721491e8 |
||
|
eec46a137e |
||
|
9eae444104 |
||
|
576b4f03a5 |
||
|
2d0f76bb9c |
||
|
6492f4487b |
||
|
126669b718 |
||
|
6fd45c1f9d | ||
|
4eb3b762d4 |
||
|
f24afca1ba |
||
|
461810b06a |
||
|
20050662b2 |
||
|
2053415418 |
||
|
613d7b5ece |
||
|
db29c3ac13 | ||
|
c101d71d7c |
||
|
63a44c9268 |
||
|
5623a0b420 | ||
|
663e748b8d |
||
|
0cf62d334d |
||
|
0872012cd9 |
||
|
c2d8fe46d5 |
||
|
0310bfa3e3 |
||
|
efe0e8aa7b |
||
|
5c7e51feaf |
||
|
34de579c91 |
||
|
0ed9db05d2 |
||
|
46387e2f2b | ||
|
8913f13b36 | ||
|
e5007f1290 | ||
|
740c77a488 | ||
|
73ddea8864 |
||
|
10215af96d |
||
|
e67fee0264 |
||
|
5ece4f734a |
||
|
27409b615a | ||
|
8866fbd618 | ||
|
8885149cd3 |
||
|
89ddf2991b |
||
|
547b0de8a5 |
||
|
0461b24db3 |
||
|
c698e9c122 |
||
|
8f84a968de | ||
|
f8ea7fdc2b |
||
|
7b0d11b187 |
||
|
8dd3639576 |
||
|
364ad87e2b |
||
|
9380ef708a |
||
|
fd174b3459 |
||
|
21d27c314c |
||
|
0b89a49201 |
||
|
de718d9743 |
||
|
e6b4fb5af7 |
||
|
c227330d09 |
||
|
c769e282fb |
||
|
98722ed7ea |
||
|
b16f40c0de |
||
|
fd85f87ade |
||
|
add33f1ab3 |
||
|
3bfc438ae8 |
||
|
1dfe909bab |
||
|
75d17ea3c8 |
||
|
96d15337bb |
||
|
74a678c1e1 |
||
|
fed1846c6f |
||
|
f27d193cf6 |
||
|
7941b63543 |
||
|
21965ac8e8 |
||
|
7ca2ecb421 |
||
|
1dcfc03cbc |
||
|
0702e581a1 |
||
|
c78792a705 |
||
|
287c19e822 |
||
|
bc901d613d |
||
|
2192a8b0ec |
||
|
6cb4c58d9a |
||
|
4f521baafd |
||
|
81fda3f5b8 |
||
|
91c4dfc7c0 |
||
|
788296ea29 | ||
|
60c1fcbc48 | ||
|
fc6d90a04a |
||
|
faf0c6bbfa |
||
|
79f1e81745 |
||
|
7427961fcf |
||
|
d2f1d05a06 |
||
|
19f4146aca |
||
|
47154fa623 |
||
|
5c508515c4 | ||
|
2824139510 | ||
|
c2efdcabc5 |
||
|
6f622e4551 |
||
|
6d8c96b89f |
||
|
bf4bb414dd |
||
|
dee3361c1d |
||
|
c470c6255e |
||
|
6faca86bb4 |
||
|
4fed56443e |
||
|
1859365f9d | ||
|
ab87b8f881 | ||
|
b8b65da51c |
||
|
198e6f765c | ||
|
810e2a761f |
||
|
6ce71c1bc3 |
||
|
6b3a7ec827 |
||
|
ed2360d9f7 |
||
|
1ce71f9dc0 |
||
|
18508b5a2e |
||
|
621898f3c5 |
||
|
2c1d7f3dcc |
||
|
8bb5bc736d |
||
|
b270d527f4 |
||
|
1bd9e9078e |
||
|
a3361a7d97 |
||
|
ca1715118f |
||
|
27ecb7c7b6 | ||
|
be7fca254f | ||
|
b64ae8c8a5 |
||
|
b984eb2808 | ||
|
15905b2fe3 |
||
|
24615ed24b |
||
|
13481cea18 |
||
|
7faaa55436 | ||
|
11ddbc6f30 |
||
|
29e5880d8b |
||
|
63fd2cbaeb |
||
|
9c58308e6a |
||
|
5fb814a04f |
||
|
c69d2df0a2 |
||
|
46a7136b0d |
||
|
d2974f2e60 |
||
|
ed8fe8990b |
||
|
50703534b1 |
||
|
4a7c156bf8 |
||
|
54680a6edc |
||
|
bac57e355d |
||
|
b8b1f64959 | ||
|
cdcd6c4886 |
||
|
4e8640b380 |
||
|
9374e45449 |
||
|
31ffe4403c |
||
|
e8f7d5ef9e |
||
|
ee0e306685 | ||
|
b37e9de24d | ||
|
df0007d532 |
||
|
b70c5b94bd |
||
|
23f9baa9f2 | ||
|
537ce83498 | ||
|
1732f7371c |
||
|
5262a2f753 |
||
|
79e2fd4586 | ||
|
353905394e |
||
|
3870f7af27 |
||
|
b8e23e6fcc | ||
|
a7f652781f |
||
|
d3fd0d3916 | ||
|
1beacf3000 |
||
|
88a1170966 |
||
|
315a5cfd58 |
||
|
a5a94e3c49 |
||
|
ef784611b7 | ||
|
d526dca1bb | ||
|
3af693af34 |
||
|
0a18e66a83 |
||
|
57a225cb39 |
||
|
1bd1923964 |
||
|
2aecb547d9 |
||
|
f2734dc3d8 |
||
|
bfe5c758ba | ||
|
c9f07e855e |
2937 changed files with 517892 additions and 59720 deletions
75
.clang-format
Normal file
75
.clang-format
Normal file
|
@ -0,0 +1,75 @@
|
|||
---
|
||||
BasedOnStyle: LLVM
|
||||
BreakBeforeBraces: Stroustrup
|
||||
IndentWidth: 4
|
||||
TabWidth: 4
|
||||
AlignAfterOpenBracket: AlwaysBreak
|
||||
AlignConsecutiveMacros: 'true'
|
||||
AlignConsecutiveAssignments: 'false'
|
||||
AlignConsecutiveDeclarations: 'false'
|
||||
AlignEscapedNewlines: Right
|
||||
AlignOperands: 'true'
|
||||
AlignTrailingComments: 'true'
|
||||
AllowAllArgumentsOnNextLine: 'false'
|
||||
AllowAllConstructorInitializersOnNextLine: 'false'
|
||||
AllowAllParametersOfDeclarationOnNextLine: 'false'
|
||||
AllowShortBlocksOnASingleLine: 'true'
|
||||
AllowShortCaseLabelsOnASingleLine: 'false'
|
||||
AllowShortFunctionsOnASingleLine: None
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AlwaysBreakAfterReturnType: None
|
||||
BinPackArguments: 'false'
|
||||
BinPackParameters: 'false'
|
||||
BreakBeforeBinaryOperators: NonAssignment
|
||||
BreakBeforeTernaryOperators: 'true'
|
||||
BreakConstructorInitializers: BeforeComma
|
||||
BreakInheritanceList: BeforeComma
|
||||
CompactNamespaces: 'false'
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: 'true'
|
||||
ConstructorInitializerIndentWidth: '4'
|
||||
ContinuationIndentWidth: '4'
|
||||
Cpp11BracedListStyle: 'false'
|
||||
FixNamespaceComments: 'true'
|
||||
IncludeBlocks: Regroup
|
||||
IndentCaseLabels: 'true'
|
||||
IndentPPDirectives: None
|
||||
IndentWrappedFunctionNames: 'false'
|
||||
KeepEmptyLinesAtTheStartOfBlocks: 'false'
|
||||
MaxEmptyLinesToKeep: '1'
|
||||
NamespaceIndentation: None
|
||||
PointerAlignment: Left
|
||||
ReflowComments: 'true'
|
||||
SortIncludes: 'true'
|
||||
SortUsingDeclarations: 'true'
|
||||
SpaceAfterCStyleCast: 'false'
|
||||
SpaceAfterLogicalNot: 'true'
|
||||
SpaceAfterTemplateKeyword: 'true'
|
||||
SpaceBeforeAssignmentOperators: 'true'
|
||||
SpaceBeforeCpp11BracedList: 'true'
|
||||
SpaceBeforeCtorInitializerColon: 'true'
|
||||
SpaceBeforeInheritanceColon: 'true'
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeRangeBasedForLoopColon: 'true'
|
||||
SpaceInEmptyParentheses: 'false'
|
||||
SpacesBeforeTrailingComments: '3'
|
||||
SpacesInAngles: 'false'
|
||||
SpacesInCStyleCastParentheses: 'false'
|
||||
SpacesInContainerLiterals: 'true'
|
||||
SpacesInParentheses: 'false'
|
||||
SpacesInSquareBrackets: 'false'
|
||||
UseTab: 'Always'
|
||||
|
||||
---
|
||||
Language: Cpp
|
||||
Standard: Cpp03
|
||||
ColumnLimit: '240'
|
||||
---
|
||||
Language: ObjC
|
||||
ColumnLimit: '240'
|
||||
---
|
||||
Language: Java
|
||||
ColumnLimit: '240'
|
||||
---
|
||||
Language: CSharp
|
||||
ColumnLimit: '240'
|
||||
...
|
9
.clangd
Normal file
9
.clangd
Normal file
|
@ -0,0 +1,9 @@
|
|||
CompileFlags:
|
||||
Add:
|
||||
- "-std=c++17"
|
||||
- "-I../ext"
|
||||
- "-I../ext/prometheus-cpp-lite-1.0/core/include"
|
||||
- "-I../ext/prometheus-cpp-lite-1.0/simpleapi/include"
|
||||
- "-I./ext"
|
||||
- "-I./ext/prometheus-cpp-lite-1.0/core/include"
|
||||
- "-I./ext/prometheus-cpp-lite-1.0/simpleapi/include"
|
33
.github/ISSUE_TEMPLATE/bugs-and-issues.md
vendored
33
.github/ISSUE_TEMPLATE/bugs-and-issues.md
vendored
|
@ -11,38 +11,21 @@ assignees: ''
|
|||
|
||||
_Using these will ensure you get quicker support, and make this space available for code-related issues. Thank you!_
|
||||
|
||||
- [Knowledge Base](https://zerotier.atlassian.net/wiki/spaces/SD/overview) => Guides and documentation on how to use ZeroTier.
|
||||
- [Docs Site](https://docs.zerotier.com/zerotier/troubleshooting) => Troubleshooting, quickstarts, and more advanced topics.
|
||||
- [Discuss Forum](https://discuss.zerotier.com/) => Our discussion forum for users and support to mutually resolve issues & suggest ideas.
|
||||
- [Reddit](https://www.reddit.com/r/zerotier/) => Our subreddit, which we monitor regularly and is fairly active.
|
||||
- [Knowledge Base](https://zerotier.atlassian.net/wiki/spaces/SD/overview) => Older wiki.
|
||||
|
||||
If you are having a connection issue, it's much easier to diagnose through the discussion forum or the ticket system.
|
||||
|
||||
|
||||
# If you still want to file a Bug Report
|
||||
|
||||
## Required
|
||||
## Please let us know
|
||||
|
||||
- What you expect to be happening.
|
||||
- What is actually happening?
|
||||
- Any steps to reproduce the error.
|
||||
- Any screenshots that would help us out.
|
||||
- Any relevant console output or screenshots.
|
||||
- What operating system and ZeroTier version. Please try the latest ZeroTier release.
|
||||
|
||||
## Additional information
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
- OS: [e.g. Mac, Linux, Windows, BSD]
|
||||
- OS/Distribution Version
|
||||
- ZeroTier Version [e.g. 1.4.6]
|
||||
|
||||
**Smartphone (please complete the following information):**
|
||||
- Device: [e.g. iPhone6]
|
||||
- OS: [e.g. iOS8.1]
|
||||
- ZeroTier Version [e.g. 1.4.6]
|
||||
|
||||
**Embedded & NAS (please complete the following information):**
|
||||
- Device: [e.g. Synology, Pi4]
|
||||
- OS/Distribution (if applicable)
|
||||
- ZeroTier Version [e.g. 1.4.6]
|
||||
|
||||
**Additional context**
|
||||
- ZeroTier Network Configuration: IPv4 & IPv6 networks defined on your ZeroTier Central
|
||||
- Router Config: are you permitting port 9993, uPnP, and NAT-PMP?
|
||||
- Firewall Config: are you permitting port 9993 on your OS; setting it to "Private" on Windows?
|
||||
- Are you using this at home, in an office, college, etc?
|
||||
|
|
126
.github/workflows/build.yml
vendored
Normal file
126
.github/workflows/build.yml
vendored
Normal file
|
@ -0,0 +1,126 @@
|
|||
on:
|
||||
pull_request:
|
||||
push:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build_ubuntu:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: gitconfig
|
||||
run: |
|
||||
git config --global core.autocrlf input
|
||||
# git config --global core.eol lf
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: stable
|
||||
targets: x86_64-unknown-linux-gnu
|
||||
components: rustfmt, clippy
|
||||
|
||||
- name: Set up cargo cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
continue-on-error: false
|
||||
with:
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('rustybits//Cargo.lock') }}
|
||||
shared-key: ${{ runner.os }}-cargo-
|
||||
workspaces: |
|
||||
rustybits/
|
||||
|
||||
- name: make
|
||||
run: make
|
||||
- name: selftest
|
||||
run: |
|
||||
make selftest
|
||||
./zerotier-selftest
|
||||
- name: 'Tar files' # keeps permissions (execute)
|
||||
run: tar -cvf zerotier-one.tar zerotier-one
|
||||
- name: Archive production artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: zerotier-one-ubuntu-x64
|
||||
path: zerotier-one.tar
|
||||
retention-days: 7
|
||||
|
||||
build_macos:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: gitconfig
|
||||
run: |
|
||||
git config --global core.autocrlf input
|
||||
# git config --global core.eol lf
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Install Rust aarch64
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: stable
|
||||
target: aarch64-apple-darwin
|
||||
components: rustfmt, clippy
|
||||
- name: Install Rust x86_64
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: stable
|
||||
target: x86_64-apple-darwin
|
||||
components: rustfmt, clippy
|
||||
- name: Set up cargo cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
continue-on-error: false
|
||||
with:
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('rustybits//Cargo.lock') }}
|
||||
shared-key: ${{ runner.os }}-cargo-
|
||||
workspaces: |
|
||||
rustybits/
|
||||
- name: make
|
||||
run: make
|
||||
- name: selftest
|
||||
run: |
|
||||
make selftest
|
||||
./zerotier-selftest
|
||||
- name: 'Tar files' # keeps permissions (execute)
|
||||
run: tar -cvf zerotier-one.tar zerotier-one
|
||||
- name: Archive production artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: zerotier-one-mac
|
||||
path: zerotier-one.tar
|
||||
retention-days: 7
|
||||
|
||||
|
||||
build_windows:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: gitconfig
|
||||
run: |
|
||||
git config --global core.autocrlf true
|
||||
# git config --global core.eol lf
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: stable
|
||||
target: aarch64-apple-darwin
|
||||
components: rustfmt, clippy
|
||||
- name: Set up cargo cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
continue-on-error: false
|
||||
with:
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('rustybits//Cargo.lock') }}
|
||||
shared-key: ${{ runner.os }}-cargo-
|
||||
workspaces: |
|
||||
rustybits/
|
||||
|
||||
- name: setup msbuild
|
||||
uses: microsoft/setup-msbuild@v2
|
||||
- name: msbuild
|
||||
run: |
|
||||
msbuild windows\ZeroTierOne.sln /m /p:Configuration=Release /property:Platform=x64 /t:ZeroTierOne
|
||||
- name: Archive production artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: zerotier-one-windows
|
||||
path: windows/Build
|
||||
retention-days: 7
|
497
.github/workflows/validate-linux.sh
vendored
Executable file
497
.github/workflows/validate-linux.sh
vendored
Executable file
|
@ -0,0 +1,497 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This test script joins Earth and pokes some stuff
|
||||
|
||||
TEST_NETWORK=8056c2e21c000001
|
||||
RUN_LENGTH=30
|
||||
TEST_FINISHED=false
|
||||
ZTO_VER=$(git describe --tags $(git rev-list --tags --max-count=1))
|
||||
ZTO_COMMIT=$(git rev-parse HEAD)
|
||||
ZTO_COMMIT_SHORT=$(git rev-parse --short HEAD)
|
||||
TEST_DIR_PREFIX="$ZTO_VER-$ZTO_COMMIT_SHORT-test-results"
|
||||
|
||||
TEST_OK=0
|
||||
TEST_FAIL=1
|
||||
|
||||
echo "Performing test on: $ZTO_VER-$ZTO_COMMIT_SHORT"
|
||||
TEST_FILEPATH_PREFIX="$TEST_DIR_PREFIX/$ZTO_COMMIT_SHORT"
|
||||
mkdir $TEST_DIR_PREFIX
|
||||
|
||||
# How long we will wait for ZT to come online before considering it a failure
|
||||
MAX_WAIT_SECS=30
|
||||
|
||||
ZT_PORT_NODE_1=9996
|
||||
ZT_PORT_NODE_2=9997
|
||||
|
||||
################################################################################
|
||||
# Multi-node connectivity and performance test #
|
||||
################################################################################
|
||||
|
||||
test() {
|
||||
|
||||
echo -e "\nPerforming pre-flight checks"
|
||||
|
||||
check_exit_on_invalid_identity
|
||||
|
||||
echo -e "\nRunning test for $RUN_LENGTH seconds"
|
||||
|
||||
export NS1="ip netns exec ns1"
|
||||
export NS2="ip netns exec ns2"
|
||||
|
||||
export ZT1="$NS1 ./zerotier-cli -p9996 -D$(pwd)/node1"
|
||||
# Specify custom port on one node to ensure that feature works
|
||||
export ZT2="$NS2 ./zerotier-cli -p9997 -D$(pwd)/node2"
|
||||
|
||||
echo -e "\nSetting up network namespaces..."
|
||||
echo "Setting up ns1"
|
||||
|
||||
ip netns add ns1
|
||||
$NS1 ip link set dev lo up
|
||||
ip link add veth0 type veth peer name veth1
|
||||
ip link set veth1 netns ns1
|
||||
ip addr add 192.168.0.1/24 dev veth0
|
||||
ip link set dev veth0 up
|
||||
|
||||
$NS1 ip addr add 192.168.0.2/24 dev veth1
|
||||
$NS1 ip link set dev veth1 up
|
||||
|
||||
# Add default route
|
||||
$NS1 ip route add default via 192.168.0.1
|
||||
|
||||
iptables -t nat -A POSTROUTING -s 192.168.0.0/255.255.255.0 \
|
||||
-o eth0 -j MASQUERADE
|
||||
iptables -A FORWARD -i eth0 -o veth0 -j ACCEPT
|
||||
iptables -A FORWARD -o eth0 -i veth0 -j ACCEPT
|
||||
|
||||
echo "Setting up ns2"
|
||||
ip netns add ns2
|
||||
$NS2 ip link set dev lo up
|
||||
ip link add veth2 type veth peer name veth3
|
||||
ip link set veth3 netns ns2
|
||||
ip addr add 192.168.1.1/24 dev veth2
|
||||
ip link set dev veth2 up
|
||||
|
||||
$NS2 ip addr add 192.168.1.2/24 dev veth3
|
||||
$NS2 ip link set dev veth3 up
|
||||
$NS2 ip route add default via 192.168.1.1
|
||||
|
||||
iptables -t nat -A POSTROUTING -s 192.168.1.0/255.255.255.0 \
|
||||
-o eth0 -j MASQUERADE
|
||||
iptables -A FORWARD -i eth0 -o veth2 -j ACCEPT
|
||||
iptables -A FORWARD -o eth0 -i veth2 -j ACCEPT
|
||||
|
||||
# Allow forwarding
|
||||
sysctl -w net.ipv4.ip_forward=1
|
||||
|
||||
################################################################################
|
||||
# Memory Leak Check #
|
||||
################################################################################
|
||||
|
||||
export FILENAME_MEMORY_LOG="$TEST_FILEPATH_PREFIX-memory.log"
|
||||
|
||||
echo -e "\nStarting a ZeroTier instance in each namespace..."
|
||||
|
||||
export time_test_start=$(date +%s)
|
||||
|
||||
# Spam the CLI as ZeroTier is starting
|
||||
spam_cli 100
|
||||
|
||||
echo "Starting memory leak check"
|
||||
$NS1 sudo valgrind --demangle=yes --exit-on-first-error=yes \
|
||||
--error-exitcode=1 \
|
||||
--xml=yes \
|
||||
--xml-file=$FILENAME_MEMORY_LOG \
|
||||
--leak-check=full \
|
||||
./zerotier-one node1 -p$ZT_PORT_NODE_1 -U >>node_1.log 2>&1 &
|
||||
|
||||
# Second instance, not run in memory profiler
|
||||
# Don't set up internet access until _after_ zerotier is running
|
||||
# This has been a source of stuckness in the past.
|
||||
$NS2 ip addr del 192.168.1.2/24 dev veth3
|
||||
$NS2 sudo ./zerotier-one node2 -U -p$ZT_PORT_NODE_2 >>node_2.log 2>&1 &
|
||||
|
||||
sleep 10; # New HTTP control plane is a bit sluggish, so we delay here
|
||||
|
||||
check_bind_to_correct_ports $ZT_PORT_NODE_1
|
||||
check_bind_to_correct_ports $ZT_PORT_NODE_2
|
||||
|
||||
$NS2 ip addr add 192.168.1.2/24 dev veth3
|
||||
$NS2 ip route add default via 192.168.1.1
|
||||
|
||||
echo -e "\nPing from host to namespaces"
|
||||
|
||||
ping -c 3 192.168.0.1
|
||||
ping -c 3 192.168.1.1
|
||||
|
||||
echo -e "\nPing from namespace to host"
|
||||
|
||||
$NS1 ping -c 3 192.168.0.1
|
||||
$NS1 ping -c 3 192.168.0.1
|
||||
$NS2 ping -c 3 192.168.0.2
|
||||
$NS2 ping -c 3 192.168.0.2
|
||||
|
||||
echo -e "\nPing from ns1 to ns2"
|
||||
|
||||
$NS1 ping -c 3 192.168.0.1
|
||||
|
||||
echo -e "\nPing from ns2 to ns1"
|
||||
|
||||
$NS2 ping -c 3 192.168.0.1
|
||||
|
||||
################################################################################
|
||||
# Online Check #
|
||||
################################################################################
|
||||
|
||||
echo "Waiting for ZeroTier to come online before attempting test..."
|
||||
node1_online=false
|
||||
node2_online=false
|
||||
both_instances_online=false
|
||||
time_zt_node1_start=$(date +%s)
|
||||
time_zt_node2_start=$(date +%s)
|
||||
|
||||
for ((s = 0; s <= $MAX_WAIT_SECS; s++)); do
|
||||
node1_online="$($ZT1 -j info | jq '.online' 2>/dev/null)"
|
||||
node2_online="$($ZT2 -j info | jq '.online' 2>/dev/null)"
|
||||
echo "Checking for online status: try #$s, node1:$node1_online, node2:$node2_online"
|
||||
if [[ "$node2_online" == "true" && "$node1_online" == "true" ]]; then
|
||||
export both_instances_online=true
|
||||
export time_to_both_nodes_online=$(date +%s)
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo -e "\n\nContents of ZeroTier home paths:"
|
||||
|
||||
ls -lga node1
|
||||
tree node1
|
||||
ls -lga node2
|
||||
tree node2
|
||||
|
||||
echo -e "\n\nRunning ZeroTier processes:"
|
||||
echo -e "\nNode 1:\n"
|
||||
$NS1 ps aux | grep zerotier-one
|
||||
echo -e "\nNode 2:\n"
|
||||
$NS2 ps aux | grep zerotier-one
|
||||
|
||||
echo -e "\n\nStatus of each instance:"
|
||||
|
||||
echo -e "\n\nNode 1:\n"
|
||||
$ZT1 status
|
||||
echo -e "\n\nNode 2:\n"
|
||||
$ZT2 status
|
||||
|
||||
if [[ "$both_instances_online" != "true" ]]; then
|
||||
exit_test_and_generate_report $TEST_FAIL "one or more nodes failed to come online"
|
||||
fi
|
||||
|
||||
echo -e "\nJoining networks"
|
||||
|
||||
$ZT1 join $TEST_NETWORK
|
||||
$ZT2 join $TEST_NETWORK
|
||||
|
||||
sleep 10
|
||||
|
||||
node1_ip4=$($ZT1 get $TEST_NETWORK ip4)
|
||||
node2_ip4=$($ZT2 get $TEST_NETWORK ip4)
|
||||
|
||||
echo "node1_ip4=$node1_ip4"
|
||||
echo "node2_ip4=$node2_ip4"
|
||||
|
||||
echo -e "\nPinging each node"
|
||||
|
||||
PING12_FILENAME="$TEST_FILEPATH_PREFIX-ping-1-to-2.txt"
|
||||
PING21_FILENAME="$TEST_FILEPATH_PREFIX-ping-2-to-1.txt"
|
||||
|
||||
$NS1 ping -c 16 $node2_ip4 >$PING12_FILENAME
|
||||
$NS2 ping -c 16 $node1_ip4 >$PING21_FILENAME
|
||||
|
||||
ping_loss_percent_1_to_2=$(cat $PING12_FILENAME |
|
||||
grep "packet loss" | awk '{print $6}' | sed 's/%//')
|
||||
ping_loss_percent_2_to_1=$(cat $PING21_FILENAME |
|
||||
grep "packet loss" | awk '{print $6}' | sed 's/%//')
|
||||
|
||||
# Normalize loss value
|
||||
export ping_loss_percent_1_to_2=$(echo "scale=2; $ping_loss_percent_1_to_2/100.0" | bc)
|
||||
export ping_loss_percent_2_to_1=$(echo "scale=2; $ping_loss_percent_2_to_1/100.0" | bc)
|
||||
|
||||
################################################################################
|
||||
# CLI Check #
|
||||
################################################################################
|
||||
|
||||
echo "Testing basic CLI functionality..."
|
||||
|
||||
spam_cli 10
|
||||
|
||||
$ZT1 join $TEST_NETWORK
|
||||
|
||||
$ZT1 -h
|
||||
$ZT1 -v
|
||||
$ZT1 status
|
||||
$ZT1 info
|
||||
$ZT1 listnetworks
|
||||
$ZT1 peers
|
||||
$ZT1 listpeers
|
||||
|
||||
$ZT1 -j status
|
||||
$ZT1 -j info
|
||||
$ZT1 -j listnetworks
|
||||
$ZT1 -j peers
|
||||
$ZT1 -j listpeers
|
||||
|
||||
$ZT1 dump
|
||||
|
||||
$ZT1 get $TEST_NETWORK allowDNS
|
||||
$ZT1 get $TEST_NETWORK allowDefault
|
||||
$ZT1 get $TEST_NETWORK allowGlobal
|
||||
$ZT1 get $TEST_NETWORK allowManaged
|
||||
$ZT1 get $TEST_NETWORK bridge
|
||||
$ZT1 get $TEST_NETWORK broadcastEnabled
|
||||
$ZT1 get $TEST_NETWORK dhcp
|
||||
$ZT1 get $TEST_NETWORK id
|
||||
$ZT1 get $TEST_NETWORK mac
|
||||
$ZT1 get $TEST_NETWORK mtu
|
||||
$ZT1 get $TEST_NETWORK name
|
||||
$ZT1 get $TEST_NETWORK netconfRevision
|
||||
$ZT1 get $TEST_NETWORK nwid
|
||||
$ZT1 get $TEST_NETWORK portDeviceName
|
||||
$ZT1 get $TEST_NETWORK portError
|
||||
$ZT1 get $TEST_NETWORK status
|
||||
$ZT1 get $TEST_NETWORK type
|
||||
|
||||
# Test an invalid command
|
||||
$ZT1 get $TEST_NETWORK derpderp
|
||||
|
||||
# TODO: Validate JSON
|
||||
|
||||
# Performance Test
|
||||
|
||||
export FILENAME_PERF_JSON="$TEST_FILEPATH_PREFIX-iperf.json"
|
||||
|
||||
echo -e "\nBeginning performance test:"
|
||||
|
||||
echo -e "\nStarting server:"
|
||||
|
||||
echo "$NS1 iperf3 -s &"
|
||||
sleep 1
|
||||
|
||||
echo -e "\nStarting client:"
|
||||
sleep 1
|
||||
|
||||
echo "$NS2 iperf3 --json -c $node1_ip4 > $FILENAME_PERF_JSON"
|
||||
|
||||
cat $FILENAME_PERF_JSON
|
||||
|
||||
# Let ZeroTier idle long enough for various timers
|
||||
|
||||
echo -e "\nIdling ZeroTier for $RUN_LENGTH seconds..."
|
||||
sleep $RUN_LENGTH
|
||||
|
||||
echo -e "\nLeaving networks"
|
||||
|
||||
$ZT1 leave $TEST_NETWORK
|
||||
$ZT2 leave $TEST_NETWORK
|
||||
|
||||
sleep 5
|
||||
|
||||
exit_test_and_generate_report $TEST_OK "completed test"
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Generate report #
|
||||
################################################################################
|
||||
|
||||
exit_test_and_generate_report() {
|
||||
|
||||
echo -e "\nStopping memory check..."
|
||||
sudo pkill -15 -f valgrind
|
||||
sleep 10
|
||||
|
||||
time_test_end=$(date +%s)
|
||||
|
||||
echo "Exiting test with reason: $2 ($1)"
|
||||
|
||||
# Collect ZeroTier dump files
|
||||
|
||||
echo -e "\nCollecting ZeroTier dump files"
|
||||
|
||||
node1_id=$($ZT1 -j status | jq -r .address)
|
||||
node2_id=$($ZT2 -j status | jq -r .address)
|
||||
|
||||
$ZT1 dump
|
||||
mv zerotier_dump.txt "$TEST_FILEPATH_PREFIX-node-dump-$node1_id.txt"
|
||||
|
||||
$ZT2 dump
|
||||
mv zerotier_dump.txt "$TEST_FILEPATH_PREFIX-node-dump-$node2_id.txt"
|
||||
|
||||
# Copy ZeroTier stdout/stderr logs
|
||||
|
||||
cp node_1.log "$TEST_FILEPATH_PREFIX-node-log-$node1_id.txt"
|
||||
cp node_2.log "$TEST_FILEPATH_PREFIX-node-log-$node2_id.txt"
|
||||
|
||||
# Generate report
|
||||
|
||||
cat $FILENAME_MEMORY_LOG
|
||||
|
||||
DEFINITELY_LOST=$(xmlstarlet sel -t -v '/valgrindoutput/error/xwhat' \
|
||||
$FILENAME_MEMORY_LOG | grep "definitely" | awk '{print $1;}')
|
||||
POSSIBLY_LOST=$(xmlstarlet sel -t -v '/valgrindoutput/error/xwhat' \
|
||||
$FILENAME_MEMORY_LOG | grep "possibly" | awk '{print $1;}')
|
||||
|
||||
# Generate coverage report artifact and summary
|
||||
|
||||
FILENAME_COVERAGE_JSON="$TEST_FILEPATH_PREFIX-coverage.json"
|
||||
FILENAME_COVERAGE_HTML="$TEST_FILEPATH_PREFIX-coverage.html"
|
||||
|
||||
echo -e "\nGenerating coverage test report..."
|
||||
|
||||
gcovr -r . --exclude ext --json-summary $FILENAME_COVERAGE_JSON \
|
||||
--html >$FILENAME_COVERAGE_HTML
|
||||
|
||||
cat $FILENAME_COVERAGE_JSON
|
||||
|
||||
COVERAGE_LINE_COVERED=$(cat $FILENAME_COVERAGE_JSON | jq .line_covered)
|
||||
COVERAGE_LINE_TOTAL=$(cat $FILENAME_COVERAGE_JSON | jq .line_total)
|
||||
COVERAGE_LINE_PERCENT=$(cat $FILENAME_COVERAGE_JSON | jq .line_percent)
|
||||
|
||||
COVERAGE_LINE_COVERED="${COVERAGE_LINE_COVERED:-0}"
|
||||
COVERAGE_LINE_TOTAL="${COVERAGE_LINE_TOTAL:-0}"
|
||||
COVERAGE_LINE_PERCENT="${COVERAGE_LINE_PERCENT:-0}"
|
||||
|
||||
# Default values
|
||||
|
||||
DEFINITELY_LOST="${DEFINITELY_LOST:-0}"
|
||||
POSSIBLY_LOST="${POSSIBLY_LOST:-0}"
|
||||
ping_loss_percent_1_to_2="${ping_loss_percent_1_to_2:-100.0}"
|
||||
ping_loss_percent_2_to_1="${ping_loss_percent_2_to_1:-100.0}"
|
||||
time_to_both_nodes_online="${time_to_both_nodes_online:--1}"
|
||||
|
||||
# Summarize and emit json for trend reporting
|
||||
|
||||
FILENAME_SUMMARY="$TEST_FILEPATH_PREFIX-summary.json"
|
||||
|
||||
time_length_test=$((time_test_end - time_test_start))
|
||||
if [[ $time_to_both_nodes_online != -1 ]];
|
||||
then
|
||||
time_to_both_nodes_online=$((time_to_both_nodes_online - time_test_start))
|
||||
fi
|
||||
#time_length_zt_join=$((time_zt_join_end-time_zt_join_start))
|
||||
#time_length_zt_leave=$((time_zt_leave_end-time_zt_leave_start))
|
||||
#time_length_zt_can_still_ping=$((time_zt_can_still_ping-time_zt_leave_start))
|
||||
|
||||
summary=$(
|
||||
cat <<EOF
|
||||
{
|
||||
"version":"$ZTO_VER",
|
||||
"commit":"$ZTO_COMMIT",
|
||||
"arch_m":"$(uname -m)",
|
||||
"arch_a":"$(uname -a)",
|
||||
"binary_size":"$(stat -c %s zerotier-one)",
|
||||
"time_length_test":$time_length_test,
|
||||
"time_to_both_nodes_online":$time_to_both_nodes_online,
|
||||
"num_possible_bytes_lost": $POSSIBLY_LOST,
|
||||
"num_definite_bytes_lost": $DEFINITELY_LOST,
|
||||
"num_bad_formattings": $POSSIBLY_LOST,
|
||||
"coverage_lines_covered": $COVERAGE_LINE_COVERED,
|
||||
"coverage_lines_total": $COVERAGE_LINE_TOTAL,
|
||||
"coverage_lines_percent": $COVERAGE_LINE_PERCENT,
|
||||
"ping_loss_percent_1_to_2": $ping_loss_percent_1_to_2,
|
||||
"ping_loss_percent_2_to_1": $ping_loss_percent_2_to_1,
|
||||
"test_exit_code": $1,
|
||||
"test_exit_reason":"$2"
|
||||
}
|
||||
EOF
|
||||
)
|
||||
|
||||
echo $summary >$FILENAME_SUMMARY
|
||||
cat $FILENAME_SUMMARY
|
||||
|
||||
exit 0
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# CLI Check #
|
||||
################################################################################
|
||||
|
||||
spam_cli() {
|
||||
echo "Spamming CLI..."
|
||||
# Rapidly spam the CLI with joins/leaves
|
||||
|
||||
MAX_TRIES="${1:-10}"
|
||||
|
||||
for ((s = 0; s <= MAX_TRIES; s++)); do
|
||||
$ZT1 status
|
||||
$ZT2 status
|
||||
sleep 0.1
|
||||
done
|
||||
|
||||
SPAM_TRIES=128
|
||||
|
||||
for ((s = 0; s <= SPAM_TRIES; s++)); do
|
||||
$ZT1 join $TEST_NETWORK
|
||||
done
|
||||
|
||||
for ((s = 0; s <= SPAM_TRIES; s++)); do
|
||||
$ZT1 leave $TEST_NETWORK
|
||||
done
|
||||
|
||||
for ((s = 0; s <= SPAM_TRIES; s++)); do
|
||||
$ZT1 leave $TEST_NETWORK
|
||||
$ZT1 join $TEST_NETWORK
|
||||
done
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Check for proper exit on load of invalid identity #
|
||||
################################################################################
|
||||
|
||||
check_exit_on_invalid_identity() {
|
||||
echo "Checking ZeroTier exits on invalid identity..."
|
||||
mkdir -p $(pwd)/exit_test
|
||||
ZT1="sudo ./zerotier-one -p9999 $(pwd)/exit_test"
|
||||
echo "asdfasdfasdfasdf" > $(pwd)/exit_test/identity.secret
|
||||
echo "asdfasdfasdfasdf" > $(pwd)/exit_test/authtoken.secret
|
||||
|
||||
echo "Launch ZeroTier with an invalid identity"
|
||||
$ZT1 &
|
||||
my_pid=$!
|
||||
|
||||
echo "Waiting 5 seconds"
|
||||
sleep 5
|
||||
|
||||
# check if process is running
|
||||
kill -0 $my_pid
|
||||
if [ $? -eq 0 ]; then
|
||||
exit_test_and_generate_report $TEST_FAIL "Exit test FAILED: Process still running after being fed an invalid identity"
|
||||
fi
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Check that we're binding to the primary port for TCP/TCP6/UDP #
|
||||
################################################################################
|
||||
|
||||
check_bind_to_correct_ports() {
|
||||
PORT_NUMBER=$1
|
||||
echo "Checking bound ports:"
|
||||
sudo netstat -anp | grep "$PORT_NUMBER" | grep "zerotier"
|
||||
if [[ $(sudo netstat -anp | grep "$PORT_NUMBER" | grep "zerotier" | grep "tcp") ]];
|
||||
then
|
||||
:
|
||||
else
|
||||
exit_test_and_generate_report $TEST_FAIL "ZeroTier did not bind to tcp/$1"
|
||||
fi
|
||||
if [[ $(sudo netstat -anp | grep "$PORT_NUMBER" | grep "zerotier" | grep "tcp6") ]];
|
||||
then
|
||||
:
|
||||
else
|
||||
exit_test_and_generate_report $TEST_FAIL "ZeroTier did not bind to tcp6/$1"
|
||||
fi
|
||||
if [[ $(sudo netstat -anp | grep "$PORT_NUMBER" | grep "zerotier" | grep "udp") ]];
|
||||
then
|
||||
:
|
||||
else
|
||||
exit_test_and_generate_report $TEST_FAIL "ZeroTier did not bind to udp/$1"
|
||||
fi
|
||||
}
|
||||
|
||||
test "$@"
|
24
.github/workflows/validate-report.sh
vendored
Executable file
24
.github/workflows/validate-report.sh
vendored
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
################################################################################
|
||||
# Set exit code depending on tool reports #
|
||||
################################################################################
|
||||
|
||||
DEFINITELY_LOST=$(cat *test-results/*summary.json | jq .num_definite_bytes_lost)
|
||||
EXIT_CODE=$(cat *test-results/*summary.json | jq .exit_code)
|
||||
EXIT_REASON=$(cat *test-results/*summary.json | jq .exit_reason)
|
||||
|
||||
cat *test-results/*summary.json
|
||||
|
||||
echo -e "\nBytes of memory definitely lost: $DEFINITELY_LOST"
|
||||
|
||||
if [[ "$DEFINITELY_LOST" -gt 0 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Catch-all for other non-zero exit codes
|
||||
|
||||
if [[ "$EXIT_CODE" -gt 0 ]]; then
|
||||
echo "Test failed: $EXIT_REASON"
|
||||
exit 1
|
||||
fi
|
57
.github/workflows/validate.yml
vendored
Normal file
57
.github/workflows/validate.yml
vendored
Normal file
|
@ -0,0 +1,57 @@
|
|||
on:
|
||||
pull_request:
|
||||
push:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build_ubuntu:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: gitconfig
|
||||
run: |
|
||||
git config --global core.autocrlf input
|
||||
|
||||
- name: checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
target: x86_64-unknown-linux-gnu
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
|
||||
- name: Set up cargo cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
continue-on-error: false
|
||||
with:
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('zeroidc//Cargo.lock') }}
|
||||
shared-key: ${{ runner.os }}-cargo-
|
||||
workspaces: |
|
||||
zeroidc/
|
||||
|
||||
- name: validate-1m-linux
|
||||
env:
|
||||
CC: 'gcc'
|
||||
CXX: 'g++'
|
||||
BRANCH: ${{ github.ref_name }}
|
||||
run: |
|
||||
sudo apt update && sudo apt install -y valgrind xmlstarlet gcovr iperf3 tree
|
||||
make one ZT_COVERAGE=1 ZT_TRACE=1
|
||||
sudo chmod +x ./.github/workflows/validate-linux.sh
|
||||
sudo ./.github/workflows/validate-linux.sh
|
||||
|
||||
- name: Archive test results
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{github.sha}}-test-results
|
||||
path: "*test-results*"
|
||||
|
||||
- name: final-report
|
||||
run: |
|
||||
sudo chmod +x ./.github/workflows/validate-report.sh
|
||||
sudo ./.github/workflows/validate-report.sh
|
||||
|
27
.gitignore
vendored
27
.gitignore
vendored
|
@ -6,6 +6,11 @@
|
|||
/zerotier
|
||||
/nltest
|
||||
|
||||
# IDE stuff
|
||||
/.idea
|
||||
/.nova
|
||||
/compile_commands.json
|
||||
|
||||
# OS-created garbage files from various platforms
|
||||
.DS_Store
|
||||
.Apple*
|
||||
|
@ -30,7 +35,6 @@ Thumbs.db
|
|||
/windows/WebUIWrapper/obj
|
||||
/windows/lib
|
||||
/ext/installfiles/windows/ZeroTier One-SetupFiles
|
||||
/ext/installfiles/windows/Prerequisites
|
||||
/ext/installfiles/windows/*-cache
|
||||
/ZeroTier One.msi
|
||||
*.vcxproj.backup
|
||||
|
@ -58,7 +62,6 @@ zt1-src.tar.gz
|
|||
*.opensdf
|
||||
*.user
|
||||
*.cache
|
||||
*.obj
|
||||
*.tlog
|
||||
*.pid
|
||||
*.pkg
|
||||
|
@ -103,7 +106,6 @@ windows/ZeroTierOne/Debug/
|
|||
*.swp
|
||||
*~.nib
|
||||
DerivedData/
|
||||
build/
|
||||
*.pbxuser
|
||||
*.mode1v3
|
||||
*.mode2v3
|
||||
|
@ -114,7 +116,6 @@ build/
|
|||
!default.perspectivev3
|
||||
*.xccheckout
|
||||
xcuserdata/
|
||||
ext/librethinkdbxx/build
|
||||
.vscode
|
||||
__pycache__
|
||||
*~
|
||||
|
@ -122,3 +123,21 @@ attic/world/*.c25519
|
|||
attic/world/mkworld
|
||||
workspace/
|
||||
workspace2/
|
||||
zeroidc/target/
|
||||
tcp-proxy/target
|
||||
|
||||
#snapcraft specifics
|
||||
/parts/
|
||||
/stage/
|
||||
/prime/
|
||||
|
||||
*.snap
|
||||
|
||||
.snapcraft
|
||||
__pycache__
|
||||
*.pyc
|
||||
*_source.tar.bz2
|
||||
snap/.snapcraft
|
||||
tcp-proxy/tcp-proxy
|
||||
rustybits/target
|
||||
ext/installfiles/windows/*.back*.aip
|
||||
|
|
75
AUTHORS.md
75
AUTHORS.md
|
@ -1,75 +0,0 @@
|
|||
# Authors and Third Party Code Licensing Information
|
||||
|
||||
## Primary Authors
|
||||
|
||||
* ZeroTier Core and ZeroTier One virtual networking service<br>
|
||||
Adam Ierymenko / adam.ierymenko@zerotier.com
|
||||
Joseph Henry / joseph.henry@zerotier.com (QoS and multipath)
|
||||
|
||||
* 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
|
||||
|
||||
ZeroTier includes the following third party code, either in ext/ or incorporated into the ZeroTier core. This third party code remains licensed under its original license and is not subject to ZeroTier's BSL license.
|
||||
|
||||
* LZ4 compression algorithm by Yann Collet
|
||||
|
||||
* Files: node/Packet.cpp (bundled within anonymous namespace)
|
||||
* Home page: http://code.google.com/p/lz4/
|
||||
* License grant: BSD 2-clause
|
||||
|
||||
* http-parser by Joyent, Inc. (many authors)
|
||||
|
||||
* Files: ext/http-parser/*
|
||||
* Home page: https://github.com/joyent/http-parser/
|
||||
* License grant: MIT/Expat
|
||||
|
||||
* C++11 json (nlohmann/json) by Niels Lohmann
|
||||
|
||||
* Files: ext/json/*
|
||||
* Home page: https://github.com/nlohmann/json
|
||||
* License grant: MIT
|
||||
|
||||
* 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.* node/C25519.* node/Poly1305.*
|
||||
* Home page: http://cr.yp.to/
|
||||
* License grant: public domain
|
||||
* ZeroTier Modifications: slight cryptographically-irrelevant modifications for inclusion into ZeroTier core
|
||||
|
||||
* MiniUPNPC and libnatpmp by Thomas Bernard
|
||||
|
||||
* Files: ext/libnatpmp/* ext/miniupnpc/*
|
||||
* Home page: http://miniupnp.free.fr/
|
||||
* License grant: BSD attribution no-endorsement
|
||||
|
||||
* cpp-httplib by yhirose
|
||||
|
||||
* Files: ext/cpp-httplib/*
|
||||
* Home page: https://github.com/yhirose/cpp-httplib
|
||||
* License grant: MIT
|
2
COPYING
2
COPYING
|
@ -1,7 +1,7 @@
|
|||
ZeroTier One, an endpoint server for the ZeroTier virtual network layer.
|
||||
Copyright © 2011–2019 ZeroTier, Inc.
|
||||
|
||||
ZeroTier is released under the terms of the BSL version 1.1. See the
|
||||
ZeroTier is released under the terms of the BUSL version 1.1. See the
|
||||
file LICENSE.txt for details.
|
||||
|
||||
..
|
||||
|
|
28
Dockerfile.ci
Normal file
28
Dockerfile.ci
Normal file
|
@ -0,0 +1,28 @@
|
|||
# vim: ft=dockerfile
|
||||
|
||||
FROM ubuntu:21.04 as stage
|
||||
|
||||
RUN apt-get update -qq && apt-get -qq install make clang
|
||||
COPY . .
|
||||
RUN /usr/bin/make
|
||||
RUN echo $PWD
|
||||
RUN cp zerotier-one /usr/sbin
|
||||
|
||||
FROM ubuntu:21.04
|
||||
|
||||
COPY --from=stage /zerotier-one /usr/sbin
|
||||
RUN ln -sf /usr/sbin/zerotier-one /usr/sbin/zerotier-idtool
|
||||
RUN ln -sf /usr/sbin/zerotier-one /usr/sbin/zerotier-cli
|
||||
|
||||
RUN echo "${VERSION}" > /etc/zerotier-version
|
||||
RUN rm -rf /var/lib/zerotier-one
|
||||
|
||||
|
||||
RUN apt-get -qq update
|
||||
RUN apt-get -qq install iproute2 net-tools fping 2ping iputils-ping iputils-arping
|
||||
|
||||
COPY entrypoint.sh.release /entrypoint.sh
|
||||
RUN chmod 755 /entrypoint.sh
|
||||
|
||||
CMD []
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
23
Dockerfile.release
Normal file
23
Dockerfile.release
Normal file
|
@ -0,0 +1,23 @@
|
|||
# vim: ft=dockerfile
|
||||
|
||||
FROM debian:bookworm
|
||||
|
||||
ARG VERSION
|
||||
|
||||
RUN apt-get update -qq && apt-get install curl gpg -y
|
||||
RUN mkdir -p /usr/share/zerotier && \
|
||||
curl -o /usr/share/zerotier/tmp.asc "https://download.zerotier.com/contact%40zerotier.com.gpg" && \
|
||||
gpg --no-default-keyring --keyring /usr/share/zerotier/zerotier.gpg --import /usr/share/zerotier/tmp.asc && \
|
||||
rm -f /usr/share/zerotier/tmp.asc && \
|
||||
echo "deb [signed-by=/usr/share/zerotier/zerotier.gpg] http://download.zerotier.com/debian/bookworm bookworm main" > /etc/apt/sources.list.d/zerotier.list
|
||||
|
||||
RUN apt-get update -qq && apt-get install zerotier-one=${VERSION} curl iproute2 net-tools iputils-ping openssl libssl3 -y
|
||||
RUN rm -rf /var/lib/zerotier-one
|
||||
|
||||
COPY entrypoint.sh.release /entrypoint.sh
|
||||
RUN chmod 755 /entrypoint.sh
|
||||
|
||||
HEALTHCHECK --interval=1s CMD bash /healthcheck.sh
|
||||
|
||||
CMD []
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
365
Jenkinsfile
vendored
365
Jenkinsfile
vendored
|
@ -1,365 +0,0 @@
|
|||
pipeline {
|
||||
options {
|
||||
disableConcurrentBuilds()
|
||||
preserveStashes(buildCount: 10)
|
||||
timestamps()
|
||||
}
|
||||
parameters {
|
||||
booleanParam(name: "BUILD_ALL", defaultValue: false, description: "Build all supported platform/architecture combos. Defaults to x86/x64 only")
|
||||
}
|
||||
|
||||
agent none
|
||||
|
||||
stages {
|
||||
stage ("Build") {
|
||||
steps {
|
||||
script {
|
||||
def tasks = [:]
|
||||
tasks << buildStaticBinaries()
|
||||
tasks << buildDebianNative()
|
||||
tasks << buildCentosNative()
|
||||
|
||||
parallel tasks
|
||||
}
|
||||
}
|
||||
}
|
||||
stage ("Package Static") {
|
||||
steps {
|
||||
script {
|
||||
parallel packageStatic()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def buildStaticBinaries() {
|
||||
def tasks = [:]
|
||||
def dist = ["alpine"]
|
||||
def archs = []
|
||||
if (params.BUILD_ALL == true) {
|
||||
archs = ["arm64", "amd64", "i386", "armhf", "armel", "ppc64le", "s390x"]
|
||||
} else {
|
||||
archs = ["amd64", "i386"]
|
||||
}
|
||||
|
||||
tasks << getTasks(dist, archs, { distro, platform ->
|
||||
def myNode = {
|
||||
node ('linux-build') {
|
||||
dir ("build") {
|
||||
checkout scm
|
||||
}
|
||||
sh "echo ${distro}-${platform}"
|
||||
def runtime = docker.image("ztbuild/${distro}-${platform}:latest")
|
||||
runtime.inside {
|
||||
dir("build") {
|
||||
sh 'make -j8 ZT_STATIC=1 all'
|
||||
sh "file ./zerotier-one"
|
||||
sh "mv zerotier-one zerotier-one-static-${platform}"
|
||||
stash includes: 'zerotier-one-static-*', name: "static-${platform}"
|
||||
}
|
||||
cleanWs deleteDirs: true, disableDeferredWipeout: true, notFailBuild: true
|
||||
}
|
||||
}
|
||||
}
|
||||
return myNode
|
||||
})
|
||||
|
||||
return tasks
|
||||
}
|
||||
|
||||
def getTasks(axisDistro, axisPlatform, task) {
|
||||
def tasks = [:]
|
||||
for(int i=0; i< axisDistro.size(); i++) {
|
||||
def axisDistroValue = axisDistro[i]
|
||||
for(int j=0; j< axisPlatform.size(); j++) {
|
||||
def axisPlatformValue = axisPlatform[j]
|
||||
tasks["${axisDistroValue}/${axisPlatformValue}"] = task(axisDistroValue, axisPlatformValue)
|
||||
}
|
||||
}
|
||||
return tasks
|
||||
}
|
||||
|
||||
def packageStatic() {
|
||||
def tasks = [:]
|
||||
|
||||
def centos6 = ["centos6"]
|
||||
def centos6Arch = ["i386", "amd64"]
|
||||
tasks << getTasks(centos6, centos6Arch, { distro, arch ->
|
||||
def myNode = {
|
||||
node ('linux-build') {
|
||||
dir ("build") {
|
||||
checkout scm
|
||||
}
|
||||
def runtime = docker.image("ztbuild/${distro}-${arch}:latest")
|
||||
runtime.inside {
|
||||
dir("build") {
|
||||
unstash "static-${arch}"
|
||||
sh "mv zerotier-one-static-${arch} zerotier-one && chmod +x zerotier-one"
|
||||
sh "make redhat"
|
||||
sh "mkdir -p ${distro}"
|
||||
sh "cp -av `find ~/rpmbuild/ -type f -name \"*.rpm\"` ${distro}/"
|
||||
archiveArtifacts artifacts: "${distro}/*.rpm", onlyIfSuccessful: true
|
||||
}
|
||||
}
|
||||
cleanWs deleteDirs: true, disableDeferredWipeout: true, notFailBuild: true
|
||||
}
|
||||
}
|
||||
return myNode
|
||||
})
|
||||
|
||||
def centos7 = ["centos7"]
|
||||
def centos7Arch = ["i386"]
|
||||
tasks << getTasks(centos7, centos7Arch, { distro, arch ->
|
||||
def myNode = {
|
||||
node ('linux-build') {
|
||||
dir ("build") {
|
||||
checkout scm
|
||||
}
|
||||
def runtime = docker.image("ztbuild/${distro}-${arch}:latest")
|
||||
runtime.inside {
|
||||
dir("build") {
|
||||
unstash "static-${arch}"
|
||||
sh "mv zerotier-one-static-${arch} zerotier-one && chmod +x zerotier-one"
|
||||
sh "make redhat"
|
||||
sh "mkdir -p ${distro}"
|
||||
sh "cp -av `find ~/rpmbuild/ -type f -name \"*.rpm\"` ${distro}/"
|
||||
archiveArtifacts artifacts: "${distro}/*.rpm", onlyIfSuccessful: true
|
||||
}
|
||||
}
|
||||
cleanWs deleteDirs: true, disableDeferredWipeout: true, notFailBuild: true
|
||||
}
|
||||
}
|
||||
return myNode
|
||||
})
|
||||
|
||||
if (params.BUILD_ALL == true) {
|
||||
def clefos7 = ["clefos"]
|
||||
def clefos7Arch = ["s390x"]
|
||||
tasks << getTasks(clefos7, clefos7Arch, { distro, arch ->
|
||||
def myNode = {
|
||||
node ('linux-build') {
|
||||
dir ("build") {
|
||||
checkout scm
|
||||
}
|
||||
def runtime = docker.image("ztbuild/${distro}-${arch}:latest")
|
||||
runtime.inside {
|
||||
dir("build/") {
|
||||
unstash "static-${arch}"
|
||||
sh "mv zerotier-one-static-${arch} zerotier-one && chmod +x zerotier-one"
|
||||
sh "make redhat"
|
||||
sh "mkdir -p ${distro}"
|
||||
sh "cp -av `find ~/rpmbuild/ -type f -name \"*.rpm\"` ${distro}/"
|
||||
archiveArtifacts artifacts: "${distro}/*.rpm", onlyIfSuccessful: true
|
||||
}
|
||||
}
|
||||
cleanWs deleteDirs: true, disableDeferredWipeout: true, notFailBuild: true
|
||||
}
|
||||
}
|
||||
return myNode
|
||||
})
|
||||
}
|
||||
|
||||
def debianJessie = ["debian-jessie"]
|
||||
def debianJessieArchs = []
|
||||
if (params.BUILD_ALL == true) {
|
||||
debianJessieArch = ["armhf", "armel", "amd64", "i386"]
|
||||
} else {
|
||||
debianJessieArch = ["amd64", "i386"]
|
||||
}
|
||||
tasks << getTasks(debianJessie, debianJessieArch, { distro, arch ->
|
||||
def myNode = {
|
||||
node ('linux-build') {
|
||||
dir ("build") {
|
||||
checkout scm
|
||||
}
|
||||
def runtime = docker.image("ztbuild/${distro}-${arch}:latest")
|
||||
runtime.inside {
|
||||
sh "ls -la ."
|
||||
dir('build/') {
|
||||
sh "ls -la ."
|
||||
unstash "static-${arch}"
|
||||
sh "pwd"
|
||||
sh "mv zerotier-one-static-${arch} zerotier-one && chmod +x zerotier-one && file ./zerotier-one"
|
||||
sh "mv -f debian/rules.static debian/rules"
|
||||
sh "make debian"
|
||||
}
|
||||
sh "mkdir -p ${distro}"
|
||||
sh "mv *.deb ${distro}"
|
||||
archiveArtifacts artifacts: "${distro}/*.deb", onlyIfSuccessful: true
|
||||
}
|
||||
cleanWs deleteDirs: true, disableDeferredWipeout: true, notFailBuild: true
|
||||
}
|
||||
}
|
||||
return myNode
|
||||
})
|
||||
|
||||
def ubuntuTrusty = ["ubuntu-trusty"]
|
||||
def ubuntuTrustyArch = []
|
||||
if (params.BUILD_ALL == true) {
|
||||
ubuntuTrustyArch = ["i386", "amd64", "armhf", "arm64", "ppc64le"]
|
||||
} else {
|
||||
ubuntuTrustyArch = ["i386", "amd64"]
|
||||
}
|
||||
tasks << getTasks(ubuntuTrusty, ubuntuTrustyArch, { distro, arch ->
|
||||
def myNode = {
|
||||
node ('linux-build') {
|
||||
dir ("build") {
|
||||
checkout scm
|
||||
}
|
||||
def runtime = docker.image("ztbuild/${distro}-${arch}:latest")
|
||||
runtime.inside {
|
||||
sh "ls -la ."
|
||||
dir('build/') {
|
||||
sh "ls -la ."
|
||||
unstash "static-${arch}"
|
||||
sh "pwd"
|
||||
sh "mv zerotier-one-static-${arch} zerotier-one && chmod +x zerotier-one && file ./zerotier-one"
|
||||
sh "mv -f debian/rules.static debian/rules"
|
||||
sh "make debian"
|
||||
}
|
||||
sh "mkdir -p ${distro}"
|
||||
sh "mv *.deb ${distro}"
|
||||
archiveArtifacts artifacts: "${distro}/*.deb", onlyIfSuccessful: true
|
||||
}
|
||||
cleanWs deleteDirs: true, disableDeferredWipeout: true, notFailBuild: true
|
||||
}
|
||||
}
|
||||
return myNode
|
||||
})
|
||||
|
||||
def debianWheezy = ["debian-wheezy"]
|
||||
def debianWheezyArchs = []
|
||||
if (params.BUILD_ALL == true) {
|
||||
debianWheezyArchs = ["armhf", "armel", "amd64", "i386"]
|
||||
} else {
|
||||
debianWheezyArchs = ["amd64", "i386"]
|
||||
}
|
||||
tasks << getTasks(debianJessie, debianJessieArch, { distro, arch ->
|
||||
def myNode = {
|
||||
node ('linux-build') {
|
||||
dir ("build") {
|
||||
checkout scm
|
||||
}
|
||||
def runtime = docker.image("ztbuild/${distro}-${arch}:latest")
|
||||
runtime.inside {
|
||||
dir('build/') {
|
||||
unstash "static-${arch}"
|
||||
sh "mv zerotier-one-static-${arch} zerotier-one && chmod +x zerotier-one && file ./zerotier-one"
|
||||
sh "mv -f debian/rules.wheezy.static debian/rules"
|
||||
sh "mv -f debian/control.wheezy debian/control"
|
||||
sh "make debian"
|
||||
}
|
||||
sh "mkdir -p ${distro}"
|
||||
sh "mv *.deb ${distro}"
|
||||
archiveArtifacts artifacts: "${distro}/*.deb", onlyIfSuccessful: true
|
||||
}
|
||||
cleanWs deleteDirs: true, disableDeferredWipeout: true, notFailBuild: true
|
||||
}
|
||||
}
|
||||
return myNode
|
||||
})
|
||||
|
||||
return tasks
|
||||
}
|
||||
|
||||
def buildDebianNative() {
|
||||
def tasks = [:]
|
||||
def buster = ["debian-buster", "debian-stretch", "debian-bullseye", "debian-sid"]
|
||||
def busterArchs = []
|
||||
if (params.BUILD_ALL) {
|
||||
busterArchs = ["s390x", "ppc64le", "i386", "armhf", "armel", "arm64", "amd64"]
|
||||
} else {
|
||||
busterArchs = ["amd64", "i386"]
|
||||
}
|
||||
|
||||
def build = { distro, arch ->
|
||||
def myNode = {
|
||||
node ('linux-build') {
|
||||
dir ("build") {
|
||||
checkout scm
|
||||
}
|
||||
def runtime = docker.image("ztbuild/${distro}-${arch}:latest")
|
||||
runtime.inside {
|
||||
dir("build") {
|
||||
sh 'make debian'
|
||||
}
|
||||
sh "mkdir -p ${distro}"
|
||||
sh "mv *.deb ${distro}"
|
||||
archiveArtifacts artifacts: "${distro}/*.deb", onlyIfSuccessful: true
|
||||
cleanWs deleteDirs: true, disableDeferredWipeout: true, notFailBuild: true
|
||||
}
|
||||
}
|
||||
}
|
||||
return myNode
|
||||
}
|
||||
|
||||
tasks << getTasks(buster, busterArchs, build)
|
||||
|
||||
// bash is broken when running under QEMU-s390x on Xenial
|
||||
def xenial = ["ubuntu-xenial"]
|
||||
def xenialArchs = []
|
||||
if (params.BUILD_ALL == true) {
|
||||
xenialArchs = ["i386", "amd64", "armhf", "arm64", "ppc64le"]
|
||||
} else {
|
||||
xenialArchs = ["i386", "amd64"]
|
||||
}
|
||||
tasks << getTasks(xenial, xenialArchs, build)
|
||||
|
||||
def ubuntu = ["ubuntu-bionic", "ubuntu-eoan"]
|
||||
def ubuntuArchs = []
|
||||
if (params.BUILD_ALL == true) {
|
||||
ubuntuArchs = ["i386", "amd64", "armhf", "arm64", "ppc64le", "s390x"]
|
||||
} else {
|
||||
ubuntuArchs = ["i386", "amd64"]
|
||||
}
|
||||
tasks << getTasks(ubuntu, ubuntuArchs, build)
|
||||
|
||||
def kali = ["kali-rolling"]
|
||||
def kaliArchs = ["amd64"]
|
||||
tasks << getTasks(kali, kaliArchs, build)
|
||||
|
||||
return tasks
|
||||
}
|
||||
|
||||
def buildCentosNative() {
|
||||
def tasks = [:]
|
||||
|
||||
def build = { distro, arch ->
|
||||
def myNode = {
|
||||
node ('linux-build') {
|
||||
dir ("build") {
|
||||
checkout scm
|
||||
}
|
||||
def runtime = docker.image("ztbuild/${distro}-${arch}:latest")
|
||||
runtime.inside {
|
||||
dir("build") {
|
||||
sh 'make -j4'
|
||||
sh 'make redhat'
|
||||
sh "mkdir -p ${distro}"
|
||||
sh "cp -av `find ~/rpmbuild/ -type f -name \"*.rpm\"` ${distro}/"
|
||||
archiveArtifacts artifacts: "${distro}/*.rpm", onlyIfSuccessful: true
|
||||
}
|
||||
|
||||
cleanWs deleteDirs: true, disableDeferredWipeout: true, notFailBuild: true
|
||||
}
|
||||
}
|
||||
}
|
||||
return myNode
|
||||
}
|
||||
|
||||
def centos8 = ["centos8"]
|
||||
def centos8Archs = []
|
||||
if (params.BUILD_ALL == true) {
|
||||
centos8Archs = ["amd64", "arm64", "ppc64le"]
|
||||
} else {
|
||||
centos8Archs = ["amd64"]
|
||||
}
|
||||
tasks << getTasks(centos8, centos8Archs, build)
|
||||
|
||||
def centos7 = ["centos7"]
|
||||
def centos7Archs = ["amd64"]
|
||||
tasks << getTasks(centos7, centos7Archs, build)
|
||||
|
||||
return tasks
|
||||
}
|
|
@ -26,7 +26,7 @@ Additional Use Grant: You may make use of the Licensed Work, provided you
|
|||
ZeroTier behind the scenes to operate a service not
|
||||
related to ZeroTier network administration.
|
||||
|
||||
* Create Non-Open-Source Commercial Derviative Works
|
||||
* Create Non-Open-Source Commercial Derivative Works
|
||||
|
||||
(2) Link or directly include the Licensed Work in a
|
||||
commercial or for-profit application or other product
|
||||
|
@ -47,7 +47,7 @@ Additional Use Grant: You may make use of the Licensed Work, provided you
|
|||
services, social welfare, senior care, child care, and
|
||||
the care of persons with disabilities.
|
||||
|
||||
Change Date: 2025-01-01
|
||||
Change Date: 2026-01-01
|
||||
|
||||
Change License: Apache License version 2.0 as published by the Apache
|
||||
Software Foundation
|
||||
|
|
12
Makefile
12
Makefile
|
@ -17,8 +17,8 @@ ifeq ($(OSTYPE),FreeBSD)
|
|||
include make-bsd.mk
|
||||
endif
|
||||
ifeq ($(OSTYPE),OpenBSD)
|
||||
CC=egcc
|
||||
CXX=eg++
|
||||
CC=clang
|
||||
CXX=clang++
|
||||
ZT_BUILD_PLATFORM=9
|
||||
include make-bsd.mk
|
||||
endif
|
||||
|
@ -26,3 +26,11 @@ endif
|
|||
ifeq ($(OSTYPE),NetBSD)
|
||||
include make-netbsd.mk
|
||||
endif
|
||||
|
||||
drone:
|
||||
@echo "rendering .drone.yaml from .drone.jsonnet"
|
||||
drone jsonnet --format --stream
|
||||
drone sign zerotier/ZeroTierOne --save
|
||||
|
||||
clang-format:
|
||||
find node osdep service tcp-proxy controller -iname '*.cpp' -o -iname '*.hpp' | xargs clang-format -i
|
||||
|
|
|
@ -14,7 +14,7 @@ The version must be incremented in all of the following files:
|
|||
/debian/changelog
|
||||
/ext/installfiles/mac/ZeroTier One.pkgproj
|
||||
/ext/installfiles/windows/ZeroTier One.aip
|
||||
/windows/WinUI/AboutView.xaml
|
||||
../DesktopUI/mac-app-template/ZeroTier.app/Contents/Info.plist
|
||||
|
||||
The final .AIP file can only be edited on Windows with [Advanced Installer Enterprise](http://www.advancedinstaller.com/). In addition to incrementing the version be sure that a new product code is generated. (The "upgrade code" GUID on the other hand must never change.)
|
||||
|
||||
|
@ -30,4 +30,4 @@ You will need [Packages](http://s.sudre.free.fr/Software/Packages/about.html) an
|
|||
|
||||
## Windows
|
||||
|
||||
First load the Visual Studio solution and rebuild the UI and ZeroTier One in both x64 and i386 `Release` mode. Then load [Advanced Installer Enterprise](http://www.advancedinstaller.com/), check that the version is correct, and build. The build will fail if any build artifacts are missing, and Windows must have our product singing key (from DigiCert) available to sign the resulting MSI file. The MSI must then be tested on at least a few different CLEAN Windows VMs to ensure that the installer is valid and properly signed.
|
||||
First load the Visual Studio solution and rebuild the UI and ZeroTier One in both x64, i386, and arm64 `Release` mode. Then load [Advanced Installer Enterprise](http://www.advancedinstaller.com/), check that the version is correct, and build. The build will fail if any build artifacts are missing, and Windows must have our product singing key (from DigiCert) available to sign the resulting MSI file. The MSI must then be tested on at least a few different CLEAN Windows VMs to ensure that the installer is valid and properly signed.
|
||||
|
|
73
README.docker.md
Normal file
73
README.docker.md
Normal file
|
@ -0,0 +1,73 @@
|
|||
# ZeroTier One in a container!
|
||||
|
||||
**NOTE:** _Most of this information pertains to the docker image only. For more information about ZeroTier, check out the repository_: [here](https://github.com/zerotier/ZeroTierOne) or the [commercial website](https://www.zerotier.com).
|
||||
|
||||
[ZeroTier](https://www.zerotier.com) is a smart programmable Ethernet switch for planet Earth. It allows all networked devices, VMs, containers, and applications to communicate as if they all reside in the same physical data center or cloud region.
|
||||
|
||||
This is accomplished by combining a cryptographically addressed and secure peer to peer network (termed VL1) with an Ethernet emulation layer somewhat similar to VXLAN (termed VL2). Our VL2 Ethernet virtualization layer includes advanced enterprise SDN features like fine grained access control rules for network micro-segmentation and security monitoring.
|
||||
|
||||
All ZeroTier traffic is encrypted end-to-end using secret keys that only you control. Most traffic flows peer to peer, though we offer free (but slow) relaying for users who cannot establish peer to peer connections.
|
||||
|
||||
The goals and design principles of ZeroTier are inspired by among other things the original [Google BeyondCorp](https://static.googleusercontent.com/media/research.google.com/en//pubs/archive/43231.pdf) paper and the [Jericho Forum](https://en.wikipedia.org/wiki/Jericho_Forum) with its notion of "deperimeterization."
|
||||
|
||||
Visit [ZeroTier's site](https://www.zerotier.com/) for more information and [pre-built binary packages](https://www.zerotier.com/download/). Apps for Android and iOS are available for free in the Google Play and Apple app stores.
|
||||
|
||||
ZeroTier is licensed under the [BSL version 1.1](https://mariadb.com/bsl11/). See [LICENSE.txt](https://github.com/zerotier/ZeroTierOne/blob/master/LICENSE.txt) and the [ZeroTier pricing page](https://www.zerotier.com/pricing) for details. ZeroTier is free to use internally in businesses and academic institutions and for non-commercial purposes. Certain types of commercial use such as building closed-source apps and devices based on ZeroTier or offering ZeroTier network controllers and network management as a SaaS service require a commercial license.
|
||||
|
||||
A small amount of third party code is also included in ZeroTier and is not subject to our BSL license. See [AUTHORS.md](https://github.com/zerotier/ZeroTierOne/blob/master/AUTHORS.md) for a list of third party code, where it is included, and the licenses that apply to it. All of the third party code in ZeroTier is liberally licensed (MIT, BSD, Apache, public domain, etc.).
|
||||
|
||||
## Building the docker image
|
||||
|
||||
Due to the network being a substrate for most applications and not an application unto itself, it makes sense that many people would want to build their own image based on our formula.
|
||||
|
||||
The image is based on `debian:buster`.
|
||||
|
||||
The `Dockerfile.release` file contains build instructions for building the described image in the rest of the README. The build is multi-arch and multi-release capable.
|
||||
|
||||
These build arguments power the build:
|
||||
|
||||
- `PACKAGE_BASEURL`: The base URL of the package repository to fetch from. (default: `https://download.zerotier.com/debian/buster/pool/main/z/zerotier-one/`)
|
||||
- `ARCH`: The architecture of the package, in debian format. Must match your image arch. (default: `amd64`)
|
||||
- `VERSION`: **REQUIRED** the version of ZeroTier to fetch.
|
||||
|
||||
You can build this image like so:
|
||||
|
||||
```
|
||||
docker build -f Dockerfile.release -t mybuild --build-arg VERSION=1.6.5 .
|
||||
```
|
||||
|
||||
## Using the docker image
|
||||
|
||||
The `entrypoint.sh` in the docker image is a little different; zerotier will be spawned in the background and the "main process" is actually just a sleeping shell script. This allows `zerotier-one` to gracefully terminate in some situations largely unique to docker.
|
||||
|
||||
The `zerotier/zerotier` image requires the `CAP_NET_ADMIN` capability and the `/dev/net/tun` device must be forwarded to it.
|
||||
|
||||
To join a network, simply supply it on the command-line; you can supply multiple networks.
|
||||
|
||||
```
|
||||
docker run --name myzerotier --rm --cap-add NET_ADMIN --device /dev/net/tun zerotier/zerotier:latest abcdefdeadbeef00
|
||||
```
|
||||
|
||||
Once joining all the networks you have provided, it will sleep until terminated. Note that in ZeroTier, joining a network does not necessarily mean you have an IP or can do anything, really. You will want to probe the control socket:
|
||||
|
||||
```
|
||||
docker exec myzerotier zerotier-cli listnetworks
|
||||
```
|
||||
|
||||
To ensure you have a network available before trying to listen on it. Without pre-configuring the identity, this usually means going to the central admin panel and clicking the checkmark against your zerotier identity.
|
||||
|
||||
### Environment Variables
|
||||
|
||||
You can control a few settings including the identity used and the authtoken used to interact with the control socket (which you can forward and access through `localhost:9993`).
|
||||
|
||||
- `ZEROTIER_JOIN_NETWORKS`: additional way to set networks to join.
|
||||
- `ZEROTIER_API_SECRET`: replaces the `authtoken.secret` before booting and allows you to manage the control socket's authentication key.
|
||||
- `ZEROTIER_IDENTITY_PUBLIC`: the `identity.public` file for zerotier-one. Use `zerotier-idtool` to generate one of these for you.
|
||||
- `ZEROTIER_IDENTITY_SECRET`: the `identity.secret` file for zerotier-one. Use `zerotier-idtool` to generate one of these for you.
|
||||
- `ZEROTIER_LOCAL_CONF`: Sets the the `local.conf` file content for zerotier-one
|
||||
|
||||
### Tips
|
||||
|
||||
- Forwarding port `<dockerip>:9993` to somewhere outside is probably a good idea for highly trafficked services.
|
||||
- Forwarding `localhost:9993` to a control network where you can drive it remotely might be a good idea, just be sure to set your authtoken properly through environment variables.
|
||||
- Pre-generating your identities could be much simpler to do via our [terraform plugin](https://github.com/zerotier/terraform-provider-zerotier)
|
125
README.md
125
README.md
|
@ -1,6 +1,8 @@
|
|||
ZeroTier - Global Area Networking
|
||||
======
|
||||
|
||||
*This document is written for a software developer audience. For information on using ZeroTier, see the: [Website](https://www.zerotier.com), [Documentation Site](https://docs.zerotier.com), and [Discussion Forum](https://discuss.zerotier.com).*
|
||||
|
||||
ZeroTier is a smart programmable Ethernet switch for planet Earth. It allows all networked devices, VMs, containers, and applications to communicate as if they all reside in the same physical data center or cloud region.
|
||||
|
||||
This is accomplished by combining a cryptographically addressed and secure peer to peer network (termed VL1) with an Ethernet emulation layer somewhat similar to VXLAN (termed VL2). Our VL2 Ethernet virtualization layer includes advanced enterprise SDN features like fine grained access control rules for network micro-segmentation and security monitoring.
|
||||
|
@ -35,30 +37,41 @@ The base path contains the ZeroTier One service main entry point (`one.cpp`), se
|
|||
- `ext/`: third party libraries, binaries that we ship for convenience on some platforms (Mac and Windows), and installation support files.
|
||||
- `include/`: include files for the ZeroTier core.
|
||||
- `java/`: a JNI wrapper used with our Android mobile app. (The whole Android app is not open source but may be made so in the future.)
|
||||
- `macui/`: a Macintosh menu-bar app for controlling ZeroTier One, written in Objective C.
|
||||
- `node/`: the ZeroTier virtual Ethernet switch core, which is designed to be entirely separate from the rest of the code and able to be built as a stand-alone OS-independent library. Note to developers: do not use C++11 features in here, since we want this to build on old embedded platforms that lack C++11 support. C++11 can be used elsewhere.
|
||||
- `osdep/`: code to support and integrate with OSes, including platform-specific stuff only built for certain targets.
|
||||
- `rule-compiler/`: JavaScript rules language compiler for defining network-level rules.
|
||||
- `service/`: the ZeroTier One service, which wraps the ZeroTier core and provides VPN-like connectivity to virtual networks for desktops, laptops, servers, VMs, and containers.
|
||||
- `windows/`: Visual Studio solution files, Windows service code, and the Windows task bar app UI.
|
||||
- `zeroidc/`: OIDC implementation used by ZeroTier service to log into SSO-enabled networks. (This part is written in Rust, and more Rust will be appearing in this repository in the future.)
|
||||
|
||||
### Contributing
|
||||
|
||||
Please do pull requests off of the `dev` branch.
|
||||
|
||||
Releases are done by merging `dev` into `main` and then tagging and doing builds.
|
||||
|
||||
### Build and Platform Notes
|
||||
|
||||
To build on Mac and Linux just type `make`. On FreeBSD and OpenBSD `gmake` (GNU make) is required and can be installed from packages or ports. For Windows there is a Visual Studio solution in `windows/`.
|
||||
|
||||
- **Mac**
|
||||
- Xcode command line tools for OSX 10.8 or newer are required.
|
||||
- Xcode command line tools for macOS 10.13 or newer are required.
|
||||
- Rust for x86_64 and ARM64 targets *if SSO is enabled in the build*.
|
||||
- **Linux**
|
||||
- The minimum compiler versions required are GCC/G++ 4.9.3 or CLANG/CLANG++ 3.4.2. (Install `clang` on CentOS 7 as G++ is too old.)
|
||||
- The minimum compiler versions required are GCC/G++ 8.x or CLANG/CLANG++ 5.x.
|
||||
- Linux makefiles automatically detect and prefer clang/clang++ if present as it produces smaller and slightly faster binaries in most cases. You can override by supplying CC and CXX variables on the make command line.
|
||||
- Rust for x86_64 and ARM64 targets *if SSO is enabled in the build*.
|
||||
- **Windows**
|
||||
- Windows 7 or newer is supported. This *may* work on Vista but isn't officially supported there. It will not work on Windows XP.
|
||||
- We build with Visual Studio 2017. Older versions may not work. Clang or MinGW will also probably work but may require some makefile hacking.
|
||||
- Visual Studio 2022 on Windows 10 or newer.
|
||||
- Rust for x86_64 and ARM64 targets *if SSO is enabled in the build*.
|
||||
- **FreeBSD**
|
||||
- GNU make is required. Type `gmake` to build.
|
||||
- `binutils` is required. Type `pkg install binutils` to install.
|
||||
- Rust for x86_64 and ARM64 targets *if SSO is enabled in the build*.
|
||||
- **OpenBSD**
|
||||
- There is a limit of four network memberships on OpenBSD as there are only four tap devices (`/dev/tap0` through `/dev/tap3`).
|
||||
- GNU make is required. Type `gmake` to build.
|
||||
- Rust for x86_64 and ARM64 targets *if SSO is enabled in the build*.
|
||||
|
||||
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.
|
||||
|
||||
|
@ -66,43 +79,119 @@ Typing `make selftest` will build a *zerotier-selftest* binary which unit tests
|
|||
|
||||
Running *zerotier-one* with `-h` option will show help.
|
||||
|
||||
On Linux and BSD you can start the service with:
|
||||
On Linux and BSD, if you built from source, you can start the service with:
|
||||
|
||||
sudo ./zerotier-one -d
|
||||
|
||||
On most distributions, macOS, and Windows, the installer will start the service and set it up to start on boot.
|
||||
|
||||
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 [service/README.md](service/README.md) for API documentation.
|
||||
The service is controlled via the JSON API, which by default is available at `127.0.0.1:9993`. It also listens on `0.0.0.0:9993` which is only usable if `allowManagementFrom` is properly configured in `local.conf`. 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 [service/README.md](service/README.md) for API documentation.
|
||||
|
||||
Here's where home folders live (by default) on each OS:
|
||||
|
||||
* **Linux**: `/var/lib/zerotier-one`
|
||||
* **FreeBSD** / **OpenBSD**: `/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*.
|
||||
* **Windows**: `\ProgramData\ZeroTier\One` (That's the default. The base 'shared app data' folder might be different if Windows is installed with a non-standard drive letter assignment or layout.)
|
||||
|
||||
### Basic 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.
|
||||
If you are running a local system firewall, we recommend adding a rules permitting zerotier. 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:
|
||||
See the [documentation site](https://docs.zerotier.com/zerotier/troubleshooting) for more information.
|
||||
|
||||
sudo ufw allow 9993/udp
|
||||
The Mac firewall can be found under "Security" in System Preferences. Linux has a variety of firewall configuration systems and tools.
|
||||
|
||||
On CentOS check `/etc/sysconfig/iptables` for IPTables rules. For other distributions consult your distribution's documentation. You'll also have to check the UIs or documentation for commercial third party firewall applications like Little Snitch (Mac), McAfee Firewall Enterprise (Windows), etc. if you are running any of those. Some corporate environments might have centrally managed firewall software, so you might also have to contact IT.
|
||||
|
||||
ZeroTier One peers will automatically locate each other and communicate directly over a local wired LAN *if UDP port 9993 inbound is open*. If that port is filtered, they won't be able to see each others' LAN announcement packets. If you're experiencing poor performance between devices on the same physical network, check their firewall settings. Without LAN auto-location peers must attempt "loopback" NAT traversal, which sometimes fails and in any case requires that every packet traverse your external router twice.
|
||||
|
||||
Users behind certain types of firewalls and "symmetric" NAT devices may not able able to connect to external peers directly at all. ZeroTier has limited support for port prediction and will *attempt* to traverse symmetric NATs, but this doesn't always work. If P2P connectivity fails you'll be bouncing UDP packets off our relay servers resulting in slower performance. Some NAT router(s) have a configurable NAT mode, and setting this to "full cone" will eliminate this problem. If you do this you may also see a magical improvement for things like VoIP phones, Skype, BitTorrent, WebRTC, certain games, etc., since all of these use NAT traversal techniques similar to ours.
|
||||
Users behind certain types of firewalls and "symmetric" NAT devices may not be able to connect to external peers directly at all. ZeroTier has limited support for port prediction and will *attempt* to traverse symmetric NATs, but this doesn't always work. If P2P connectivity fails you'll be bouncing UDP packets off our relay servers resulting in slower performance. Some NAT router(s) have a configurable NAT mode, and setting this to "full cone" will eliminate this problem. If you do this you may also see a magical improvement for things like VoIP phones, Skype, BitTorrent, WebRTC, certain games, etc., since all of these use NAT traversal techniques similar to ours.
|
||||
|
||||
If 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.
|
||||
|
||||
Additional help can be found in our [knowledge base](https://zerotier.atlassian.net/wiki/spaces/SD/overview).
|
||||
|
||||
### Prometheus Metrics
|
||||
|
||||
Prometheus Metrics are available at the `/metrics` API endpoint. This endpoint is protected by an API key stored in `metricstoken.secret` to prevent unwanted information leakage. Information that could be gleaned from the metrics include joined networks and peers your instance is talking to.
|
||||
|
||||
Access control is via the ZeroTier control interface itself and `metricstoken.secret`. This can be sent as a bearer auth token, via the `X-ZT1-Auth` HTTP header field, or appended to the URL as `?auth=<token>`. You can see the current metrics via `cURL` with the following command:
|
||||
|
||||
// Linux
|
||||
curl -H "X-ZT1-Auth: $(sudo cat /var/lib/zerotier-one/metricstoken.secret)" http://localhost:9993/metrics
|
||||
|
||||
// macOS
|
||||
curl -H "X-ZT1-Auth: $(sudo cat /Library/Application\ Support/ZeroTier/One/metricstoken.secret)" http://localhost:9993/metrics
|
||||
|
||||
// Windows PowerShell (Admin)
|
||||
Invoke-RestMethod -Headers @{'X-ZT1-Auth' = "$(Get-Content C:\ProgramData\ZeroTier\One\metricstoken.secret)"; } -Uri http://localhost:9993/metrics
|
||||
|
||||
To configure a scrape job in Prometheus on the machine ZeroTier is running on, add this to your Prometheus `scrape_config`:
|
||||
|
||||
- job_name: zerotier-one
|
||||
honor_labels: true
|
||||
scrape_interval: 15s
|
||||
metrics_path: /metrics
|
||||
static_configs:
|
||||
- targets:
|
||||
- 127.0.0.1:9993
|
||||
labels:
|
||||
group: zerotier-one
|
||||
node_id: $YOUR_10_CHARACTER_NODE_ID
|
||||
authorization:
|
||||
credentials: $YOUR_METRICS_TOKEN_SECRET
|
||||
|
||||
If neither of these methods are desirable, it is probably possible to distribute metrics via [Prometheus Proxy](https://github.com/pambrose/prometheus-proxy) or some other tool. Note: We have not tested this internally, but will probably work with the correct configuration.
|
||||
|
||||
Metrics are also available on disk in ZeroTier's working directory:
|
||||
|
||||
// Linux
|
||||
/var/lib/zerotier-one/metrics.prom
|
||||
|
||||
// macOS
|
||||
/Library/Application\ Support/ZeroTier/One/metrics.prom
|
||||
|
||||
//Windows
|
||||
C:\ProgramData\ZeroTier\One\metrics.prom
|
||||
|
||||
#### Available Metrics
|
||||
|
||||
| Metric Name | Labels | Metric Type | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| zt_packet | packet_type, direction | Counter | ZeroTier packet type counts |
|
||||
| zt_packet_error | error_type, direction | Counter | ZeroTier packet errors|
|
||||
| zt_data | protocol, direction | Counter | number of bytes ZeroTier has transmitted or received |
|
||||
| zt_num_networks | | Gauge | number of networks this instance is joined to |
|
||||
| zt_network_multicast_groups_subscribed | network_id | Gauge | number of multicast groups networks are subscribed to |
|
||||
| zt_network_packets | network_id, direction | Counter | number of incoming/outgoing packets per network |
|
||||
| zt_peer_latency | node_id | Histogram | peer latency (ms) |
|
||||
| zt_peer_path_count | node_id, status | Gauge | number of paths to peer |
|
||||
| zt_peer_packets | node_id, direction | Counter | number of packets to/from a peer |
|
||||
| zt_peer_packet_errors | node_id | Counter | number of incoming packet errors from a peer |
|
||||
|
||||
If there are other metrics you'd like to see tracked, ask us in an Issue or send us a Pull Request!
|
||||
|
||||
### HTTP / App server
|
||||
|
||||
There is a static http file server suitable for hosting Single Page Apps at http://localhost:9993/app/<app-path>
|
||||
|
||||
Use `zerotier-cli info -j` to find your zerotier-one service's homeDir
|
||||
|
||||
``` sh
|
||||
cd $ZT_HOME
|
||||
sudo mkdir -p app/app1
|
||||
sudo mkdir -p app/appB
|
||||
echo '<html><meta charset=utf-8><title>appA</title><body><h1>hello world A' | sudo tee app/appA/index.html
|
||||
echo '<html><meta charset=utf-8><title>app2</title><body><h1>hello world 2' | sudo tee app/app2/index.html
|
||||
curl -sL http://localhost:9993/app/appA http://localhost:9993/app/app2
|
||||
```
|
||||
|
||||
Then visit [http://localhost:9993/app/app1/](http://localhost:9993/app/app1/) and [http://localhost:9993/app/appB/](http://localhost:9993/app/appB/)
|
||||
|
||||
Requests to paths don't exist return the app root index.html, as is customary for SPAs.
|
||||
If you want, you can write some javascript that talks to the service or controller [api](https://docs.zerotier.com/service/v1).
|
||||
|
|
209
RELEASE-NOTES.md
209
RELEASE-NOTES.md
|
@ -1,6 +1,213 @@
|
|||
ZeroTier Release Notes
|
||||
======
|
||||
|
||||
# 2024-10-23 -- Version 1.14.2
|
||||
|
||||
* Fix for missing entitlement on macOS Sequoia.
|
||||
* Fix for a problem correctly parsing local.conf to enable low bandwidth mode.
|
||||
* Increment versions of some dependent libraries.
|
||||
* Other fixes.
|
||||
|
||||
# 2024-09-12 -- Version 1.14.1
|
||||
|
||||
* Multithreaded packet I/O support! Currently this is just for Linux and must
|
||||
be enabled in local.conf. It will likely make the largest difference on small
|
||||
multi-core devices where CPU is a bottleneck and high throughput is desired.
|
||||
It may be enabled by default in the future but we want it to be thoroughly
|
||||
tested. It's a little harder than it seems at first glance due to the need
|
||||
to keep packets in sequence and balance load.
|
||||
* Several multipath bug fixes.
|
||||
* Updated the versions on a number of libraries related to OIDC support and HTTP.
|
||||
* MacOS .app now shows the correct version in its Info.plist manifest.
|
||||
* Sanitize MAC addresses in JSON format rules parser.
|
||||
* Some basic information about the platform (OS, CPU architecture) is now reported
|
||||
to network controllers when networks are joined so it can be displayed to
|
||||
network admins and in the future used in policy checking and inventory operations.
|
||||
|
||||
# 2024-05-02 -- Version 1.14.0
|
||||
|
||||
* Linux I/O performance improvements under heavy load
|
||||
* Improvements to multipath
|
||||
* Fix for port rebinding "coma" bug after periods offline (some laptop users)
|
||||
* Fixed a rules engine quirk/ambiguity (GitHub Issue #2200)
|
||||
* Controller API enhancements: node names and other node meta-data
|
||||
* Other bug fixes
|
||||
|
||||
# 2023-09-12 -- Version 1.12.2
|
||||
|
||||
* More improvements to macOS full tunnel mode.
|
||||
* Faster recovery after changes to physical network settings.
|
||||
|
||||
# 2023-08-25 -- Version 1.12.1
|
||||
|
||||
* Minor release to fix a port binding issue in Linux.
|
||||
* Update Debian dependencies.
|
||||
* No changes for other platforms.
|
||||
|
||||
# 2023-08-23 -- Version 1.12.0
|
||||
|
||||
* Experimental Windows ARM64 support
|
||||
* Fix numerous sleep/wake issues on macOS and other platforms
|
||||
* Faster recovery after changes to physical network settings
|
||||
* Prometheus compatible metrics support!
|
||||
* Fix full tunnel mode on recent macOS versions
|
||||
* Numerous macOS DNS fixes
|
||||
* 10-30% speed improvement on Linux
|
||||
|
||||
# 2023-03-23 -- Version 1.10.6
|
||||
|
||||
* Prevent binding temporary ipv6 addresses on macos (#1910)
|
||||
* Prevent path-learning loops (#1914)
|
||||
* Prevent infinite loop of UAC prompts in tray app
|
||||
|
||||
# 2023-03-10 -- Version 1.10.5
|
||||
|
||||
* Fix for high CPU usage bug on Windows
|
||||
|
||||
# 2023-03-07 -- Version 1.10.4
|
||||
|
||||
* SECURITY FIX (Windows): this version fixes a file permission problem on
|
||||
Windows that could allow non-privileged users on a Windows system to read
|
||||
privileged files in the ZeroTier service's working directory. This could
|
||||
allow an unprivileged local Windows user to administrate the local ZeroTier
|
||||
instance without appropriate local permissions. This issue is not remotely
|
||||
exploitable unless a remote user can read arbitrary local files, and does
|
||||
not impact other operating systems.
|
||||
|
||||
* Fix a bug in the handling of multiple IP address assignments to virtual
|
||||
interfaces on macOS.
|
||||
|
||||
# 2023-02-15 -- Version 1.10.3
|
||||
|
||||
* Fix for duplicate paths in client. Could cause connectivity issues. Affects all platforms.
|
||||
* Fix for Ethernet Tap MTU setting, would not properly apply on Linux.
|
||||
* Fix default route bugs (macOS.)
|
||||
* Enable Ping automatically for ZeroTier Adapters (Windows.)
|
||||
* SSO updates and minor bugfixes.
|
||||
* Add low-bandwidth mode.
|
||||
* Add forceTcpRelay mode (optionally enabled.)
|
||||
* Fix bug that prevented setting of custom TCP relay address.
|
||||
* Build script improvements and bug fixes.
|
||||
|
||||
# 2022-11-01 -- Version 1.10.2
|
||||
|
||||
* Fix another SSO "stuck client" issue in zeroidc.
|
||||
* Expose root-reported external IP/port information via the local JSON API for better diagnostics.
|
||||
* Multipath: CLI output improvement for inspecting bonds
|
||||
* Multipath: balance-aware mode
|
||||
* Multipath: Custom policies
|
||||
* Multipath: Link quality measurement improvements
|
||||
|
||||
Note that releases are coming few and far between because most of our dev effort is going into version 2.
|
||||
|
||||
# 2022-06-27 -- Version 1.10.1
|
||||
|
||||
* Fix an issue that could cause SSO clients to get "stuck" on stale auth URLs.
|
||||
* A few other SSO related bug fixes.
|
||||
|
||||
# 2022-06-07 -- Version 1.10.0
|
||||
|
||||
* Fix formatting problem in `zerotier-cli` when using SSO networks.
|
||||
* Fix a few other minor bugs in SSO signin to prepare for general availability.
|
||||
* Remove requirement for webview in desktop UI and instead just make everything available via the tray pulldown/menu. Use [libui-ng](https://github.com/libui-ng/libui-ng) for minor prompt dialogs. Saves space and eliminates installation headaches on Windows.
|
||||
* Fix SSO "spam" bug in desktop UI.
|
||||
* Use system default browser for SSO login so all your plugins, MFA devices, password managers, etc. will work as you have them configured.
|
||||
* Minor fix for bonding/multipath.
|
||||
|
||||
# 2022-05-10 -- Version 1.8.10
|
||||
|
||||
* Fixed a bug preventing SSO sign-on on Windows.
|
||||
|
||||
# 2022-04-25 -- Version 1.8.9
|
||||
|
||||
* Fixed a long-standing and strange bug that was causing sporadic "phantom" packet authentication failures. Not a security problem but could be behind sporadic reports of link failures under some conditions.
|
||||
* Fixed a memory leak in SSO/OIDC support.
|
||||
* Fixed SSO/OIDC display error on CLI.
|
||||
* Fixed a bug causing nodes to sometimes fail to push certs to each other (primarily affects SSO/OIDC use cases).
|
||||
* Fixed a deadlock bug on leaving SSO/OIDC managed networks.
|
||||
* Added some new Linux distributions to the build subsystem.
|
||||
|
||||
# 2022-04-11 -- Version 1.8.8
|
||||
|
||||
* Fix a local privilege escalation bug in the Windows installer.
|
||||
* Dependency fix for some Ubuntu versions.
|
||||
* No changes for other platforms. Windows upgrade recommended, everyone else optional.
|
||||
|
||||
# 2022-03-30 -- Version 1.8.7
|
||||
|
||||
* Fix for dependency installations in Windows MSI package.
|
||||
* Fix for desktop UI setup when run by a non-super-user.
|
||||
* Bug fix in local OIDC / SSO support for auth0 and other providers.
|
||||
* Other minor fixes for e.g. old Linux distributions.
|
||||
|
||||
# 2022-03-04 -- Version 1.8.6
|
||||
|
||||
* Fixed an issue that could cause the UI to be non-responsive if not joined to any networks.
|
||||
* Fix dependency issues in Debian and RedHat packages for some distributions (Fedora, Mint).
|
||||
* Bumped the peer cache serialization version to prevent "coma" issues on upgrade due to changes in path logic behaving badly with old values.
|
||||
|
||||
# 2022-02-22 -- Version 1.8.5
|
||||
|
||||
* Plumbing under the hood for endpoint device SSO support.
|
||||
* Fix in LinuxEthernetTap to tap device support on very old (2.6) Linux kernels.
|
||||
* Fix an issue that could cause self-hosted roots ("moons") to fail to assist peers in making direct links. (GitHub issue #1512)
|
||||
* Merge a series of changes by Joseph Henry (of ZeroTier) that should fix some edge cases where ZeroTier would "forget" valid paths.
|
||||
* Minor multipath improvements for automatic path negotiation.
|
||||
|
||||
# 2021-11-30 -- Version 1.8.4
|
||||
|
||||
* Fixed an ugly font problem on some older macOS versions.
|
||||
* Fixed a bug that could cause the desktop tray app control panel to stop opening after a while on Windows.
|
||||
* Fixed a possible double "release" in macOS tray app code that crashed on older macOS versions.
|
||||
* Fixed installation on 32-bit Windows 10.
|
||||
* Fixed a build flags issue that could cause ZeroTier to crash on older ARM32 CPUs.
|
||||
|
||||
# 2021-11-15 -- Version 1.8.3
|
||||
|
||||
* Remove problematic spinlock, which was only used on x86_64 anyway. Just use pthread always.
|
||||
* Fix fd leak on MacOS that caused non-responsiveness after some time.
|
||||
* Fix Debian install scripts to set /usr/sbin/nologin as shell on service user.
|
||||
* Fix regression that could prevent managed routes from being deleted.
|
||||
* DesktopUI: Remove NSDate:now() call, now works on MacOS 10.13 or newer!
|
||||
|
||||
# 2021-11-08 -- Version 1.8.2
|
||||
|
||||
* Fix multicast on linux.
|
||||
* Fix a bug that could cause the tap adapter to have the wrong MAC on Linux.
|
||||
* Update build flags to possibly support MacOS older than 10.14, but more work needs to be done. It may not work yet.
|
||||
* Fix path variable setting on Windows.
|
||||
|
||||
# 2021-10-28 -- Version 1.8.1
|
||||
|
||||
* Fix numerous UI issues from 1.8.0 (never fully released).
|
||||
* Remove support for REALLY ancient 1.1.6 or earlier network controllers.
|
||||
* MacOS IPv6 no longer binds to temporary addresses as these can cause interruptions if they expire.
|
||||
* Added additional hardening against address impersonation on networks (also in 1.6.6).
|
||||
* Fix an issue that could cause clobbering of MacOS IP route settings on restart.
|
||||
|
||||
* NOTE: Windows 7 is no longer supported! Windows 7 users will have to use version 1.6.5 or earlier.
|
||||
|
||||
# 2021-09-15 -- Version 1.8.0 (preview release only)
|
||||
|
||||
* A *completely* rewritten desktop UI for Mac and Windows!
|
||||
* Implement a workaround for one potential source of a "coma" bug, which can occur if buggy NATs/routers stop allowing the service to communicate on a given port. ZeroTier now reassigns a new secondary port if it's offline for a while unless a secondary port is manually specified in local.conf. Working around crummy buggy routers is an ongoing effort.
|
||||
* Fix for MacOS MTU capping issue on feth devices
|
||||
* Fix for mistakenly using v6 source addresses for v4 routes on some platforms
|
||||
* Stop binding to temporary IPv6 addresses
|
||||
* Set MAC address before bringing up Linux TAP link
|
||||
* Check if DNS servers need to be applied on macOS
|
||||
* Upgrade json.hpp dependency to version 3.10.2
|
||||
|
||||
# 2021-09-21 -- Version 1.6.6
|
||||
|
||||
* Backport COM hash check mitigation against network member impersonation.
|
||||
|
||||
# 2021-04-13 -- Version 1.6.5
|
||||
|
||||
* Fix a bug in potential network path filtering that could in some circumstances lead to "software laser" effects.
|
||||
* Fix a printf overflow in zerotier-cli (not exploitable or a security risk)
|
||||
* Windows now looks up the name of ZeroTier devices instead of relying on them having "ZeroTier" in them.
|
||||
|
||||
# 2021-02-15 -- Version 1.6.4
|
||||
|
||||
* The groundhog saw his shadow, which meant that the "connection coma" bug still wasn't gone. We think we found it this time.
|
||||
|
@ -165,7 +372,7 @@ We're trying to fix all these issues before the 1.6.0 release. Stay tuned.
|
|||
# 2017-04-20 -- Version 1.2.4
|
||||
|
||||
* Managed routes are now only bifurcated for the default route. This is a change in behavior, though few people will probably notice. Bifurcating all managed routes was causing more trouble than it was worth for most users.
|
||||
* Up to 2X crypto speedup on x86-64 (except Windows, which will take some porting) and 32-bit ARM platforms due to integration of fast assembly language implementations of Salsa20/12 from the [supercop](http://bench.cr.yp.to/supercop.html) code base. These were written by Daniel J. Bernstein and are in the public domain. My Macbook Pro (Core i5 2.8ghz) now does almost 1.5GiB/sec Salsa20/12 per core and a Raspberry Pi got a 2X boost. 64-bit ARM support and Windows support will take some work but should not be too hard.
|
||||
* Up to 2X crypto speedup on x86-64 (except Windows, which will take some porting) and 32-bit ARM platforms due to integration of fast assembly language implementations of Salsa20/12 from the [supercop](http://bench.cr.yp.to/supercop.html) code base. These were written by Daniel J. Bernstein and are in the public domain. My MacBook Pro (Core i5 2.8ghz) now does almost 1.5GiB/sec Salsa20/12 per core and a Raspberry Pi got a 2X boost. 64-bit ARM support and Windows support will take some work but should not be too hard.
|
||||
* Refactored code that manages credentials to greatly reduce memory use in most cases. This may also result in a small performance improvement.
|
||||
* Reworked and simplified path selection and priority logic to fix path instability and dead path persistence edge cases. There have been some sporadic reports of persistent path instabilities and dead paths hanging around that take minutes to resolve. These have proven difficult to reproduce in house, but hopefully this will fix them. In any case it seems to speed up path establishment in our tests and it makes the code simpler and more readable.
|
||||
* Eliminated some unused cruft from the code around path management and in the peer class.
|
||||
|
|
93
SECURITY.md
Normal file
93
SECURITY.md
Normal file
|
@ -0,0 +1,93 @@
|
|||
# Security
|
||||
|
||||
ZeroTier takes the security of our software products and services seriously, which
|
||||
includes all source code repositories managed through our GitHub organization.
|
||||
|
||||
## Supported Versions
|
||||
|
||||
The following versions of ZeroTier One receive security updates
|
||||
|
||||
| Version | Supported |
|
||||
| -------- | ------------------ |
|
||||
| 1.14.x | :white_check_mark: |
|
||||
| 1.12.x | :white_check_mark: |
|
||||
| < 1.12.0 | :x: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
**Please do not report security issues through public GitHub issues**
|
||||
|
||||
Instead, please report vulnerabilities via email to security@zerotier.com. If possible,
|
||||
please encrypt with our PGP key (see below).
|
||||
|
||||
Please include the following information, or as much as you can provide to help us
|
||||
understand the nature and scope of the issue:
|
||||
|
||||
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
|
||||
* Full paths of source file(s) related to the manifestation of the issue
|
||||
* The location of the affected source code (tag/branch/commit or direct URL)
|
||||
* Any special configuration required to reproduce the issue
|
||||
* Step-by-step instructions to reproduce the issue
|
||||
* Proof-of-concept or exploit code (if possible)
|
||||
* Impact of the issue, including how an attacker might exploit the issue
|
||||
|
||||
## Preferred Languages
|
||||
|
||||
We prefer all communications to be in English.
|
||||
|
||||
## security@zerotier.com PGP key
|
||||
|
||||
```
|
||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
|
||||
mQINBGQGOVIBEACalXTnNqaiSOVLFEiqHpDMg8N/OI5D5850Xy1ZEvx3B3rz7cbn
|
||||
k30ozHtJKbh+vqpyItE7DjyQAuF19gP5Q64Yh0Y+MmLHq60q/GwOwAYz7cI+UzA3
|
||||
5x8YqcmTp32LAM1xJn+iMlMLBuAmJl4kULKmOXPlpqPiyTFs5saizvm7fgRmfgJJ
|
||||
HpsnIrTkaDFJhAR+jvMJohVYwmhuydeI0DsHu7KGpG1ddcHDrUjOPNqXnnAPSPwx
|
||||
llw4yfKlQb8GYErsv/G5QVyzd5+SxEuiI4MARRnrk8LlMQ33CR6pzIQ/Bk5AAmye
|
||||
mHqfEAknkiOf++urYhRs9BL3Kz3MdV0cg92zr9EFOg0u56jxf5OnAiTOhGUUA0hn
|
||||
dS7peVGl46R9Oy2JYIazNDGi+4NIsYDFXsnsss9xOQVygPyeQd71zFHfix0jct9w
|
||||
j3o/kj7Egsnm9nc13354bYT6bbalqXiRWwGH1eAFpjueNWiVFwZS6NZUP3WeNDiY
|
||||
BlPo1LodvolbXiJcTILTCyEkERJPCK2zoE2nTdVfvTLWsuehw1M6Yd2/q74TVYy/
|
||||
RY+KjHkrChEBQ9PqXsXRHj6opKbT8JLfZkvU5k+3IiqqxOpB+QXFI/whj493CxWW
|
||||
so7QAmzOCyJq8GDVPxzkwUac22YIkXdiOmb8i/HWq+kLY/HjQE259Gx6KwARAQAB
|
||||
tClaZXJvVGllciBTZWN1cml0eSA8c2VjdXJpdHlAemVyb3RpZXIuY29tPokCTAQT
|
||||
AQoANhYhBH1HQGb+4jzl6mnFqf09m6uqADkABQJkBjlSAhsDBAsJCAcEFQoJCAUW
|
||||
AgMBAAIeAQIXgAAKCRD9PZurqgA5ACqPD/sFt6SG6Tu0HwTY2ofJtYsa2GBLL0pf
|
||||
dYlX4cWSs1PVB5+m5Oj18y+GB2umA9GnsVtmvaSfp3XEngt2zNWX27uUsVfL35b2
|
||||
/5TVVe8RjzOedqMN+lQWMvO+f/C1zmWYXjjpC+iGjgMMaRRrofkkn+7uL4N9y6gY
|
||||
rcXtpACT1rYFC+i1AKnZfUO8Vr5ji7odq0f7bDkN/N38rB0kRRwEmO8wqdpQK6gK
|
||||
nxf9vgJl5ggimDk5Xtz1sfd3y28bf5N4hdOCkXUbd10nUFY3wDNTM4VxozxTGJeG
|
||||
imdcc19Wuw/1fGUZ5SIjgPanCdPLGYwSTr+M6Fuern9uTtlC1GOby3BUtmVGP6EU
|
||||
1pSAJSRpmoBPHKKOYtSMwV8PCboXru9P1ab8y8STKM3SKyghUJrl17gdc0LaksZa
|
||||
E54pJudGPIQMFRqZjMdV6jgMuaLTozjZ4mW8EThf4mkX4xDkO8l7cOn0225ZYJZC
|
||||
lZKpdnwzk9owkJA80u4KBNJxTtB4ZAPzjBsD5hFzCZQTLNQp/psU3EjZsau28eXT
|
||||
E/C1QjEQHgy4ohkgQlCm1H1+clKssCWcdmsVGXuS1u8gh4K6X9b0Z6LeCGRaQvH2
|
||||
+DB8oTAdqp9nUZv9rP4pbo+sR4fF67CFLriVuxjedAiFkbM4uHMFcL4tc/X9+DRo
|
||||
YN5X7oEkZvO507kCDQRkBjlSARAAz58UMF7K1qKyQjzKTcutaYZ5SaIGky9lCLZn
|
||||
/2vjpFCoBogkxS/6IKQcwZk8b4S9QstaaQZDFEkxqNeKC0GiFTAMAb6SmYcK495h
|
||||
EZnHl0NA5Nc2dBlZk5E/ENzTCz2bXaxCcVESc2z+xCzu07brbhGrqvliKiwOUzt9
|
||||
JzqEsar6I95OutBcZvkFCs44/Uf9bS1qf1w4klE8w3vdMtGH23umrET4tFZ+sh6o
|
||||
ZFtQx0u2eKjsRdn/RMtsxLNaJlcE1DdIAqBpQrcmuwMC8v5wUGfCGZjhClzmyQlq
|
||||
akUkayir7UtbHbFT/mgO+YI77YGXWk5QrwPscqqT2l8KB/YMujNDmaWa/0KV1lIY
|
||||
zr5s4dzVeiwqFLR9ANFIhzFwzf3JLi6XSx123Qix0TxZoYPZCHl7yoi9qi6qybz5
|
||||
0Od2LSz3jbApeKYymZ+zjE+YV5y9DI6Wzy1j2M1FogNvTO9fMk+6dLt4HhTdSNvH
|
||||
cKya462YCcy+tnZTkhmh+FTebbJlV6D4wG7skE5KCdBhjm53xLwp6XW9L6n2CrkL
|
||||
W1IDBcCz0oPd1sMkXbO3wnxdXprV2XurCfsg/R2nszSNzvdJ8/xj3cr9hpoJ714R
|
||||
qqyoEDRZ1Ss9kGL166o5MpN5qb/EewdkqGgWP7YFXbhsdHQiW7Z7dAqzjoaybD4O
|
||||
nakkwyUAEQEAAYkCNgQYAQoAIBYhBH1HQGb+4jzl6mnFqf09m6uqADkABQJkBjlS
|
||||
AhsMAAoJEP09m6uqADkAax0P/Rh8EZYRqW6dPYTl1YQusAK10rAcRNq3ekjofXGk
|
||||
oXK1S7HWGoFgl5++5nfSfNgFJ5VLcgIM56wtIf49zFjWe5oC6fw8k+ghh4d2chMP
|
||||
hdDILx6e0c30Iq1+EvovGR9hWa0wJ4cKTdzlwhY9ZC09q0ia+bl2mwpie1JQDR0c
|
||||
zXCjt+PldLeeK9z1/XT0Q7KowYC+U18oR+KFm+EaRV4QT85JVequnIeGkmaHJrHB
|
||||
lH4T5A5ib7y8edon1c0Zx3GsaxJUojkEJ0SX7ffVDu6ztUZfkHfCVpMW4VzUeGA/
|
||||
m+CtFO9ciLRGZEkRa+zhIGoBvwEXU0GiwiF4nZ0F2C8UioeW0YIEV9zl3nXJctYE
|
||||
ZKc2whSENQRTGgaYHVoVZhznt71LKWgFLshwBo81UCXVkzwAjMW1ActDnmPw5M7q
|
||||
xR5Qp5G49Z1GmfSozazha0HVFPKNV5i3RlTzs4yLUnZyH0yC9IvtOefMHcLjG96L
|
||||
N5miEV97gvJJjrn8rhRvpUwAWgmT/9IuYjBNQTtNN40arto5HxezR76WCjdKYxdL
|
||||
p3dM1iiBDShHNm7LdyZlLFhTOMU0tNBxJJ7B09ar5gakeZjD+2aB1ODX9VuFtozL
|
||||
onBjI2gIkry0UIkuznHfFw05lZAZAiqHEVgVi/WTk4C/bklDZNgE0lx+IWzEz2iS
|
||||
L455
|
||||
=lheL
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
||||
```
|
|
@ -1,3 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
c++ -std=c++11 -I../.. -I.. -g -o mkworld ../../node/C25519.cpp ../../node/Salsa20.cpp ../../node/SHA512.cpp ../../node/Identity.cpp ../../node/Utils.cpp ../../node/InetAddress.cpp ../../osdep/OSUtils.cpp mkworld.cpp -lm
|
||||
c++ -std=c++11 -I../.. -I../../ext -I.. -g -o mkworld ../../node/C25519.cpp ../../node/Salsa20.cpp ../../node/SHA512.cpp ../../node/Identity.cpp ../../node/Utils.cpp ../../node/InetAddress.cpp ../../osdep/OSUtils.cpp mkworld.cpp -lm
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
|
||||
#include <node/Constants.hpp>
|
||||
#include <node/World.hpp>
|
||||
#include <node/C25519.hpp>
|
||||
#include <node/ECC.hpp>
|
||||
#include <node/Identity.hpp>
|
||||
#include <node/InetAddress.hpp>
|
||||
#include <osdep/OSUtils.hpp>
|
||||
|
@ -54,7 +54,7 @@ int main(int argc,char **argv)
|
|||
{
|
||||
std::string previous,current;
|
||||
if ((!OSUtils::readFile("previous.c25519",previous))||(!OSUtils::readFile("current.c25519",current))) {
|
||||
C25519::Pair np(C25519::generate());
|
||||
ECC::Pair np(ECC::generate());
|
||||
previous = std::string();
|
||||
previous.append((const char *)np.pub.data,ZT_C25519_PUBLIC_KEY_LEN);
|
||||
previous.append((const char *)np.priv.data,ZT_C25519_PRIVATE_KEY_LEN);
|
||||
|
@ -68,10 +68,10 @@ int main(int argc,char **argv)
|
|||
fprintf(stderr,"FATAL: previous.c25519 or current.c25519 empty or invalid" ZT_EOL_S);
|
||||
return 1;
|
||||
}
|
||||
C25519::Pair previousKP;
|
||||
ECC::Pair previousKP;
|
||||
memcpy(previousKP.pub.data,previous.data(),ZT_C25519_PUBLIC_KEY_LEN);
|
||||
memcpy(previousKP.priv.data,previous.data() + ZT_C25519_PUBLIC_KEY_LEN,ZT_C25519_PRIVATE_KEY_LEN);
|
||||
C25519::Pair currentKP;
|
||||
ECC::Pair currentKP;
|
||||
memcpy(currentKP.pub.data,current.data(),ZT_C25519_PUBLIC_KEY_LEN);
|
||||
memcpy(currentKP.priv.data,current.data() + ZT_C25519_PUBLIC_KEY_LEN,ZT_C25519_PRIVATE_KEY_LEN);
|
||||
|
||||
|
|
13
ci/Dockerfile-build.deb
Normal file
13
ci/Dockerfile-build.deb
Normal file
|
@ -0,0 +1,13 @@
|
|||
ARG ZT_NAME
|
||||
FROM 084037375216.dkr.ecr.us-east-2.amazonaws.com/${ZT_NAME}-builder as builder
|
||||
WORKDIR /work/build
|
||||
COPY . .
|
||||
RUN pwd
|
||||
RUN ls -la .
|
||||
RUN make clean
|
||||
RUN make debian
|
||||
RUN ls -ls /work
|
||||
|
||||
FROM scratch AS export
|
||||
ARG ZT_NAME
|
||||
COPY --from=builder /work/*.deb ./${ZT_NAME}/
|
36
ci/Dockerfile-build.el6
Normal file
36
ci/Dockerfile-build.el6
Normal file
|
@ -0,0 +1,36 @@
|
|||
ARG DOCKER_ARCH
|
||||
FROM --platform=linux/${DOCKER_ARCH} alpine:edge AS builder
|
||||
|
||||
RUN apk update
|
||||
RUN apk add curl
|
||||
RUN apk add bash
|
||||
RUN apk add file
|
||||
RUN apk add rust
|
||||
RUN apk add cargo
|
||||
RUN apk add make
|
||||
RUN apk add cmake
|
||||
RUN apk add clang
|
||||
RUN apk add openssl-dev
|
||||
RUN apk add linux-headers
|
||||
RUN apk add build-base
|
||||
RUN apk add openssl-libs-static
|
||||
|
||||
COPY . .
|
||||
RUN ZT_STATIC=1 make
|
||||
RUN ls -la
|
||||
|
||||
ARG DOCKER_ARCH
|
||||
FROM --platform=linux/${DOCKER_ARCH} centos:6 AS stage
|
||||
WORKDIR /root/rpmbuild/BUILD
|
||||
COPY . .
|
||||
COPY --from=builder zerotier-* ./
|
||||
RUN curl https://gist.githubusercontent.com/someara/b363002ba6e57b3c474dd027d4daef85/raw/4ac5534139752fc92fbe1a53599a390214f69615/el6%2520vault --output /etc/yum.repos.d/CentOS-Base.repo
|
||||
RUN uname -a
|
||||
RUN yum -y install make gcc rpm-build
|
||||
RUN pwd
|
||||
RUN ls -la
|
||||
RUN make redhat
|
||||
|
||||
FROM scratch AS export
|
||||
ARG ZT_NAME
|
||||
COPY --from=stage /root/rpmbuild/RPMS/*/*.rpm ./${ZT_NAME}/
|
9
ci/Dockerfile-build.rpm
Normal file
9
ci/Dockerfile-build.rpm
Normal file
|
@ -0,0 +1,9 @@
|
|||
ARG ZT_NAME
|
||||
FROM 084037375216.dkr.ecr.us-east-2.amazonaws.com/${ZT_NAME}-builder as builder
|
||||
WORKDIR /root/rpmbuild/BUILD
|
||||
COPY . .
|
||||
RUN make redhat
|
||||
|
||||
FROM scratch AS export
|
||||
ARG ZT_NAME
|
||||
COPY --from=builder /root/rpmbuild/RPMS/*/*.rpm ./${ZT_NAME}/
|
13
ci/Dockerfile-test.deb
Normal file
13
ci/Dockerfile-test.deb
Normal file
|
@ -0,0 +1,13 @@
|
|||
ARG ZT_NAME
|
||||
FROM 084037375216.dkr.ecr.us-east-2.amazonaws.com/${ZT_NAME}-tester
|
||||
ARG BASEURL
|
||||
ARG VERSION
|
||||
ARG DEB_ARCH
|
||||
ARG ZT_NAME
|
||||
ARG DISTRO
|
||||
RUN curl -s http://${BASEURL}/key.gpg -o /etc/apt/trusted.gpg.d/zerotier.gpg
|
||||
RUN echo "deb [arch=${DEB_ARCH} signed-by=/etc/apt/trusted.gpg.d/zerotier.gpg] http://${BASEURL}/${DISTRO} ${ZT_NAME} main" > /etc/apt/sources.list.d/zerotier.list
|
||||
RUN apt-get -qq update
|
||||
RUN apt-get -qq install zerotier-one=${VERSION}
|
||||
|
||||
RUN ldd $(which zerotier-cli)
|
4
ci/Dockerfile-test.el6
Normal file
4
ci/Dockerfile-test.el6
Normal file
|
@ -0,0 +1,4 @@
|
|||
ARG DOCKER_ARCH
|
||||
FROM --platform=linux/${DOCKER_ARCH} centos:6
|
||||
RUN printf "[C6.10-base]\nname=CentOS-6.10 - Base\nbaseurl=http://vault.epel.cloud/6.10/os/\$basearch/\ngpgcheck=1\ngpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6\nenabled=1\nmetadata_expire=never\n" > /etc/yum.repos.d/CentOS-Base.repo
|
||||
RUN yum -y install curl
|
17
ci/Dockerfile-test.rpm
Normal file
17
ci/Dockerfile-test.rpm
Normal file
|
@ -0,0 +1,17 @@
|
|||
ARG ZT_NAME
|
||||
FROM 084037375216.dkr.ecr.us-east-2.amazonaws.com/${ZT_NAME}-tester
|
||||
ARG BASEURL
|
||||
ARG VERSION
|
||||
ARG DEB_ARCH
|
||||
ARG ZT_NAME
|
||||
ARG DISTRO
|
||||
ARG DNF_ARCH
|
||||
RUN curl -s http://${BASEURL}/key.asc -o /etc/pki/rpm-gpg/RPM-GPG-KEY-zerotier
|
||||
RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-zerotier
|
||||
RUN rpm -q gpg-pubkey --qf '%{NAME}-%{VERSION}-%{RELEASE}\t%{SUMMARY}\n'
|
||||
RUN printf "[zerotier]\nname=zerotier\nbaseurl=http://${BASEURL}/${DISTRO}/${ZT_NAME}/$basearch/\nenabled=1\ngpgcheck=1\ngpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-zerotier\n" > /etc/yum.repos.d/zerotier.repo
|
||||
|
||||
# RUN yum -v repolist
|
||||
RUN setarch ${DNF_ARCH} yum -y install zerotier-one-${VERSION}
|
||||
RUN file $(which zerotier-cli)
|
||||
RUN ldd $(which zerotier-cli)
|
49
ci/scripts/build.sh
Executable file
49
ci/scripts/build.sh
Executable file
|
@ -0,0 +1,49 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
ZT_NAME="$1" ; shift
|
||||
DISTRO="$1" ; shift
|
||||
ZT_ISA="$1" ; shift
|
||||
VERSION="$1" ; shift
|
||||
BUILD_EVENT="$1" ; shift
|
||||
|
||||
source "$(dirname $0)/lib.sh"
|
||||
|
||||
if [ -f "ci/Dockerfile-build.${ZT_NAME}" ]; then
|
||||
DOCKERFILE="ci/Dockerfile-build.${ZT_NAME}"
|
||||
else
|
||||
DOCKERFILE="ci/Dockerfile-build.${PKGFMT}"
|
||||
fi
|
||||
|
||||
echo "#~~~~~~~~~~~~~~~~~~~~"
|
||||
echo "$0 variables:"
|
||||
echo "nproc: $(nproc)"
|
||||
echo "ZT_NAME: ${ZT_NAME}"
|
||||
echo "DISTRO: ${DISTRO}"
|
||||
echo "ZT_ISA: ${ZT_ISA}"
|
||||
echo "VERSION: ${VERSION}"
|
||||
echo "BUILD_EVENT: ${BUILD_EVENT}"
|
||||
echo "DOCKER_ARCH: ${DOCKER_ARCH}"
|
||||
echo "DNF_ARCH: ${DNF_ARCH}"
|
||||
echo "RUST_TRIPLET: ${RUST_TRIPLET}"
|
||||
echo "PKGFMT: ${PKGFMT}"
|
||||
echo "PWD: ${PWD}"
|
||||
echo "DOCKERFILE: ${DOCKERFILE}"
|
||||
echo "#~~~~~~~~~~~~~~~~~~~~"
|
||||
|
||||
make munge_rpm zerotier-one.spec VERSION=${VERSION}
|
||||
make munge_deb debian/changelog VERSION=${VERSION}
|
||||
|
||||
docker buildx build \
|
||||
--no-cache=true \
|
||||
--build-arg ZT_NAME="${ZT_NAME}" \
|
||||
--build-arg RUST_TRIPLET="${RUST_TRIPLET}" \
|
||||
--build-arg DOCKER_ARCH="${DOCKER_ARCH}" \
|
||||
--build-arg DNF_ARCH="${DNF_ARCH}" \
|
||||
--platform linux/${DOCKER_ARCH} \
|
||||
-f ${DOCKERFILE} \
|
||||
-t build \
|
||||
. \
|
||||
--output type=local,dest=. \
|
||||
--target export
|
63
ci/scripts/lib.sh
Executable file
63
ci/scripts/lib.sh
Executable file
|
@ -0,0 +1,63 @@
|
|||
|
||||
case $ZT_NAME in
|
||||
el*|fc*|amzn*)
|
||||
export PKGFMT=rpm
|
||||
;;
|
||||
*)
|
||||
export PKGFMT=deb
|
||||
esac
|
||||
|
||||
case $ZT_ISA in
|
||||
386)
|
||||
export DOCKER_ARCH=386
|
||||
export DEB_ARCH=i386
|
||||
export DNF_ARCH=i686
|
||||
export RUST_TRIPLET=i686-unknown-linux-gnu
|
||||
;;
|
||||
amd64)
|
||||
export DOCKER_ARCH=amd64
|
||||
export DEB_ARCH=amd64
|
||||
export DNF_ARCH=x86_64
|
||||
export RUST_TRIPLET=x86_64-unknown-linux-gnu
|
||||
;;
|
||||
armv7)
|
||||
export DOCKER_ARCH=arm/v7
|
||||
export DNF_ARCH=armv7
|
||||
export DEB_ARCH=armhf
|
||||
export RUST_TRIPLET=armv7-unknown-linux-gnueabihf
|
||||
;;
|
||||
arm64)
|
||||
export DOCKER_ARCH=arm64/v8
|
||||
export DEB_ARCH=arm64
|
||||
export DNF_ARCH=linux64
|
||||
export RUST_TRIPLET=aarch64-unknown-linux-gnu
|
||||
;;
|
||||
riscv64)
|
||||
export DOCKER_ARCH=riscv64
|
||||
export DEB_ARCH=riscv64
|
||||
export DNF_ARCH=riscv64
|
||||
export RUST_TRIPLET=riscv64gc-unknown-linux-gnu
|
||||
;;
|
||||
ppc64le)
|
||||
export DOCKER_ARCH=ppc64le
|
||||
export DEB_ARCH=ppc64el
|
||||
export DNF_ARCH=ppc64le
|
||||
export RUST_TRIPLET=powerpc64le-unknown-linux-gnu
|
||||
;;
|
||||
mips64le)
|
||||
export DOCKER_ARCH=mips64le
|
||||
export DEB_ARCH=mips64le
|
||||
export DNF_ARCH=mips64le
|
||||
export RUST_TRIPLET=mips64el-unknown-linux-gnuabi64
|
||||
;;
|
||||
s390x)
|
||||
export DOCKER_ARCH=s390x
|
||||
export DEB_ARCH=s390x
|
||||
export DNF_ARCH=s390x
|
||||
export RUST_TRIPLET=s390x-unknown-linux-gnu
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: could not determine architecture settings. PLEASE FIX ME"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
37
ci/scripts/munge_debian_changelog.sh
Executable file
37
ci/scripts/munge_debian_changelog.sh
Executable file
|
@ -0,0 +1,37 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
export FILE=$1
|
||||
export VERSION=$2
|
||||
export NAME=$3
|
||||
export MESSAGE=$4
|
||||
export DATE=$(date "+%a, %d %b %Y %T %z")
|
||||
# export DATE=$(date "+%a %b %d %Y")
|
||||
|
||||
set +e
|
||||
grep --version | grep BSD &> /dev/null
|
||||
if [ $? == 0 ]; then BSDGREP=true ; else BSDGREP=false ; fi
|
||||
set -e
|
||||
|
||||
# echo "#~~~~~~~~~~~~~~~~~~~~"
|
||||
# echo "$0 variables:"
|
||||
# echo "VERSION: ${VERSION}"
|
||||
# echo "NAME: ${NAME}"
|
||||
# echo "MESSAGE: ${MESSAGE}"
|
||||
# echo "DATE: ${DATE}"
|
||||
# echo "BSDGREP: ${BSDGREP}"
|
||||
# echo "#~~~~~~~~~~~~~~~~~~~~"
|
||||
# echo
|
||||
|
||||
if $BSDGREP ; then
|
||||
sed -i '' s/^Version:.*/"Version: ${VERSION}"/ ${FILE}
|
||||
else
|
||||
sed -i s/^Version:.*/"Version: ${VERSION}"/ ${FILE}
|
||||
fi
|
||||
|
||||
awk -v version=${VERSION} -v date=${DATE} -v name=${NAME} -v message=${MESSAGE} \
|
||||
'BEGIN{print "zerotier-one (" version ") stable; urgency=medium\n\n * " message "\n\n -- " name " " date "\n" }{ print }' \
|
||||
${FILE} > ${FILE}.new
|
||||
|
||||
mv ${FILE}.new ${FILE}
|
36
ci/scripts/munge_rpm_spec.sh
Executable file
36
ci/scripts/munge_rpm_spec.sh
Executable file
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
export FILE=$1
|
||||
export VERSION=$2
|
||||
export NAME=$3
|
||||
export MESSAGE=$4
|
||||
export DATE=$(date "+%a %b %d %Y")
|
||||
|
||||
set +e
|
||||
grep --version | grep BSD &> /dev/null
|
||||
if [ $? == 0 ]; then BSDGREP=true ; else BSDGREP=false ; fi
|
||||
set -e
|
||||
|
||||
# echo "#~~~~~~~~~~~~~~~~~~~~"
|
||||
# echo "$0 variables:"
|
||||
# echo "VERSION: ${VERSION}"
|
||||
# echo "NAME: ${NAME}"
|
||||
# echo "MESSAGE: ${MESSAGE}"
|
||||
# echo "DATE: ${DATE}"
|
||||
# echo "BSDGREP: ${BSDGREP}"
|
||||
# echo "#~~~~~~~~~~~~~~~~~~~~"
|
||||
# echo
|
||||
|
||||
if $BSDGREP ; then
|
||||
sed -i '' s/^Version:.*/"Version: ${VERSION}"/ ${FILE}
|
||||
else
|
||||
sed -i s/^Version:.*/"Version: ${VERSION}"/ ${FILE}
|
||||
fi
|
||||
|
||||
awk -v version=${VERSION} -v date=${DATE} -v name=${NAME} -v message=${MESSAGE} \
|
||||
'FNR==NR{ if (/%changelog/) p=NR; next} 1; FNR==p{ print "* " date " " name " - " version "\n- " message "\n" }' \
|
||||
${FILE} ${FILE} > ${FILE}.new
|
||||
|
||||
mv ${FILE}.new ${FILE}
|
38
ci/scripts/publish.sh
Executable file
38
ci/scripts/publish.sh
Executable file
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
ZT_NAME="$1" ; shift
|
||||
DISTRO="$1" ; shift
|
||||
ZT_ISA="$1" ; shift
|
||||
VERSION="$1" ; shift
|
||||
BUILD_EVENT="$1" ; shift
|
||||
|
||||
source "$(dirname $0)/lib.sh"
|
||||
|
||||
if [ ${BUILD_EVENT} == "tag" ]; then
|
||||
CHANNEL="zerotier-releases"
|
||||
else
|
||||
CHANNEL="zerotier-builds"
|
||||
fi
|
||||
|
||||
function publish_rpm {
|
||||
mkdir -p /${CHANNEL}/${DISTRO}
|
||||
ls -la /${CHANNEL}
|
||||
ls -la .
|
||||
cp -a ${ZT_NAME} /${CHANNEL}/${DISTRO}
|
||||
}
|
||||
|
||||
function publish_deb {
|
||||
mkdir -p /${CHANNEL}/${DISTRO}/pool/dists/${ZT_NAME}/main
|
||||
cp -a ${ZT_NAME}/* /${CHANNEL}/${DISTRO}/pool/dists/${ZT_NAME}/main
|
||||
}
|
||||
|
||||
case ${PKGFMT} in
|
||||
"rpm")
|
||||
publish_rpm
|
||||
;;
|
||||
"deb")
|
||||
publish_deb
|
||||
esac
|
||||
|
55
ci/scripts/test.sh
Executable file
55
ci/scripts/test.sh
Executable file
|
@ -0,0 +1,55 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
ZT_NAME="$1" ; shift
|
||||
DISTRO="$1" ; shift
|
||||
ZT_ISA="$1" ; shift
|
||||
VERSION="$1" ; shift
|
||||
BUILD_EVENT="$1" ; shift
|
||||
|
||||
source "$(dirname $0)/lib.sh"
|
||||
|
||||
if [ -f "ci/Dockerfile-test.${ZT_NAME}" ]; then
|
||||
DOCKERFILE="ci/Dockerfile-test.${ZT_NAME}"
|
||||
else
|
||||
DOCKERFILE="ci/Dockerfile-test.${PKGFMT}"
|
||||
fi
|
||||
|
||||
if [ ${BUILD_EVENT} == "tag" ]; then
|
||||
BASEURL="zerotier-releases.home.arpa"
|
||||
else
|
||||
BASEURL="zerotier-builds.home.arpa"
|
||||
fi
|
||||
|
||||
echo "#~~~~~~~~~~~~~~~~~~~~"
|
||||
echo "$0 variables:"
|
||||
echo "nproc: $(nproc)"
|
||||
echo "ZT_NAME: ${ZT_NAME}"
|
||||
echo "DISTRO: ${DISTRO}"
|
||||
echo "ZT_ISA: ${ZT_ISA}"
|
||||
echo "VERSION: ${VERSION}"
|
||||
echo "BUILD_EVENT: ${BUILD_EVENT}"
|
||||
echo "DOCKER_ARCH: ${DOCKER_ARCH}"
|
||||
echo "DNF_ARCH: ${DNF_ARCH}"
|
||||
echo "RUST_TRIPLET: ${RUST_TRIPLET}"
|
||||
echo "PKGFMT: ${PKGFMT}"
|
||||
echo "PWD: ${PWD}"
|
||||
echo "DOCKERFILE: ${DOCKERFILE}"
|
||||
echo "#~~~~~~~~~~~~~~~~~~~~"
|
||||
|
||||
# docker pull -q --platform="linux/${DOCKER_ARCH}" 084037375216.dkr.ecr.us-east-2.amazonaws.com/${ZT_NAME}-tester
|
||||
|
||||
docker buildx build \
|
||||
--build-arg BASEURL="${BASEURL}" \
|
||||
--build-arg ZT_NAME="${ZT_NAME}" \
|
||||
--build-arg DISTRO="${DISTRO}" \
|
||||
--build-arg DEB_ARCH="${DEB_ARCH}" \
|
||||
--build-arg DNF_ARCH="${DNF_ARCH}" \
|
||||
--build-arg VERSION="${VERSION}" \
|
||||
--build-arg DOCKER_ARCH="${DOCKER_ARCH}" \
|
||||
--platform "linux/${DOCKER_ARCH}" \
|
||||
--no-cache \
|
||||
-f ${DOCKERFILE} \
|
||||
-t test \
|
||||
.
|
2092
controller/CV1.cpp
Normal file
2092
controller/CV1.cpp
Normal file
File diff suppressed because it is too large
Load diff
144
controller/CV1.hpp
Normal file
144
controller/CV1.hpp
Normal file
|
@ -0,0 +1,144 @@
|
|||
/*
|
||||
* Copyright (c)2019 ZeroTier, Inc.
|
||||
*
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file in the project's root directory.
|
||||
*
|
||||
* Change Date: 2026-01-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2.0 of the Apache License.
|
||||
*/
|
||||
/****/
|
||||
|
||||
#include "DB.hpp"
|
||||
|
||||
#ifdef ZT_CONTROLLER_USE_LIBPQ
|
||||
|
||||
#ifndef ZT_CONTROLLER_CV1_HPP
|
||||
#define ZT_CONTROLLER_CV1_HPP
|
||||
|
||||
#define ZT_CENTRAL_CONTROLLER_COMMIT_THREADS 4
|
||||
|
||||
#include "../node/Metrics.hpp"
|
||||
#include "ConnectionPool.hpp"
|
||||
#include "PostgreSQL.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <pqxx/pqxx>
|
||||
#include <redis++/redis++.h>
|
||||
|
||||
namespace smeeclient {
|
||||
struct SmeeClient;
|
||||
}
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
struct RedisConfig;
|
||||
|
||||
/**
|
||||
* A controller database driver that talks to PostgreSQL
|
||||
*
|
||||
* This is for use with ZeroTier Central. Others are free to build and use it
|
||||
* but be aware that we might change it at any time.
|
||||
*/
|
||||
class CV1 : public DB {
|
||||
friend class MemberNotificationReceiver<CV1>;
|
||||
friend class NetworkNotificationReceiver<CV1>;
|
||||
|
||||
public:
|
||||
CV1(const Identity& myId, const char* path, int listenPort, RedisConfig* rc);
|
||||
virtual ~CV1();
|
||||
|
||||
virtual bool waitForReady();
|
||||
virtual bool isReady();
|
||||
virtual bool save(nlohmann::json& record, bool notifyListeners);
|
||||
virtual void eraseNetwork(const uint64_t networkId);
|
||||
virtual void eraseMember(const uint64_t networkId, const uint64_t memberId);
|
||||
virtual void nodeIsOnline(const uint64_t networkId, const uint64_t memberId, const InetAddress& physicalAddress);
|
||||
virtual void nodeIsOnline(const uint64_t networkId, const uint64_t memberId, const InetAddress& physicalAddress, const char* osArch);
|
||||
virtual AuthInfo getSSOAuthInfo(const nlohmann::json& member, const std::string& redirectURL);
|
||||
|
||||
virtual bool ready()
|
||||
{
|
||||
return _ready == 2;
|
||||
}
|
||||
|
||||
protected:
|
||||
struct _PairHasher {
|
||||
inline std::size_t operator()(const std::pair<uint64_t, uint64_t>& p) const
|
||||
{
|
||||
return (std::size_t)(p.first ^ p.second);
|
||||
}
|
||||
};
|
||||
virtual void _memberChanged(nlohmann::json& old, nlohmann::json& memberConfig, bool notifyListeners)
|
||||
{
|
||||
DB::_memberChanged(old, memberConfig, notifyListeners);
|
||||
}
|
||||
|
||||
virtual void _networkChanged(nlohmann::json& old, nlohmann::json& networkConfig, bool notifyListeners)
|
||||
{
|
||||
DB::_networkChanged(old, networkConfig, notifyListeners);
|
||||
}
|
||||
|
||||
private:
|
||||
void initializeNetworks();
|
||||
void initializeMembers();
|
||||
void heartbeat();
|
||||
void membersDbWatcher();
|
||||
void _membersWatcher_Postgres();
|
||||
void networksDbWatcher();
|
||||
void _networksWatcher_Postgres();
|
||||
|
||||
void _membersWatcher_Redis();
|
||||
void _networksWatcher_Redis();
|
||||
|
||||
void commitThread();
|
||||
void onlineNotificationThread();
|
||||
void onlineNotification_Postgres();
|
||||
void onlineNotification_Redis();
|
||||
uint64_t _doRedisUpdate(sw::redis::Transaction& tx, std::string& controllerId, std::unordered_map<std::pair<uint64_t, uint64_t>, NodeOnlineRecord, _PairHasher>& lastOnline);
|
||||
|
||||
void configureSmee();
|
||||
void notifyNewMember(const std::string& networkID, const std::string& memberID);
|
||||
|
||||
enum OverrideMode { ALLOW_PGBOUNCER_OVERRIDE = 0, NO_OVERRIDE = 1 };
|
||||
|
||||
std::shared_ptr<ConnectionPool<PostgresConnection> > _pool;
|
||||
|
||||
const Identity _myId;
|
||||
const Address _myAddress;
|
||||
std::string _myAddressStr;
|
||||
std::string _connString;
|
||||
|
||||
BlockingQueue<std::pair<nlohmann::json, bool> > _commitQueue;
|
||||
|
||||
std::thread _heartbeatThread;
|
||||
std::thread _membersDbWatcher;
|
||||
std::thread _networksDbWatcher;
|
||||
std::thread _commitThread[ZT_CENTRAL_CONTROLLER_COMMIT_THREADS];
|
||||
std::thread _onlineNotificationThread;
|
||||
|
||||
std::unordered_map<std::pair<uint64_t, uint64_t>, NodeOnlineRecord, _PairHasher> _lastOnline;
|
||||
|
||||
mutable std::mutex _lastOnline_l;
|
||||
mutable std::mutex _readyLock;
|
||||
std::atomic<int> _ready, _connected, _run;
|
||||
mutable volatile bool _waitNoticePrinted;
|
||||
|
||||
int _listenPort;
|
||||
uint8_t _ssoPsk[48];
|
||||
|
||||
RedisConfig* _rc;
|
||||
std::shared_ptr<sw::redis::Redis> _redis;
|
||||
std::shared_ptr<sw::redis::RedisCluster> _cluster;
|
||||
bool _redisMemberStatus;
|
||||
|
||||
smeeclient::SmeeClient* _smee;
|
||||
};
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
||||
#endif // ZT_CONTROLLER_CV1_HPP
|
||||
|
||||
#endif // ZT_CONTROLLER_USE_LIBPQ
|
1244
controller/CV2.cpp
Normal file
1244
controller/CV2.cpp
Normal file
File diff suppressed because it is too large
Load diff
109
controller/CV2.hpp
Normal file
109
controller/CV2.hpp
Normal file
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
* Copyright (c)2025 ZeroTier, Inc.
|
||||
*
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file in the project's root directory.
|
||||
*
|
||||
* Change Date: 2026-01-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2.0 of the Apache License.
|
||||
*/
|
||||
/****/
|
||||
|
||||
#include "DB.hpp"
|
||||
|
||||
#ifdef ZT_CONTROLLER_USE_LIBPQ
|
||||
|
||||
#ifndef ZT_CONTROLLER_CV2_HPP
|
||||
#define ZT_CONTROLLER_CV2_HPP
|
||||
|
||||
#define ZT_CENTRAL_CONTROLLER_COMMIT_THREADS 4
|
||||
|
||||
#include "../node/Metrics.hpp"
|
||||
#include "ConnectionPool.hpp"
|
||||
#include "PostgreSQL.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <pqxx/pqxx>
|
||||
#include <redis++/redis++.h>
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
class CV2 : public DB {
|
||||
friend class MemberNotificationReceiver<CV2>;
|
||||
friend class NetworkNotificationReceiver<CV2>;
|
||||
|
||||
public:
|
||||
CV2(const Identity& myId, const char* path, int listenPort);
|
||||
virtual ~CV2();
|
||||
|
||||
virtual bool waitForReady();
|
||||
virtual bool isReady();
|
||||
virtual bool save(nlohmann::json& record, bool notifyListeners);
|
||||
virtual void eraseNetwork(const uint64_t networkId);
|
||||
virtual void eraseMember(const uint64_t networkId, const uint64_t memberId);
|
||||
virtual void nodeIsOnline(const uint64_t networkId, const uint64_t memberId, const InetAddress& physicalAddress);
|
||||
virtual void nodeIsOnline(const uint64_t networkId, const uint64_t memberId, const InetAddress& physicalAddress, const char* osArch);
|
||||
virtual AuthInfo getSSOAuthInfo(const nlohmann::json& member, const std::string& redirectURL);
|
||||
|
||||
virtual bool ready()
|
||||
{
|
||||
return _ready == 2;
|
||||
}
|
||||
|
||||
protected:
|
||||
struct _PairHasher {
|
||||
inline std::size_t operator()(const std::pair<uint64_t, uint64_t>& p) const
|
||||
{
|
||||
return (std::size_t)(p.first ^ p.second);
|
||||
}
|
||||
};
|
||||
virtual void _memberChanged(nlohmann::json& old, nlohmann::json& memberConfig, bool notifyListeners);
|
||||
|
||||
virtual void _networkChanged(nlohmann::json& old, nlohmann::json& networkConfig, bool notifyListeners);
|
||||
|
||||
private:
|
||||
void initializeNetworks();
|
||||
void initializeMembers();
|
||||
void heartbeat();
|
||||
void membersDbWatcher();
|
||||
void networksDbWatcher();
|
||||
|
||||
void commitThread();
|
||||
void onlineNotificationThread();
|
||||
|
||||
// void notifyNewMember(const std::string &networkID, const std::string &memberID);
|
||||
|
||||
enum OverrideMode { ALLOW_PGBOUNCER_OVERRIDE = 0, NO_OVERRIDE = 1 };
|
||||
|
||||
std::shared_ptr<ConnectionPool<PostgresConnection> > _pool;
|
||||
|
||||
const Identity _myId;
|
||||
const Address _myAddress;
|
||||
std::string _myAddressStr;
|
||||
std::string _connString;
|
||||
|
||||
BlockingQueue<std::pair<nlohmann::json, bool> > _commitQueue;
|
||||
|
||||
std::thread _heartbeatThread;
|
||||
std::thread _membersDbWatcher;
|
||||
std::thread _networksDbWatcher;
|
||||
std::thread _commitThread[ZT_CENTRAL_CONTROLLER_COMMIT_THREADS];
|
||||
std::thread _onlineNotificationThread;
|
||||
|
||||
std::unordered_map<std::pair<uint64_t, uint64_t>, NodeOnlineRecord, _PairHasher> _lastOnline;
|
||||
|
||||
mutable std::mutex _lastOnline_l;
|
||||
mutable std::mutex _readyLock;
|
||||
std::atomic<int> _ready, _connected, _run;
|
||||
mutable volatile bool _waitNoticePrinted;
|
||||
|
||||
int _listenPort;
|
||||
uint8_t _ssoPsk[48];
|
||||
};
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
||||
#endif // ZT_CONTROLLER_CV2_HPP
|
||||
#endif // ZT_CONTROLLER_USE_LIBPQ
|
190
controller/ConnectionPool.hpp
Normal file
190
controller/ConnectionPool.hpp
Normal file
|
@ -0,0 +1,190 @@
|
|||
/*
|
||||
* Copyright (c)2021 ZeroTier, Inc.
|
||||
*
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file in the project's root directory.
|
||||
*
|
||||
* Change Date: 2026-01-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2.0 of the Apache License.
|
||||
*/
|
||||
/****/
|
||||
|
||||
#ifndef ZT_CONNECTION_POOL_H_
|
||||
#define ZT_CONNECTION_POOL_H_
|
||||
|
||||
#ifndef _DEBUG
|
||||
#define _DEBUG(x)
|
||||
#endif
|
||||
|
||||
#include "../node/Metrics.hpp"
|
||||
#include "opentelemetry/trace/provider.h"
|
||||
|
||||
#include <deque>
|
||||
#include <exception>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
struct ConnectionUnavailable : std::exception {
|
||||
char const* what() const throw()
|
||||
{
|
||||
return "Unable to allocate connection";
|
||||
};
|
||||
};
|
||||
|
||||
class Connection {
|
||||
public:
|
||||
virtual ~Connection() {};
|
||||
};
|
||||
|
||||
class ConnectionFactory {
|
||||
public:
|
||||
virtual ~ConnectionFactory() {};
|
||||
virtual std::shared_ptr<Connection> create() = 0;
|
||||
};
|
||||
|
||||
struct ConnectionPoolStats {
|
||||
size_t pool_size;
|
||||
size_t borrowed_size;
|
||||
};
|
||||
|
||||
template <class T> class ConnectionPool {
|
||||
public:
|
||||
ConnectionPool(size_t max_pool_size, size_t min_pool_size, std::shared_ptr<ConnectionFactory> factory) : m_maxPoolSize(max_pool_size), m_minPoolSize(min_pool_size), m_factory(factory)
|
||||
{
|
||||
Metrics::max_pool_size += max_pool_size;
|
||||
Metrics::min_pool_size += min_pool_size;
|
||||
while (m_pool.size() < m_minPoolSize) {
|
||||
m_pool.push_back(m_factory->create());
|
||||
Metrics::pool_avail++;
|
||||
}
|
||||
};
|
||||
|
||||
ConnectionPoolStats get_stats()
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(m_poolMutex);
|
||||
|
||||
ConnectionPoolStats stats;
|
||||
stats.pool_size = m_pool.size();
|
||||
stats.borrowed_size = m_borrowed.size();
|
||||
|
||||
return stats;
|
||||
};
|
||||
|
||||
~ConnectionPool() {};
|
||||
|
||||
/**
|
||||
* Borrow
|
||||
*
|
||||
* Borrow a connection for temporary use
|
||||
*
|
||||
* When done, either (a) call unborrow() to return it, or (b) (if it's bad) just let it go out of scope. This will cause it to automatically be replaced.
|
||||
* @retval a shared_ptr to the connection object
|
||||
*/
|
||||
std::shared_ptr<T> borrow()
|
||||
{
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("connection_pool");
|
||||
auto span = tracer->StartSpan("connection_pool::borrow");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
|
||||
std::unique_lock<std::mutex> l(m_poolMutex);
|
||||
|
||||
while ((m_pool.size() + m_borrowed.size()) < m_minPoolSize) {
|
||||
std::shared_ptr<Connection> conn = m_factory->create();
|
||||
m_pool.push_back(conn);
|
||||
Metrics::pool_avail++;
|
||||
}
|
||||
|
||||
if (m_pool.size() == 0) {
|
||||
if ((m_pool.size() + m_borrowed.size()) < m_maxPoolSize) {
|
||||
try {
|
||||
std::shared_ptr<Connection> conn = m_factory->create();
|
||||
m_borrowed.insert(conn);
|
||||
Metrics::pool_in_use++;
|
||||
return std::static_pointer_cast<T>(conn);
|
||||
}
|
||||
catch (std::exception& e) {
|
||||
span->SetStatus(opentelemetry::trace::StatusCode::kError, e.what());
|
||||
Metrics::pool_errors++;
|
||||
throw ConnectionUnavailable();
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (auto it = m_borrowed.begin(); it != m_borrowed.end(); ++it) {
|
||||
if ((*it).unique()) {
|
||||
// This connection has been abandoned! Destroy it and create a new connection
|
||||
try {
|
||||
// If we are able to create a new connection, return it
|
||||
_DEBUG("Creating new connection to replace discarded connection");
|
||||
std::shared_ptr<Connection> conn = m_factory->create();
|
||||
m_borrowed.erase(it);
|
||||
m_borrowed.insert(conn);
|
||||
return std::static_pointer_cast<T>(conn);
|
||||
}
|
||||
catch (std::exception& e) {
|
||||
span->SetStatus(opentelemetry::trace::StatusCode::kError, e.what());
|
||||
// Error creating a replacement connection
|
||||
Metrics::pool_errors++;
|
||||
throw ConnectionUnavailable();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
span->SetStatus(opentelemetry::trace::StatusCode::kError, "No available connections in pool");
|
||||
// Nothing available
|
||||
Metrics::pool_errors++;
|
||||
throw ConnectionUnavailable();
|
||||
}
|
||||
}
|
||||
|
||||
// Take one off the front
|
||||
std::shared_ptr<Connection> conn = m_pool.front();
|
||||
m_pool.pop_front();
|
||||
Metrics::pool_avail--;
|
||||
// Add it to the borrowed list
|
||||
m_borrowed.insert(conn);
|
||||
Metrics::pool_in_use++;
|
||||
return std::static_pointer_cast<T>(conn);
|
||||
};
|
||||
|
||||
/**
|
||||
* Unborrow a connection
|
||||
*
|
||||
* Only call this if you are returning a working connection. If the connection was bad, just let it go out of scope (so the connection manager can replace it).
|
||||
* @param the connection
|
||||
*/
|
||||
void unborrow(std::shared_ptr<T> conn)
|
||||
{
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("connection_pool");
|
||||
auto span = tracer->StartSpan("connection_pool::unborrow");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
|
||||
// Lock
|
||||
std::unique_lock<std::mutex> lock(m_poolMutex);
|
||||
m_borrowed.erase(conn);
|
||||
Metrics::pool_in_use--;
|
||||
if ((m_pool.size() + m_borrowed.size()) < m_maxPoolSize) {
|
||||
Metrics::pool_avail++;
|
||||
m_pool.push_back(conn);
|
||||
}
|
||||
};
|
||||
|
||||
protected:
|
||||
size_t m_maxPoolSize;
|
||||
size_t m_minPoolSize;
|
||||
std::shared_ptr<ConnectionFactory> m_factory;
|
||||
std::deque<std::shared_ptr<Connection> > m_pool;
|
||||
std::set<std::shared_ptr<Connection> > m_borrowed;
|
||||
std::mutex m_poolMutex;
|
||||
};
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
||||
#endif
|
64
controller/CtlUtil.cpp
Normal file
64
controller/CtlUtil.cpp
Normal file
|
@ -0,0 +1,64 @@
|
|||
#include "CtlUtil.hpp"
|
||||
|
||||
#ifdef ZT_CONTROLLER_USE_LIBPQ
|
||||
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
const char* _timestr()
|
||||
{
|
||||
time_t t = time(0);
|
||||
char* ts = ctime(&t);
|
||||
char* p = ts;
|
||||
if (! p)
|
||||
return "";
|
||||
while (*p) {
|
||||
if (*p == '\n') {
|
||||
*p = (char)0;
|
||||
break;
|
||||
}
|
||||
++p;
|
||||
}
|
||||
return ts;
|
||||
}
|
||||
|
||||
std::vector<std::string> split(std::string str, char delim)
|
||||
{
|
||||
std::istringstream iss(str);
|
||||
std::vector<std::string> tokens;
|
||||
std::string item;
|
||||
while (std::getline(iss, item, delim)) {
|
||||
tokens.push_back(item);
|
||||
}
|
||||
return tokens;
|
||||
}
|
||||
|
||||
std::string url_encode(const std::string& value)
|
||||
{
|
||||
std::ostringstream escaped;
|
||||
escaped.fill('0');
|
||||
escaped << std::hex;
|
||||
|
||||
for (std::string::const_iterator i = value.begin(), n = value.end(); i != n; ++i) {
|
||||
std::string::value_type c = (*i);
|
||||
|
||||
// Keep alphanumeric and other accepted characters intact
|
||||
if (isalnum(c) || c == '-' || c == '_' || c == '.' || c == '~') {
|
||||
escaped << c;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Any other characters are percent-encoded
|
||||
escaped << std::uppercase;
|
||||
escaped << '%' << std::setw(2) << int((unsigned char)c);
|
||||
escaped << std::nouppercase;
|
||||
}
|
||||
|
||||
return escaped.str();
|
||||
}
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
||||
#endif
|
16
controller/CtlUtil.hpp
Normal file
16
controller/CtlUtil.hpp
Normal file
|
@ -0,0 +1,16 @@
|
|||
#ifndef ZT_CTLUTIL_HPP
|
||||
#define ZT_CTLUTIL_HPP
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
const char* _timestr();
|
||||
|
||||
std::vector<std::string> split(std::string str, char delim);
|
||||
|
||||
std::string url_encode(const std::string& value);
|
||||
} // namespace ZeroTier
|
||||
|
||||
#endif // namespace ZeroTier
|
|
@ -4,7 +4,7 @@
|
|||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file in the project's root directory.
|
||||
*
|
||||
* Change Date: 2025-01-01
|
||||
* Change Date: 2026-01-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2.0 of the Apache License.
|
||||
|
@ -12,72 +12,131 @@
|
|||
/****/
|
||||
|
||||
#include "DB.hpp"
|
||||
#include "EmbeddedNetworkController.hpp"
|
||||
|
||||
#include <chrono>
|
||||
#include "../node/Metrics.hpp"
|
||||
#include "EmbeddedNetworkController.hpp"
|
||||
#include "opentelemetry/trace/provider.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <stdexcept>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
void DB::initNetwork(nlohmann::json &network)
|
||||
void DB::initNetwork(nlohmann::json& network)
|
||||
{
|
||||
if (!network.count("private")) network["private"] = true;
|
||||
if (!network.count("creationTime")) network["creationTime"] = OSUtils::now();
|
||||
if (!network.count("name")) network["name"] = "";
|
||||
if (!network.count("multicastLimit")) network["multicastLimit"] = (uint64_t)32;
|
||||
if (!network.count("enableBroadcast")) network["enableBroadcast"] = true;
|
||||
if (!network.count("v4AssignMode")) network["v4AssignMode"] = {{"zt",false}};
|
||||
if (!network.count("v6AssignMode")) network["v6AssignMode"] = {{"rfc4193",false},{"zt",false},{"6plane",false}};
|
||||
if (!network.count("authTokens")) network["authTokens"] = {{}};
|
||||
if (!network.count("capabilities")) network["capabilities"] = nlohmann::json::array();
|
||||
if (!network.count("tags")) network["tags"] = nlohmann::json::array();
|
||||
if (!network.count("routes")) network["routes"] = nlohmann::json::array();
|
||||
if (!network.count("ipAssignmentPools")) network["ipAssignmentPools"] = nlohmann::json::array();
|
||||
if (!network.count("mtu")) network["mtu"] = ZT_DEFAULT_MTU;
|
||||
if (!network.count("remoteTraceTarget")) network["remoteTraceTarget"] = nlohmann::json();
|
||||
if (!network.count("removeTraceLevel")) network["remoteTraceLevel"] = 0;
|
||||
if (!network.count("rulesSource")) network["rulesSource"] = "";
|
||||
if (!network.count("rules")) {
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("db");
|
||||
auto span = tracer->StartSpan("db::initNetwork");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
|
||||
if (! network.count("private"))
|
||||
network["private"] = true;
|
||||
if (! network.count("creationTime"))
|
||||
network["creationTime"] = OSUtils::now();
|
||||
if (! network.count("name"))
|
||||
network["name"] = "";
|
||||
if (! network.count("multicastLimit"))
|
||||
network["multicastLimit"] = (uint64_t)32;
|
||||
if (! network.count("enableBroadcast"))
|
||||
network["enableBroadcast"] = true;
|
||||
if (! network.count("v4AssignMode"))
|
||||
network["v4AssignMode"] = { { "zt", false } };
|
||||
if (! network.count("v6AssignMode"))
|
||||
network["v6AssignMode"] = { { "rfc4193", false }, { "zt", false }, { "6plane", false } };
|
||||
if (! network.count("authTokens"))
|
||||
network["authTokens"] = { {} };
|
||||
if (! network.count("capabilities"))
|
||||
network["capabilities"] = nlohmann::json::array();
|
||||
if (! network.count("tags"))
|
||||
network["tags"] = nlohmann::json::array();
|
||||
if (! network.count("routes"))
|
||||
network["routes"] = nlohmann::json::array();
|
||||
if (! network.count("ipAssignmentPools"))
|
||||
network["ipAssignmentPools"] = nlohmann::json::array();
|
||||
if (! network.count("mtu"))
|
||||
network["mtu"] = ZT_DEFAULT_MTU;
|
||||
if (! network.count("remoteTraceTarget"))
|
||||
network["remoteTraceTarget"] = nlohmann::json();
|
||||
if (! network.count("removeTraceLevel"))
|
||||
network["remoteTraceLevel"] = 0;
|
||||
if (! network.count("rulesSource"))
|
||||
network["rulesSource"] = "";
|
||||
if (! network.count("rules")) {
|
||||
// If unspecified, rules are set to allow anything and behave like a flat L2 segment
|
||||
network["rules"] = {{
|
||||
{ "not",false },
|
||||
{ "or", false },
|
||||
{ "type","ACTION_ACCEPT" }
|
||||
}};
|
||||
network["rules"] = { { { "not", false }, { "or", false }, { "type", "ACTION_ACCEPT" } } };
|
||||
}
|
||||
if (!network.count("dns")) network["dns"] = nlohmann::json::array();
|
||||
if (! network.count("dns"))
|
||||
network["dns"] = nlohmann::json::array();
|
||||
if (! network.count("ssoEnabled"))
|
||||
network["ssoEnabled"] = false;
|
||||
if (! network.count("clientId"))
|
||||
network["clientId"] = "";
|
||||
if (! network.count("authorizationEndpoint"))
|
||||
network["authorizationEndpoint"] = "";
|
||||
|
||||
network["objtype"] = "network";
|
||||
}
|
||||
|
||||
void DB::initMember(nlohmann::json &member)
|
||||
void DB::initMember(nlohmann::json& member)
|
||||
{
|
||||
if (!member.count("authorized")) member["authorized"] = false;
|
||||
if (!member.count("ipAssignments")) member["ipAssignments"] = nlohmann::json::array();
|
||||
if (!member.count("activeBridge")) member["activeBridge"] = false;
|
||||
if (!member.count("tags")) member["tags"] = nlohmann::json::array();
|
||||
if (!member.count("capabilities")) member["capabilities"] = nlohmann::json::array();
|
||||
if (!member.count("creationTime")) member["creationTime"] = OSUtils::now();
|
||||
if (!member.count("noAutoAssignIps")) member["noAutoAssignIps"] = false;
|
||||
if (!member.count("revision")) member["revision"] = 0ULL;
|
||||
if (!member.count("lastDeauthorizedTime")) member["lastDeauthorizedTime"] = 0ULL;
|
||||
if (!member.count("lastAuthorizedTime")) member["lastAuthorizedTime"] = 0ULL;
|
||||
if (!member.count("lastAuthorizedCredentialType")) member["lastAuthorizedCredentialType"] = nlohmann::json();
|
||||
if (!member.count("lastAuthorizedCredential")) member["lastAuthorizedCredential"] = nlohmann::json();
|
||||
if (!member.count("vMajor")) member["vMajor"] = -1;
|
||||
if (!member.count("vMinor")) member["vMinor"] = -1;
|
||||
if (!member.count("vRev")) member["vRev"] = -1;
|
||||
if (!member.count("vProto")) member["vProto"] = -1;
|
||||
if (!member.count("remoteTraceTarget")) member["remoteTraceTarget"] = nlohmann::json();
|
||||
if (!member.count("removeTraceLevel")) member["remoteTraceLevel"] = 0;
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("db");
|
||||
auto span = tracer->StartSpan("db::initMember");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
|
||||
if (! member.count("authorized"))
|
||||
member["authorized"] = false;
|
||||
if (! member.count("ssoExempt"))
|
||||
member["ssoExempt"] = false;
|
||||
if (! member.count("ipAssignments"))
|
||||
member["ipAssignments"] = nlohmann::json::array();
|
||||
if (! member.count("activeBridge"))
|
||||
member["activeBridge"] = false;
|
||||
if (! member.count("tags"))
|
||||
member["tags"] = nlohmann::json::array();
|
||||
if (! member.count("capabilities"))
|
||||
member["capabilities"] = nlohmann::json::array();
|
||||
if (! member.count("creationTime"))
|
||||
member["creationTime"] = OSUtils::now();
|
||||
if (! member.count("noAutoAssignIps"))
|
||||
member["noAutoAssignIps"] = false;
|
||||
if (! member.count("revision"))
|
||||
member["revision"] = 0ULL;
|
||||
if (! member.count("lastDeauthorizedTime"))
|
||||
member["lastDeauthorizedTime"] = 0ULL;
|
||||
if (! member.count("lastAuthorizedTime"))
|
||||
member["lastAuthorizedTime"] = 0ULL;
|
||||
if (! member.count("lastAuthorizedCredentialType"))
|
||||
member["lastAuthorizedCredentialType"] = nlohmann::json();
|
||||
if (! member.count("lastAuthorizedCredential"))
|
||||
member["lastAuthorizedCredential"] = nlohmann::json();
|
||||
if (! member.count("authenticationExpiryTime"))
|
||||
member["authenticationExpiryTime"] = 0LL;
|
||||
if (! member.count("vMajor"))
|
||||
member["vMajor"] = -1;
|
||||
if (! member.count("vMinor"))
|
||||
member["vMinor"] = -1;
|
||||
if (! member.count("vRev"))
|
||||
member["vRev"] = -1;
|
||||
if (! member.count("vProto"))
|
||||
member["vProto"] = -1;
|
||||
if (! member.count("remoteTraceTarget"))
|
||||
member["remoteTraceTarget"] = nlohmann::json();
|
||||
if (! member.count("removeTraceLevel"))
|
||||
member["remoteTraceLevel"] = 0;
|
||||
member["objtype"] = "member";
|
||||
}
|
||||
|
||||
void DB::cleanNetwork(nlohmann::json &network)
|
||||
void DB::cleanNetwork(nlohmann::json& network)
|
||||
{
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("db");
|
||||
auto span = tracer->StartSpan("db::cleanNetwork");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
|
||||
network.erase("clock");
|
||||
network.erase("authorizedMemberCount");
|
||||
network.erase("activeMemberCount");
|
||||
|
@ -85,49 +144,78 @@ void DB::cleanNetwork(nlohmann::json &network)
|
|||
network.erase("lastModified");
|
||||
}
|
||||
|
||||
void DB::cleanMember(nlohmann::json &member)
|
||||
void DB::cleanMember(nlohmann::json& member)
|
||||
{
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("db");
|
||||
auto span = tracer->StartSpan("db::cleanMember");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
|
||||
member.erase("clock");
|
||||
member.erase("physicalAddr");
|
||||
member.erase("recentLog");
|
||||
member.erase("lastModified");
|
||||
member.erase("lastRequestMetaData");
|
||||
member.erase("authenticationURL"); // computed
|
||||
member.erase("authenticationClientID"); // computed
|
||||
}
|
||||
|
||||
DB::DB() {}
|
||||
DB::~DB() {}
|
||||
|
||||
bool DB::get(const uint64_t networkId,nlohmann::json &network)
|
||||
DB::DB()
|
||||
{
|
||||
}
|
||||
DB::~DB()
|
||||
{
|
||||
}
|
||||
|
||||
bool DB::get(const uint64_t networkId, nlohmann::json& network)
|
||||
{
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("db");
|
||||
auto span = tracer->StartSpan("db::getNetwork");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
char networkIdStr[17];
|
||||
span->SetAttribute("network_id", Utils::hex(networkId, networkIdStr));
|
||||
|
||||
waitForReady();
|
||||
Metrics::db_get_network++;
|
||||
std::shared_ptr<_Network> nw;
|
||||
{
|
||||
std::lock_guard<std::mutex> l(_networks_l);
|
||||
std::shared_lock<std::shared_mutex> l(_networks_l);
|
||||
auto nwi = _networks.find(networkId);
|
||||
if (nwi == _networks.end())
|
||||
return false;
|
||||
nw = nwi->second;
|
||||
}
|
||||
{
|
||||
std::lock_guard<std::mutex> l2(nw->lock);
|
||||
std::shared_lock<std::shared_mutex> l2(nw->lock);
|
||||
network = nw->config;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DB::get(const uint64_t networkId,nlohmann::json &network,const uint64_t memberId,nlohmann::json &member)
|
||||
bool DB::get(const uint64_t networkId, nlohmann::json& network, const uint64_t memberId, nlohmann::json& member)
|
||||
{
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("db");
|
||||
auto span = tracer->StartSpan("db::getNetworkAndMember");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
char networkIdStr[17];
|
||||
char memberIdStr[11];
|
||||
span->SetAttribute("network_id", Utils::hex(networkId, networkIdStr));
|
||||
span->SetAttribute("member_id", Utils::hex(networkId, memberIdStr));
|
||||
|
||||
waitForReady();
|
||||
Metrics::db_get_network_and_member++;
|
||||
std::shared_ptr<_Network> nw;
|
||||
{
|
||||
std::lock_guard<std::mutex> l(_networks_l);
|
||||
std::shared_lock<std::shared_mutex> l(_networks_l);
|
||||
auto nwi = _networks.find(networkId);
|
||||
if (nwi == _networks.end())
|
||||
return false;
|
||||
nw = nwi->second;
|
||||
}
|
||||
{
|
||||
std::lock_guard<std::mutex> l2(nw->lock);
|
||||
std::shared_lock<std::shared_mutex> l2(nw->lock);
|
||||
network = nw->config;
|
||||
auto m = nw->members.find(memberId);
|
||||
if (m == nw->members.end())
|
||||
|
@ -137,59 +225,91 @@ bool DB::get(const uint64_t networkId,nlohmann::json &network,const uint64_t mem
|
|||
return true;
|
||||
}
|
||||
|
||||
bool DB::get(const uint64_t networkId,nlohmann::json &network,const uint64_t memberId,nlohmann::json &member,NetworkSummaryInfo &info)
|
||||
bool DB::get(const uint64_t networkId, nlohmann::json& network, const uint64_t memberId, nlohmann::json& member, NetworkSummaryInfo& info)
|
||||
{
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("db");
|
||||
auto span = tracer->StartSpan("db::getNetworkAndMemberAndSummary");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
char networkIdStr[17];
|
||||
char memberIdStr[11];
|
||||
span->SetAttribute("network_id", Utils::hex(networkId, networkIdStr));
|
||||
span->SetAttribute("member_id", Utils::hex(memberId, memberIdStr));
|
||||
|
||||
waitForReady();
|
||||
Metrics::db_get_network_and_member_and_summary++;
|
||||
std::shared_ptr<_Network> nw;
|
||||
{
|
||||
std::lock_guard<std::mutex> l(_networks_l);
|
||||
std::shared_lock<std::shared_mutex> l(_networks_l);
|
||||
auto nwi = _networks.find(networkId);
|
||||
if (nwi == _networks.end())
|
||||
return false;
|
||||
nw = nwi->second;
|
||||
}
|
||||
{
|
||||
std::lock_guard<std::mutex> l2(nw->lock);
|
||||
std::shared_lock<std::shared_mutex> l2(nw->lock);
|
||||
network = nw->config;
|
||||
_fillSummaryInfo(nw,info);
|
||||
_fillSummaryInfo(nw, info);
|
||||
auto m = nw->members.find(memberId);
|
||||
if (m == nw->members.end())
|
||||
return false;
|
||||
member = m->second;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DB::get(const uint64_t networkId,nlohmann::json &network,std::vector<nlohmann::json> &members)
|
||||
bool DB::get(const uint64_t networkId, nlohmann::json& network, std::vector<nlohmann::json>& members)
|
||||
{
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("db");
|
||||
auto span = tracer->StartSpan("db::getNetworkAndMembers");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
char networkIdStr[17];
|
||||
span->SetAttribute("network_id", Utils::hex(networkId, networkIdStr));
|
||||
|
||||
waitForReady();
|
||||
Metrics::db_get_member_list++;
|
||||
std::shared_ptr<_Network> nw;
|
||||
{
|
||||
std::lock_guard<std::mutex> l(_networks_l);
|
||||
std::shared_lock<std::shared_mutex> l(_networks_l);
|
||||
auto nwi = _networks.find(networkId);
|
||||
if (nwi == _networks.end())
|
||||
return false;
|
||||
nw = nwi->second;
|
||||
}
|
||||
{
|
||||
std::lock_guard<std::mutex> l2(nw->lock);
|
||||
std::shared_lock<std::shared_mutex> l2(nw->lock);
|
||||
network = nw->config;
|
||||
for(auto m=nw->members.begin();m!=nw->members.end();++m)
|
||||
for (auto m = nw->members.begin(); m != nw->members.end(); ++m) {
|
||||
members.push_back(m->second);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void DB::networks(std::set<uint64_t> &networks)
|
||||
void DB::networks(std::set<uint64_t>& networks)
|
||||
{
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("db");
|
||||
auto span = tracer->StartSpan("db::networks");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
|
||||
waitForReady();
|
||||
std::lock_guard<std::mutex> l(_networks_l);
|
||||
for(auto n=_networks.begin();n!=_networks.end();++n)
|
||||
Metrics::db_get_network_list++;
|
||||
std::shared_lock<std::shared_mutex> l(_networks_l);
|
||||
for (auto n = _networks.begin(); n != _networks.end(); ++n)
|
||||
networks.insert(n->first);
|
||||
}
|
||||
|
||||
void DB::_memberChanged(nlohmann::json &old,nlohmann::json &memberConfig,bool notifyListeners)
|
||||
void DB::_memberChanged(nlohmann::json& old, nlohmann::json& memberConfig, bool notifyListeners)
|
||||
{
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("db");
|
||||
auto span = tracer->StartSpan("db::_memberChanged");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
|
||||
Metrics::db_member_change++;
|
||||
uint64_t memberId = 0;
|
||||
uint64_t networkId = 0;
|
||||
bool isAuth = false;
|
||||
|
@ -197,26 +317,29 @@ void DB::_memberChanged(nlohmann::json &old,nlohmann::json &memberConfig,bool no
|
|||
std::shared_ptr<_Network> nw;
|
||||
|
||||
if (old.is_object()) {
|
||||
memberId = OSUtils::jsonIntHex(old["id"],0ULL);
|
||||
networkId = OSUtils::jsonIntHex(old["nwid"],0ULL);
|
||||
if ((memberId)&&(networkId)) {
|
||||
memberId = OSUtils::jsonIntHex(old["id"], 0ULL);
|
||||
networkId = OSUtils::jsonIntHex(old["nwid"], 0ULL);
|
||||
if ((memberId) && (networkId)) {
|
||||
{
|
||||
std::lock_guard<std::mutex> l(_networks_l);
|
||||
std::unique_lock<std::shared_mutex> l(_networks_l);
|
||||
auto nw2 = _networks.find(networkId);
|
||||
if (nw2 != _networks.end())
|
||||
if (nw2 != _networks.end()) {
|
||||
nw = nw2->second;
|
||||
}
|
||||
}
|
||||
if (nw) {
|
||||
std::lock_guard<std::mutex> l(nw->lock);
|
||||
if (OSUtils::jsonBool(old["activeBridge"],false))
|
||||
std::unique_lock<std::shared_mutex> l(nw->lock);
|
||||
if (OSUtils::jsonBool(old["activeBridge"], false)) {
|
||||
nw->activeBridgeMembers.erase(memberId);
|
||||
wasAuth = OSUtils::jsonBool(old["authorized"],false);
|
||||
if (wasAuth)
|
||||
}
|
||||
wasAuth = OSUtils::jsonBool(old["authorized"], false);
|
||||
if (wasAuth) {
|
||||
nw->authorizedMembers.erase(memberId);
|
||||
json &ips = old["ipAssignments"];
|
||||
}
|
||||
json& ips = old["ipAssignments"];
|
||||
if (ips.is_array()) {
|
||||
for(unsigned long i=0;i<ips.size();++i) {
|
||||
json &ipj = ips[i];
|
||||
for (unsigned long i = 0; i < ips.size(); ++i) {
|
||||
json& ipj = ips[i];
|
||||
if (ipj.is_string()) {
|
||||
const std::string ips = ipj;
|
||||
InetAddress ipa(ips.c_str());
|
||||
|
@ -230,32 +353,35 @@ void DB::_memberChanged(nlohmann::json &old,nlohmann::json &memberConfig,bool no
|
|||
}
|
||||
|
||||
if (memberConfig.is_object()) {
|
||||
if (!nw) {
|
||||
memberId = OSUtils::jsonIntHex(memberConfig["id"],0ULL);
|
||||
networkId = OSUtils::jsonIntHex(memberConfig["nwid"],0ULL);
|
||||
if ((!memberId)||(!networkId))
|
||||
if (! nw) {
|
||||
memberId = OSUtils::jsonIntHex(memberConfig["id"], 0ULL);
|
||||
networkId = OSUtils::jsonIntHex(memberConfig["nwid"], 0ULL);
|
||||
if ((! memberId) || (! networkId))
|
||||
return;
|
||||
std::lock_guard<std::mutex> l(_networks_l);
|
||||
std::shared_ptr<_Network> &nw2 = _networks[networkId];
|
||||
if (!nw2)
|
||||
std::unique_lock<std::shared_mutex> l(_networks_l);
|
||||
std::shared_ptr<_Network>& nw2 = _networks[networkId];
|
||||
if (! nw2)
|
||||
nw2.reset(new _Network);
|
||||
nw = nw2;
|
||||
}
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> l(nw->lock);
|
||||
std::unique_lock<std::shared_mutex> l(nw->lock);
|
||||
|
||||
nw->members[memberId] = memberConfig;
|
||||
|
||||
if (OSUtils::jsonBool(memberConfig["activeBridge"],false))
|
||||
if (OSUtils::jsonBool(memberConfig["activeBridge"], false)) {
|
||||
nw->activeBridgeMembers.insert(memberId);
|
||||
isAuth = OSUtils::jsonBool(memberConfig["authorized"],false);
|
||||
if (isAuth)
|
||||
}
|
||||
isAuth = OSUtils::jsonBool(memberConfig["authorized"], false);
|
||||
if (isAuth) {
|
||||
Metrics::member_auths++;
|
||||
nw->authorizedMembers.insert(memberId);
|
||||
json &ips = memberConfig["ipAssignments"];
|
||||
}
|
||||
json& ips = memberConfig["ipAssignments"];
|
||||
if (ips.is_array()) {
|
||||
for(unsigned long i=0;i<ips.size();++i) {
|
||||
json &ipj = ips[i];
|
||||
for (unsigned long i = 0; i < ips.size(); ++i) {
|
||||
json& ipj = ips[i];
|
||||
if (ipj.is_string()) {
|
||||
const std::string ips = ipj;
|
||||
InetAddress ipa(ips.c_str());
|
||||
|
@ -265,28 +391,29 @@ void DB::_memberChanged(nlohmann::json &old,nlohmann::json &memberConfig,bool no
|
|||
}
|
||||
}
|
||||
|
||||
if (!isAuth) {
|
||||
const int64_t ldt = (int64_t)OSUtils::jsonInt(memberConfig["lastDeauthorizedTime"],0ULL);
|
||||
if (! isAuth) {
|
||||
const int64_t ldt = (int64_t)OSUtils::jsonInt(memberConfig["lastDeauthorizedTime"], 0ULL);
|
||||
if (ldt > nw->mostRecentDeauthTime)
|
||||
nw->mostRecentDeauthTime = ldt;
|
||||
}
|
||||
}
|
||||
|
||||
if (notifyListeners) {
|
||||
std::lock_guard<std::mutex> ll(_changeListeners_l);
|
||||
for(auto i=_changeListeners.begin();i!=_changeListeners.end();++i) {
|
||||
(*i)->onNetworkMemberUpdate(this,networkId,memberId,memberConfig);
|
||||
std::unique_lock<std::shared_mutex> ll(_changeListeners_l);
|
||||
for (auto i = _changeListeners.begin(); i != _changeListeners.end(); ++i) {
|
||||
(*i)->onNetworkMemberUpdate(this, networkId, memberId, memberConfig);
|
||||
}
|
||||
}
|
||||
} else if (memberId) {
|
||||
}
|
||||
else if (memberId) {
|
||||
if (nw) {
|
||||
std::lock_guard<std::mutex> l(nw->lock);
|
||||
std::unique_lock<std::shared_mutex> l(nw->lock);
|
||||
nw->members.erase(memberId);
|
||||
}
|
||||
if (networkId) {
|
||||
std::lock_guard<std::mutex> l(_networks_l);
|
||||
std::unique_lock<std::shared_mutex> l(_networks_l);
|
||||
auto er = _networkByMember.equal_range(memberId);
|
||||
for(auto i=er.first;i!=er.second;++i) {
|
||||
for (auto i = er.first; i != er.second; ++i) {
|
||||
if (i->second == networkId) {
|
||||
_networkByMember.erase(i);
|
||||
break;
|
||||
|
@ -295,60 +422,127 @@ void DB::_memberChanged(nlohmann::json &old,nlohmann::json &memberConfig,bool no
|
|||
}
|
||||
}
|
||||
|
||||
if ((notifyListeners)&&((wasAuth)&&(!isAuth)&&(networkId)&&(memberId))) {
|
||||
std::lock_guard<std::mutex> ll(_changeListeners_l);
|
||||
for(auto i=_changeListeners.begin();i!=_changeListeners.end();++i) {
|
||||
(*i)->onNetworkMemberDeauthorize(this,networkId,memberId);
|
||||
if (notifyListeners) {
|
||||
if (networkId != 0 && memberId != 0 && old.is_object() && ! memberConfig.is_object()) {
|
||||
// member delete
|
||||
Metrics::member_count--;
|
||||
}
|
||||
else if (networkId != 0 && memberId != 0 && ! old.is_object() && memberConfig.is_object()) {
|
||||
// new member
|
||||
Metrics::member_count++;
|
||||
}
|
||||
|
||||
if (! wasAuth && isAuth) {
|
||||
Metrics::member_auths++;
|
||||
}
|
||||
else if (wasAuth && ! isAuth) {
|
||||
Metrics::member_deauths++;
|
||||
}
|
||||
else {
|
||||
Metrics::member_changes++;
|
||||
}
|
||||
}
|
||||
|
||||
if ((notifyListeners) && ((wasAuth) && (! isAuth) && (networkId) && (memberId))) {
|
||||
std::unique_lock<std::shared_mutex> ll(_changeListeners_l);
|
||||
for (auto i = _changeListeners.begin(); i != _changeListeners.end(); ++i) {
|
||||
(*i)->onNetworkMemberDeauthorize(this, networkId, memberId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DB::_networkChanged(nlohmann::json &old,nlohmann::json &networkConfig,bool notifyListeners)
|
||||
void DB::_networkChanged(nlohmann::json& old, nlohmann::json& networkConfig, bool notifyListeners)
|
||||
{
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("db");
|
||||
auto span = tracer->StartSpan("db::_networkChanged");
|
||||
span->SetAttribute("old_network_config", old.dump());
|
||||
span->SetAttribute("network_config", networkConfig.dump());
|
||||
span->SetAttribute("notify_listeners", notifyListeners);
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
|
||||
Metrics::db_network_change++;
|
||||
if (notifyListeners) {
|
||||
if (old.is_object() && old.contains("id") && networkConfig.is_object() && networkConfig.contains("id")) {
|
||||
Metrics::network_changes++;
|
||||
}
|
||||
else if (! old.is_object() && networkConfig.is_object() && networkConfig.contains("id")) {
|
||||
Metrics::network_count++;
|
||||
}
|
||||
else if (old.is_object() && old.contains("id") && ! networkConfig.is_object()) {
|
||||
Metrics::network_count--;
|
||||
}
|
||||
}
|
||||
|
||||
if (networkConfig.is_object()) {
|
||||
const std::string ids = networkConfig["id"];
|
||||
const uint64_t networkId = Utils::hexStrToU64(ids.c_str());
|
||||
if (networkId) {
|
||||
std::shared_ptr<_Network> nw;
|
||||
{
|
||||
std::lock_guard<std::mutex> l(_networks_l);
|
||||
std::shared_ptr<_Network> &nw2 = _networks[networkId];
|
||||
if (!nw2)
|
||||
std::unique_lock<std::shared_mutex> l(_networks_l);
|
||||
std::shared_ptr<_Network>& nw2 = _networks[networkId];
|
||||
if (! nw2)
|
||||
nw2.reset(new _Network);
|
||||
nw = nw2;
|
||||
}
|
||||
{
|
||||
std::lock_guard<std::mutex> l2(nw->lock);
|
||||
std::unique_lock<std::shared_mutex> l2(nw->lock);
|
||||
nw->config = networkConfig;
|
||||
}
|
||||
if (notifyListeners) {
|
||||
std::lock_guard<std::mutex> ll(_changeListeners_l);
|
||||
for(auto i=_changeListeners.begin();i!=_changeListeners.end();++i) {
|
||||
(*i)->onNetworkUpdate(this,networkId,networkConfig);
|
||||
std::unique_lock<std::shared_mutex> ll(_changeListeners_l);
|
||||
for (auto i = _changeListeners.begin(); i != _changeListeners.end(); ++i) {
|
||||
(*i)->onNetworkUpdate(this, networkId, networkConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (old.is_object()) {
|
||||
}
|
||||
else if (old.is_object()) {
|
||||
const std::string ids = old["id"];
|
||||
const uint64_t networkId = Utils::hexStrToU64(ids.c_str());
|
||||
if (networkId) {
|
||||
std::lock_guard<std::mutex> l(_networks_l);
|
||||
try {
|
||||
// deauth all members on the network
|
||||
nlohmann::json network;
|
||||
std::vector<nlohmann::json> members;
|
||||
this->get(networkId, network, members);
|
||||
for (auto i = members.begin(); i != members.end(); ++i) {
|
||||
const std::string nodeID = (*i)["id"];
|
||||
const uint64_t memberId = Utils::hexStrToU64(nodeID.c_str());
|
||||
std::unique_lock<std::shared_mutex> ll(_changeListeners_l);
|
||||
for (auto j = _changeListeners.begin(); j != _changeListeners.end(); ++j) {
|
||||
(*j)->onNetworkMemberDeauthorize(this, networkId, memberId);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (std::exception& e) {
|
||||
std::cerr << "Error deauthorizing members on network delete: " << e.what() << std::endl;
|
||||
}
|
||||
|
||||
// delete the network
|
||||
std::unique_lock<std::shared_mutex> l(_networks_l);
|
||||
_networks.erase(networkId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DB::_fillSummaryInfo(const std::shared_ptr<_Network> &nw,NetworkSummaryInfo &info)
|
||||
void DB::_fillSummaryInfo(const std::shared_ptr<_Network>& nw, NetworkSummaryInfo& info)
|
||||
{
|
||||
for(auto ab=nw->activeBridgeMembers.begin();ab!=nw->activeBridgeMembers.end();++ab)
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("db");
|
||||
auto span = tracer->StartSpan("db::_fillSummaryInfo");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
|
||||
for (auto ab = nw->activeBridgeMembers.begin(); ab != nw->activeBridgeMembers.end(); ++ab)
|
||||
info.activeBridges.push_back(Address(*ab));
|
||||
std::sort(info.activeBridges.begin(),info.activeBridges.end());
|
||||
for(auto ip=nw->allocatedIps.begin();ip!=nw->allocatedIps.end();++ip)
|
||||
std::sort(info.activeBridges.begin(), info.activeBridges.end());
|
||||
for (auto ip = nw->allocatedIps.begin(); ip != nw->allocatedIps.end(); ++ip)
|
||||
info.allocatedIps.push_back(*ip);
|
||||
std::sort(info.allocatedIps.begin(),info.allocatedIps.end());
|
||||
std::sort(info.allocatedIps.begin(), info.allocatedIps.end());
|
||||
info.authorizedMemberCount = (unsigned long)nw->authorizedMembers.size();
|
||||
info.totalMemberCount = (unsigned long)nw->members.size();
|
||||
info.mostRecentDeauthTime = nw->mostRecentDeauthTime;
|
||||
}
|
||||
|
||||
} // namespace ZeroTier
|
||||
} // namespace ZeroTier
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file in the project's root directory.
|
||||
*
|
||||
* Change Date: 2025-01-01
|
||||
* Change Date: 2026-01-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2.0 of the Apache License.
|
||||
|
@ -14,48 +14,77 @@
|
|||
#ifndef ZT_CONTROLLER_DB_HPP
|
||||
#define ZT_CONTROLLER_DB_HPP
|
||||
|
||||
//#define ZT_CONTROLLER_USE_LIBPQ
|
||||
// #define ZT_CONTROLLER_USE_LIBPQ
|
||||
|
||||
#include "../node/Constants.hpp"
|
||||
#include "../node/Identity.hpp"
|
||||
#include "../node/InetAddress.hpp"
|
||||
#include "../osdep/OSUtils.hpp"
|
||||
#include "../osdep/BlockingQueue.hpp"
|
||||
#include "../osdep/OSUtils.hpp"
|
||||
|
||||
#include <atomic>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <prometheus/simpleapi.h>
|
||||
#include <set>
|
||||
#include <shared_mutex>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
#include <atomic>
|
||||
#include <mutex>
|
||||
#include <set>
|
||||
|
||||
#include "../ext/json/json.hpp"
|
||||
#define ZT_MEMBER_AUTH_TIMEOUT_NOTIFY_BEFORE 25000
|
||||
|
||||
namespace ZeroTier
|
||||
{
|
||||
namespace ZeroTier {
|
||||
|
||||
struct AuthInfo {
|
||||
public:
|
||||
AuthInfo() : enabled(false), version(0), authenticationURL(), authenticationExpiryTime(0), issuerURL(), centralAuthURL(), ssoNonce(), ssoState(), ssoClientID(), ssoProvider("default")
|
||||
{
|
||||
}
|
||||
|
||||
bool enabled;
|
||||
uint64_t version;
|
||||
std::string authenticationURL;
|
||||
uint64_t authenticationExpiryTime;
|
||||
std::string issuerURL;
|
||||
std::string centralAuthURL;
|
||||
std::string ssoNonce;
|
||||
std::string ssoState;
|
||||
std::string ssoClientID;
|
||||
std::string ssoProvider;
|
||||
};
|
||||
|
||||
/**
|
||||
* Base class with common infrastructure for all controller DB implementations
|
||||
*/
|
||||
class DB
|
||||
{
|
||||
public:
|
||||
class ChangeListener
|
||||
{
|
||||
public:
|
||||
ChangeListener() {}
|
||||
virtual ~ChangeListener() {}
|
||||
virtual void onNetworkUpdate(const void *db,uint64_t networkId,const nlohmann::json &network) {}
|
||||
virtual void onNetworkMemberUpdate(const void *db,uint64_t networkId,uint64_t memberId,const nlohmann::json &member) {}
|
||||
virtual void onNetworkMemberDeauthorize(const void *db,uint64_t networkId,uint64_t memberId) {}
|
||||
class DB {
|
||||
public:
|
||||
class ChangeListener {
|
||||
public:
|
||||
ChangeListener()
|
||||
{
|
||||
}
|
||||
virtual ~ChangeListener()
|
||||
{
|
||||
}
|
||||
virtual void onNetworkUpdate(const void* db, uint64_t networkId, const nlohmann::json& network)
|
||||
{
|
||||
}
|
||||
virtual void onNetworkMemberUpdate(const void* db, uint64_t networkId, uint64_t memberId, const nlohmann::json& member)
|
||||
{
|
||||
}
|
||||
virtual void onNetworkMemberDeauthorize(const void* db, uint64_t networkId, uint64_t memberId)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
struct NetworkSummaryInfo
|
||||
{
|
||||
NetworkSummaryInfo() : authorizedMemberCount(0),totalMemberCount(0),mostRecentDeauthTime(0) {}
|
||||
struct NetworkSummaryInfo {
|
||||
NetworkSummaryInfo() : authorizedMemberCount(0), totalMemberCount(0), mostRecentDeauthTime(0)
|
||||
{
|
||||
}
|
||||
std::vector<Address> activeBridges;
|
||||
std::vector<InetAddress> allocatedIps;
|
||||
unsigned long authorizedMemberCount;
|
||||
|
@ -63,10 +92,10 @@ public:
|
|||
int64_t mostRecentDeauthTime;
|
||||
};
|
||||
|
||||
static void initNetwork(nlohmann::json &network);
|
||||
static void initMember(nlohmann::json &member);
|
||||
static void cleanNetwork(nlohmann::json &network);
|
||||
static void cleanMember(nlohmann::json &member);
|
||||
static void initNetwork(nlohmann::json& network);
|
||||
static void initMember(nlohmann::json& member);
|
||||
static void cleanNetwork(nlohmann::json& network);
|
||||
static void cleanMember(nlohmann::json& member);
|
||||
|
||||
DB();
|
||||
virtual ~DB();
|
||||
|
@ -76,45 +105,48 @@ public:
|
|||
|
||||
inline bool hasNetwork(const uint64_t networkId) const
|
||||
{
|
||||
std::lock_guard<std::mutex> l(_networks_l);
|
||||
std::shared_lock<std::shared_mutex> l(_networks_l);
|
||||
return (_networks.find(networkId) != _networks.end());
|
||||
}
|
||||
|
||||
bool get(const uint64_t networkId,nlohmann::json &network);
|
||||
bool get(const uint64_t networkId,nlohmann::json &network,const uint64_t memberId,nlohmann::json &member);
|
||||
bool get(const uint64_t networkId,nlohmann::json &network,const uint64_t memberId,nlohmann::json &member,NetworkSummaryInfo &info);
|
||||
bool get(const uint64_t networkId,nlohmann::json &network,std::vector<nlohmann::json> &members);
|
||||
bool get(const uint64_t networkId, nlohmann::json& network);
|
||||
bool get(const uint64_t networkId, nlohmann::json& network, const uint64_t memberId, nlohmann::json& member);
|
||||
bool get(const uint64_t networkId, nlohmann::json& network, const uint64_t memberId, nlohmann::json& member, NetworkSummaryInfo& info);
|
||||
bool get(const uint64_t networkId, nlohmann::json& network, std::vector<nlohmann::json>& members);
|
||||
|
||||
void networks(std::set<uint64_t> &networks);
|
||||
void networks(std::set<uint64_t>& networks);
|
||||
|
||||
template<typename F>
|
||||
inline void each(F f)
|
||||
template <typename F> inline void each(F f)
|
||||
{
|
||||
nlohmann::json nullJson;
|
||||
std::lock_guard<std::mutex> lck(_networks_l);
|
||||
for(auto nw=_networks.begin();nw!=_networks.end();++nw) {
|
||||
f(nw->first,nw->second->config,0,nullJson); // first provide network with 0 for member ID
|
||||
for(auto m=nw->second->members.begin();m!=nw->second->members.end();++m) {
|
||||
f(nw->first,nw->second->config,m->first,m->second);
|
||||
std::unique_lock<std::shared_mutex> lck(_networks_l);
|
||||
for (auto nw = _networks.begin(); nw != _networks.end(); ++nw) {
|
||||
f(nw->first, nw->second->config, 0, nullJson); // first provide network with 0 for member ID
|
||||
for (auto m = nw->second->members.begin(); m != nw->second->members.end(); ++m) {
|
||||
f(nw->first, nw->second->config, m->first, m->second);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool save(nlohmann::json &record,bool notifyListeners) = 0;
|
||||
|
||||
virtual bool save(nlohmann::json& record, bool notifyListeners) = 0;
|
||||
virtual void eraseNetwork(const uint64_t networkId) = 0;
|
||||
virtual void eraseMember(const uint64_t networkId,const uint64_t memberId) = 0;
|
||||
virtual void eraseMember(const uint64_t networkId, const uint64_t memberId) = 0;
|
||||
virtual void nodeIsOnline(const uint64_t networkId, const uint64_t memberId, const InetAddress& physicalAddress) = 0;
|
||||
virtual void nodeIsOnline(const uint64_t networkId, const uint64_t memberId, const InetAddress& physicalAddress, const char* osArch) = 0;
|
||||
|
||||
virtual void nodeIsOnline(const uint64_t networkId,const uint64_t memberId,const InetAddress &physicalAddress) = 0;
|
||||
|
||||
inline void addListener(DB::ChangeListener *const listener)
|
||||
virtual AuthInfo getSSOAuthInfo(const nlohmann::json& member, const std::string& redirectURL)
|
||||
{
|
||||
std::lock_guard<std::mutex> l(_changeListeners_l);
|
||||
return AuthInfo();
|
||||
}
|
||||
|
||||
inline void addListener(DB::ChangeListener* const listener)
|
||||
{
|
||||
std::unique_lock<std::shared_mutex> l(_changeListeners_l);
|
||||
_changeListeners.push_back(listener);
|
||||
}
|
||||
|
||||
protected:
|
||||
static inline bool _compareRecords(const nlohmann::json &a,const nlohmann::json &b)
|
||||
protected:
|
||||
static inline bool _compareRecords(const nlohmann::json& a, const nlohmann::json& b)
|
||||
{
|
||||
if (a.is_object() == b.is_object()) {
|
||||
if (a.is_object()) {
|
||||
|
@ -122,10 +154,10 @@ protected:
|
|||
return false;
|
||||
auto amap = a.get<nlohmann::json::object_t>();
|
||||
auto bmap = b.get<nlohmann::json::object_t>();
|
||||
for(auto ai=amap.begin();ai!=amap.end();++ai) {
|
||||
if (ai->first != "revision") { // ignore revision, compare only non-revision-counter fields
|
||||
for (auto ai = amap.begin(); ai != amap.end(); ++ai) {
|
||||
if (ai->first != "revision") { // ignore revision, compare only non-revision-counter fields
|
||||
auto bi = bmap.find(ai->first);
|
||||
if ((bi == bmap.end())||(bi->second != ai->second))
|
||||
if ((bi == bmap.end()) || (bi->second != ai->second))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -136,29 +168,30 @@ protected:
|
|||
return false;
|
||||
}
|
||||
|
||||
struct _Network
|
||||
{
|
||||
_Network() : mostRecentDeauthTime(0) {}
|
||||
struct _Network {
|
||||
_Network() : mostRecentDeauthTime(0)
|
||||
{
|
||||
}
|
||||
nlohmann::json config;
|
||||
std::unordered_map<uint64_t,nlohmann::json> members;
|
||||
std::unordered_map<uint64_t, nlohmann::json> members;
|
||||
std::unordered_set<uint64_t> activeBridgeMembers;
|
||||
std::unordered_set<uint64_t> authorizedMembers;
|
||||
std::unordered_set<InetAddress,InetAddress::Hasher> allocatedIps;
|
||||
std::unordered_set<InetAddress, InetAddress::Hasher> allocatedIps;
|
||||
int64_t mostRecentDeauthTime;
|
||||
std::mutex lock;
|
||||
std::shared_mutex lock;
|
||||
};
|
||||
|
||||
void _memberChanged(nlohmann::json &old,nlohmann::json &memberConfig,bool notifyListeners);
|
||||
void _networkChanged(nlohmann::json &old,nlohmann::json &networkConfig,bool notifyListeners);
|
||||
void _fillSummaryInfo(const std::shared_ptr<_Network> &nw,NetworkSummaryInfo &info);
|
||||
virtual void _memberChanged(nlohmann::json& old, nlohmann::json& memberConfig, bool notifyListeners);
|
||||
virtual void _networkChanged(nlohmann::json& old, nlohmann::json& networkConfig, bool notifyListeners);
|
||||
void _fillSummaryInfo(const std::shared_ptr<_Network>& nw, NetworkSummaryInfo& info);
|
||||
|
||||
std::vector<DB::ChangeListener *> _changeListeners;
|
||||
std::unordered_map< uint64_t,std::shared_ptr<_Network> > _networks;
|
||||
std::unordered_multimap< uint64_t,uint64_t > _networkByMember;
|
||||
mutable std::mutex _changeListeners_l;
|
||||
mutable std::mutex _networks_l;
|
||||
std::vector<DB::ChangeListener*> _changeListeners;
|
||||
std::unordered_map<uint64_t, std::shared_ptr<_Network> > _networks;
|
||||
std::unordered_multimap<uint64_t, uint64_t> _networkByMember;
|
||||
mutable std::shared_mutex _changeListeners_l;
|
||||
mutable std::shared_mutex _networks_l;
|
||||
};
|
||||
|
||||
} // namespace ZeroTier
|
||||
} // namespace ZeroTier
|
||||
|
||||
#endif
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file in the project's root directory.
|
||||
*
|
||||
* Change Date: 2025-01-01
|
||||
* Change Date: 2026-01-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2.0 of the Apache License.
|
||||
|
@ -13,55 +13,63 @@
|
|||
|
||||
#include "DBMirrorSet.hpp"
|
||||
|
||||
#include "opentelemetry/trace/provider.h"
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
DBMirrorSet::DBMirrorSet(DB::ChangeListener *listener) :
|
||||
_listener(listener),
|
||||
_running(true)
|
||||
DBMirrorSet::DBMirrorSet(DB::ChangeListener* listener) : _listener(listener), _running(true), _syncCheckerThread(), _dbs(), _dbs_l()
|
||||
{
|
||||
_syncCheckerThread = std::thread([this]() {
|
||||
for(;;) {
|
||||
for(int i=0;i<120;++i) { // 1 minute delay between checks
|
||||
if (!_running)
|
||||
for (;;) {
|
||||
for (int i = 0; i < 120; ++i) { // 1 minute delay between checks
|
||||
if (! _running)
|
||||
return;
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
}
|
||||
|
||||
std::vector< std::shared_ptr<DB> > dbs;
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("db_mirror_set");
|
||||
auto span = tracer->StartSpan("db::syncChecker");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
|
||||
std::vector<std::shared_ptr<DB> > dbs;
|
||||
{
|
||||
std::lock_guard<std::mutex> l(_dbs_l);
|
||||
std::unique_lock<std::shared_mutex> l(_dbs_l);
|
||||
if (_dbs.size() <= 1)
|
||||
continue; // no need to do this if there's only one DB, so skip the iteration
|
||||
continue; // no need to do this if there's only one DB, so skip the iteration
|
||||
dbs = _dbs;
|
||||
}
|
||||
|
||||
for(auto db=dbs.begin();db!=dbs.end();++db) {
|
||||
(*db)->each([this,&dbs,&db](uint64_t networkId,const nlohmann::json &network,uint64_t memberId,const nlohmann::json &member) {
|
||||
for (auto db = dbs.begin(); db != dbs.end(); ++db) {
|
||||
(*db)->each([&dbs, &db](uint64_t networkId, const nlohmann::json& network, uint64_t memberId, const nlohmann::json& member) {
|
||||
try {
|
||||
if (network.is_object()) {
|
||||
if (memberId == 0) {
|
||||
for(auto db2=dbs.begin();db2!=dbs.end();++db2) {
|
||||
for (auto db2 = dbs.begin(); db2 != dbs.end(); ++db2) {
|
||||
if (db->get() != db2->get()) {
|
||||
nlohmann::json nw2;
|
||||
if ((!(*db2)->get(networkId,nw2))||((nw2.is_object())&&(OSUtils::jsonInt(nw2["revision"],0) < OSUtils::jsonInt(network["revision"],0)))) {
|
||||
if ((! (*db2)->get(networkId, nw2)) || ((nw2.is_object()) && (OSUtils::jsonInt(nw2["revision"], 0) < OSUtils::jsonInt(network["revision"], 0)))) {
|
||||
nw2 = network;
|
||||
(*db2)->save(nw2,false);
|
||||
(*db2)->save(nw2, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (member.is_object()) {
|
||||
for(auto db2=dbs.begin();db2!=dbs.end();++db2) {
|
||||
}
|
||||
else if (member.is_object()) {
|
||||
for (auto db2 = dbs.begin(); db2 != dbs.end(); ++db2) {
|
||||
if (db->get() != db2->get()) {
|
||||
nlohmann::json nw2,m2;
|
||||
if ((!(*db2)->get(networkId,nw2,memberId,m2))||((m2.is_object())&&(OSUtils::jsonInt(m2["revision"],0) < OSUtils::jsonInt(member["revision"],0)))) {
|
||||
nlohmann::json nw2, m2;
|
||||
if ((! (*db2)->get(networkId, nw2, memberId, m2)) || ((m2.is_object()) && (OSUtils::jsonInt(m2["revision"], 0) < OSUtils::jsonInt(member["revision"], 0)))) {
|
||||
m2 = member;
|
||||
(*db2)->save(m2,false);
|
||||
(*db2)->save(m2, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch ( ... ) {} // skip entries that generate JSON errors
|
||||
}
|
||||
catch (...) {
|
||||
} // skip entries that generate JSON errors
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -76,68 +84,132 @@ DBMirrorSet::~DBMirrorSet()
|
|||
|
||||
bool DBMirrorSet::hasNetwork(const uint64_t networkId) const
|
||||
{
|
||||
std::lock_guard<std::mutex> l(_dbs_l);
|
||||
for(auto d=_dbs.begin();d!=_dbs.end();++d) {
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("db_mirror_set");
|
||||
auto span = tracer->StartSpan("db_mirror_set::hasNetwork");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
|
||||
std::shared_lock<std::shared_mutex> l(_dbs_l);
|
||||
for (auto d = _dbs.begin(); d != _dbs.end(); ++d) {
|
||||
if ((*d)->hasNetwork(networkId))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DBMirrorSet::get(const uint64_t networkId,nlohmann::json &network)
|
||||
bool DBMirrorSet::get(const uint64_t networkId, nlohmann::json& network)
|
||||
{
|
||||
std::lock_guard<std::mutex> l(_dbs_l);
|
||||
for(auto d=_dbs.begin();d!=_dbs.end();++d) {
|
||||
if ((*d)->get(networkId,network)) {
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("db_mirror_set");
|
||||
auto span = tracer->StartSpan("db_mirror_set::getNetwork");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
char networkIdStr[17];
|
||||
span->SetAttribute("network_id", Utils::hex(networkId, networkIdStr));
|
||||
|
||||
std::shared_lock<std::shared_mutex> l(_dbs_l);
|
||||
for (auto d = _dbs.begin(); d != _dbs.end(); ++d) {
|
||||
if ((*d)->get(networkId, network)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DBMirrorSet::get(const uint64_t networkId,nlohmann::json &network,const uint64_t memberId,nlohmann::json &member)
|
||||
bool DBMirrorSet::get(const uint64_t networkId, nlohmann::json& network, const uint64_t memberId, nlohmann::json& member)
|
||||
{
|
||||
std::lock_guard<std::mutex> l(_dbs_l);
|
||||
for(auto d=_dbs.begin();d!=_dbs.end();++d) {
|
||||
if ((*d)->get(networkId,network,memberId,member))
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("db_mirror_set");
|
||||
auto span = tracer->StartSpan("db_mirror_set::getNetworkAndMember");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
char networkIdStr[17];
|
||||
char memberIdStr[11];
|
||||
span->SetAttribute("network_id", Utils::hex(networkId, networkIdStr));
|
||||
span->SetAttribute("member_id", Utils::hex10(memberId, memberIdStr));
|
||||
|
||||
std::shared_lock<std::shared_mutex> l(_dbs_l);
|
||||
for (auto d = _dbs.begin(); d != _dbs.end(); ++d) {
|
||||
if ((*d)->get(networkId, network, memberId, member))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DBMirrorSet::get(const uint64_t networkId,nlohmann::json &network,const uint64_t memberId,nlohmann::json &member,DB::NetworkSummaryInfo &info)
|
||||
bool DBMirrorSet::get(const uint64_t networkId, nlohmann::json& network, const uint64_t memberId, nlohmann::json& member, DB::NetworkSummaryInfo& info)
|
||||
{
|
||||
std::lock_guard<std::mutex> l(_dbs_l);
|
||||
for(auto d=_dbs.begin();d!=_dbs.end();++d) {
|
||||
if ((*d)->get(networkId,network,memberId,member,info))
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("db_mirror_set");
|
||||
auto span = tracer->StartSpan("db_mirror_set::getNetworkAndMemberWithSummary");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
char networkIdStr[17];
|
||||
char memberIdStr[11];
|
||||
span->SetAttribute("network_id", Utils::hex(networkId, networkIdStr));
|
||||
span->SetAttribute("member_id", Utils::hex10(memberId, memberIdStr));
|
||||
|
||||
std::shared_lock<std::shared_mutex> l(_dbs_l);
|
||||
for (auto d = _dbs.begin(); d != _dbs.end(); ++d) {
|
||||
if ((*d)->get(networkId, network, memberId, member, info))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DBMirrorSet::get(const uint64_t networkId,nlohmann::json &network,std::vector<nlohmann::json> &members)
|
||||
bool DBMirrorSet::get(const uint64_t networkId, nlohmann::json& network, std::vector<nlohmann::json>& members)
|
||||
{
|
||||
std::lock_guard<std::mutex> l(_dbs_l);
|
||||
for(auto d=_dbs.begin();d!=_dbs.end();++d) {
|
||||
if ((*d)->get(networkId,network,members))
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("db_mirror_set");
|
||||
auto span = tracer->StartSpan("db_mirror_set::getNetworkAndMembers");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
char networkIdStr[17];
|
||||
span->SetAttribute("network_id", Utils::hex(networkId, networkIdStr));
|
||||
|
||||
std::shared_lock<std::shared_mutex> l(_dbs_l);
|
||||
for (auto d = _dbs.begin(); d != _dbs.end(); ++d) {
|
||||
if ((*d)->get(networkId, network, members))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void DBMirrorSet::networks(std::set<uint64_t> &networks)
|
||||
AuthInfo DBMirrorSet::getSSOAuthInfo(const nlohmann::json& member, const std::string& redirectURL)
|
||||
{
|
||||
std::lock_guard<std::mutex> l(_dbs_l);
|
||||
for(auto d=_dbs.begin();d!=_dbs.end();++d) {
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("db_mirror_set");
|
||||
auto span = tracer->StartSpan("db_mirror_set::getSSOAuthInfo");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
|
||||
std::shared_lock<std::shared_mutex> l(_dbs_l);
|
||||
for (auto d = _dbs.begin(); d != _dbs.end(); ++d) {
|
||||
AuthInfo info = (*d)->getSSOAuthInfo(member, redirectURL);
|
||||
if (info.enabled) {
|
||||
return info;
|
||||
}
|
||||
}
|
||||
return AuthInfo();
|
||||
}
|
||||
|
||||
void DBMirrorSet::networks(std::set<uint64_t>& networks)
|
||||
{
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("db_mirror_set");
|
||||
auto span = tracer->StartSpan("db_mirror_set::networks");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
|
||||
std::shared_lock<std::shared_mutex> l(_dbs_l);
|
||||
for (auto d = _dbs.begin(); d != _dbs.end(); ++d) {
|
||||
(*d)->networks(networks);
|
||||
}
|
||||
}
|
||||
|
||||
bool DBMirrorSet::waitForReady()
|
||||
{
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("db_mirror_set");
|
||||
auto span = tracer->StartSpan("db_mirror_set::waitForReady");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
|
||||
bool r = false;
|
||||
std::lock_guard<std::mutex> l(_dbs_l);
|
||||
for(auto d=_dbs.begin();d!=_dbs.end();++d) {
|
||||
std::shared_lock<std::shared_mutex> l(_dbs_l);
|
||||
for (auto d = _dbs.begin(); d != _dbs.end(); ++d) {
|
||||
r |= (*d)->waitForReady();
|
||||
}
|
||||
return r;
|
||||
|
@ -145,31 +217,42 @@ bool DBMirrorSet::waitForReady()
|
|||
|
||||
bool DBMirrorSet::isReady()
|
||||
{
|
||||
std::lock_guard<std::mutex> l(_dbs_l);
|
||||
for(auto d=_dbs.begin();d!=_dbs.end();++d) {
|
||||
if (!(*d)->isReady())
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("db_mirror_set");
|
||||
auto span = tracer->StartSpan("db_mirror_set::isReady");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
|
||||
std::shared_lock<std::shared_mutex> l(_dbs_l);
|
||||
for (auto d = _dbs.begin(); d != _dbs.end(); ++d) {
|
||||
if (! (*d)->isReady())
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DBMirrorSet::save(nlohmann::json &record,bool notifyListeners)
|
||||
bool DBMirrorSet::save(nlohmann::json& record, bool notifyListeners)
|
||||
{
|
||||
std::vector< std::shared_ptr<DB> > dbs;
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("db_mirror_set");
|
||||
auto span = tracer->StartSpan("db_mirror_set::save");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
|
||||
std::vector<std::shared_ptr<DB> > dbs;
|
||||
{
|
||||
std::lock_guard<std::mutex> l(_dbs_l);
|
||||
std::unique_lock<std::shared_mutex> l(_dbs_l);
|
||||
dbs = _dbs;
|
||||
}
|
||||
if (notifyListeners) {
|
||||
for(auto d=dbs.begin();d!=dbs.end();++d) {
|
||||
if ((*d)->save(record,true))
|
||||
for (auto d = dbs.begin(); d != dbs.end(); ++d) {
|
||||
if ((*d)->save(record, true))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
bool modified = false;
|
||||
for(auto d=dbs.begin();d!=dbs.end();++d) {
|
||||
modified |= (*d)->save(record,false);
|
||||
for (auto d = dbs.begin(); d != dbs.end(); ++d) {
|
||||
modified |= (*d)->save(record, false);
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
|
@ -177,55 +260,113 @@ bool DBMirrorSet::save(nlohmann::json &record,bool notifyListeners)
|
|||
|
||||
void DBMirrorSet::eraseNetwork(const uint64_t networkId)
|
||||
{
|
||||
std::lock_guard<std::mutex> l(_dbs_l);
|
||||
for(auto d=_dbs.begin();d!=_dbs.end();++d) {
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("db_mirror_set");
|
||||
auto span = tracer->StartSpan("db_mirror_set::eraseNetwork");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
char networkIdStr[17];
|
||||
span->SetAttribute("network_id", Utils::hex(networkId, networkIdStr));
|
||||
|
||||
std::unique_lock<std::shared_mutex> l(_dbs_l);
|
||||
for (auto d = _dbs.begin(); d != _dbs.end(); ++d) {
|
||||
(*d)->eraseNetwork(networkId);
|
||||
}
|
||||
}
|
||||
|
||||
void DBMirrorSet::eraseMember(const uint64_t networkId,const uint64_t memberId)
|
||||
void DBMirrorSet::eraseMember(const uint64_t networkId, const uint64_t memberId)
|
||||
{
|
||||
std::lock_guard<std::mutex> l(_dbs_l);
|
||||
for(auto d=_dbs.begin();d!=_dbs.end();++d) {
|
||||
(*d)->eraseMember(networkId,memberId);
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("db_mirror_set");
|
||||
auto span = tracer->StartSpan("db_mirror_set::eraseMember");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
char networkIdStr[17];
|
||||
char memberIdStr[11];
|
||||
span->SetAttribute("network_id", Utils::hex(networkId, networkIdStr));
|
||||
span->SetAttribute("member_id", Utils::hex10(memberId, memberIdStr));
|
||||
|
||||
std::unique_lock<std::shared_mutex> l(_dbs_l);
|
||||
for (auto d = _dbs.begin(); d != _dbs.end(); ++d) {
|
||||
(*d)->eraseMember(networkId, memberId);
|
||||
}
|
||||
}
|
||||
|
||||
void DBMirrorSet::nodeIsOnline(const uint64_t networkId,const uint64_t memberId,const InetAddress &physicalAddress)
|
||||
void DBMirrorSet::nodeIsOnline(const uint64_t networkId, const uint64_t memberId, const InetAddress& physicalAddress, const char* osArch)
|
||||
{
|
||||
std::lock_guard<std::mutex> l(_dbs_l);
|
||||
for(auto d=_dbs.begin();d!=_dbs.end();++d) {
|
||||
(*d)->nodeIsOnline(networkId,memberId,physicalAddress);
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("db_mirror_set");
|
||||
auto span = tracer->StartSpan("db_mirror_set::nodeIsOnline");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
char networkIdStr[17];
|
||||
char memberIdStr[11];
|
||||
char phyAddressStr[INET6_ADDRSTRLEN];
|
||||
span->SetAttribute("network_id", Utils::hex(networkId, networkIdStr));
|
||||
span->SetAttribute("member_id", Utils::hex10(memberId, memberIdStr));
|
||||
span->SetAttribute("physical_address", physicalAddress.toString(phyAddressStr));
|
||||
span->SetAttribute("os_arch", osArch);
|
||||
|
||||
std::shared_lock<std::shared_mutex> l(_dbs_l);
|
||||
for (auto d = _dbs.begin(); d != _dbs.end(); ++d) {
|
||||
(*d)->nodeIsOnline(networkId, memberId, physicalAddress, osArch);
|
||||
}
|
||||
}
|
||||
|
||||
void DBMirrorSet::onNetworkUpdate(const void *db,uint64_t networkId,const nlohmann::json &network)
|
||||
void DBMirrorSet::nodeIsOnline(const uint64_t networkId, const uint64_t memberId, const InetAddress& physicalAddress)
|
||||
{
|
||||
this->nodeIsOnline(networkId, memberId, physicalAddress, "unknown/unknown");
|
||||
}
|
||||
|
||||
void DBMirrorSet::onNetworkUpdate(const void* db, uint64_t networkId, const nlohmann::json& network)
|
||||
{
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("db_mirror_set");
|
||||
auto span = tracer->StartSpan("db_mirror_set::onNetworkUpdate");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
char networkIdStr[17];
|
||||
span->SetAttribute("network_id", Utils::hex(networkId, networkIdStr));
|
||||
|
||||
nlohmann::json record(network);
|
||||
std::lock_guard<std::mutex> l(_dbs_l);
|
||||
for(auto d=_dbs.begin();d!=_dbs.end();++d) {
|
||||
std::unique_lock<std::shared_mutex> l(_dbs_l);
|
||||
for (auto d = _dbs.begin(); d != _dbs.end(); ++d) {
|
||||
if (d->get() != db) {
|
||||
(*d)->save(record,false);
|
||||
(*d)->save(record, false);
|
||||
}
|
||||
}
|
||||
_listener->onNetworkUpdate(this,networkId,network);
|
||||
_listener->onNetworkUpdate(this, networkId, network);
|
||||
}
|
||||
|
||||
void DBMirrorSet::onNetworkMemberUpdate(const void *db,uint64_t networkId,uint64_t memberId,const nlohmann::json &member)
|
||||
void DBMirrorSet::onNetworkMemberUpdate(const void* db, uint64_t networkId, uint64_t memberId, const nlohmann::json& member)
|
||||
{
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("db_mirror_set");
|
||||
auto span = tracer->StartSpan("db_mirror_set::onNetworkMemberUpdate");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
char networkIdStr[17];
|
||||
char memberIdStr[11];
|
||||
span->SetAttribute("network_id", Utils::hex(networkId, networkIdStr));
|
||||
span->SetAttribute("member_id", Utils::hex10(memberId, memberIdStr));
|
||||
|
||||
nlohmann::json record(member);
|
||||
std::lock_guard<std::mutex> l(_dbs_l);
|
||||
for(auto d=_dbs.begin();d!=_dbs.end();++d) {
|
||||
std::unique_lock<std::shared_mutex> l(_dbs_l);
|
||||
for (auto d = _dbs.begin(); d != _dbs.end(); ++d) {
|
||||
if (d->get() != db) {
|
||||
(*d)->save(record,false);
|
||||
(*d)->save(record, false);
|
||||
}
|
||||
}
|
||||
_listener->onNetworkMemberUpdate(this,networkId,memberId,member);
|
||||
_listener->onNetworkMemberUpdate(this, networkId, memberId, member);
|
||||
}
|
||||
|
||||
void DBMirrorSet::onNetworkMemberDeauthorize(const void *db,uint64_t networkId,uint64_t memberId)
|
||||
void DBMirrorSet::onNetworkMemberDeauthorize(const void* db, uint64_t networkId, uint64_t memberId)
|
||||
{
|
||||
_listener->onNetworkMemberDeauthorize(this,networkId,memberId);
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("db_mirror_set");
|
||||
auto span = tracer->StartSpan("db_mirror_set::onNetworkMemberDeauthorize");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
char networkIdStr[17];
|
||||
char memberIdStr[11];
|
||||
span->SetAttribute("network_id", Utils::hex(networkId, networkIdStr));
|
||||
span->SetAttribute("member_id", Utils::hex10(memberId, memberIdStr));
|
||||
|
||||
_listener->onNetworkMemberDeauthorize(this, networkId, memberId);
|
||||
}
|
||||
|
||||
} // namespace ZeroTier
|
||||
} // namespace ZeroTier
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file in the project's root directory.
|
||||
*
|
||||
* Change Date: 2025-01-01
|
||||
* Change Date: 2026-01-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2.0 of the Apache License.
|
||||
|
@ -16,56 +16,58 @@
|
|||
|
||||
#include "DB.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <set>
|
||||
#include <shared_mutex>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
class DBMirrorSet : public DB::ChangeListener
|
||||
{
|
||||
public:
|
||||
DBMirrorSet(DB::ChangeListener *listener);
|
||||
class DBMirrorSet : public DB::ChangeListener {
|
||||
public:
|
||||
DBMirrorSet(DB::ChangeListener* listener);
|
||||
virtual ~DBMirrorSet();
|
||||
|
||||
bool hasNetwork(const uint64_t networkId) const;
|
||||
|
||||
bool get(const uint64_t networkId,nlohmann::json &network);
|
||||
bool get(const uint64_t networkId,nlohmann::json &network,const uint64_t memberId,nlohmann::json &member);
|
||||
bool get(const uint64_t networkId,nlohmann::json &network,const uint64_t memberId,nlohmann::json &member,DB::NetworkSummaryInfo &info);
|
||||
bool get(const uint64_t networkId,nlohmann::json &network,std::vector<nlohmann::json> &members);
|
||||
bool get(const uint64_t networkId, nlohmann::json& network);
|
||||
bool get(const uint64_t networkId, nlohmann::json& network, const uint64_t memberId, nlohmann::json& member);
|
||||
bool get(const uint64_t networkId, nlohmann::json& network, const uint64_t memberId, nlohmann::json& member, DB::NetworkSummaryInfo& info);
|
||||
bool get(const uint64_t networkId, nlohmann::json& network, std::vector<nlohmann::json>& members);
|
||||
|
||||
void networks(std::set<uint64_t> &networks);
|
||||
void networks(std::set<uint64_t>& networks);
|
||||
|
||||
bool waitForReady();
|
||||
bool isReady();
|
||||
bool save(nlohmann::json &record,bool notifyListeners);
|
||||
bool save(nlohmann::json& record, bool notifyListeners);
|
||||
void eraseNetwork(const uint64_t networkId);
|
||||
void eraseMember(const uint64_t networkId,const uint64_t memberId);
|
||||
void nodeIsOnline(const uint64_t networkId,const uint64_t memberId,const InetAddress &physicalAddress);
|
||||
void eraseMember(const uint64_t networkId, const uint64_t memberId);
|
||||
virtual void nodeIsOnline(const uint64_t networkId, const uint64_t memberId, const InetAddress& physicalAddress);
|
||||
virtual void nodeIsOnline(const uint64_t networkId, const uint64_t memberId, const InetAddress& physicalAddress, const char* osArch);
|
||||
|
||||
// These are called by various DB instances when changes occur.
|
||||
virtual void onNetworkUpdate(const void *db,uint64_t networkId,const nlohmann::json &network);
|
||||
virtual void onNetworkMemberUpdate(const void *db,uint64_t networkId,uint64_t memberId,const nlohmann::json &member);
|
||||
virtual void onNetworkMemberDeauthorize(const void *db,uint64_t networkId,uint64_t memberId);
|
||||
virtual void onNetworkUpdate(const void* db, uint64_t networkId, const nlohmann::json& network);
|
||||
virtual void onNetworkMemberUpdate(const void* db, uint64_t networkId, uint64_t memberId, const nlohmann::json& member);
|
||||
virtual void onNetworkMemberDeauthorize(const void* db, uint64_t networkId, uint64_t memberId);
|
||||
|
||||
inline void addDB(const std::shared_ptr<DB> &db)
|
||||
AuthInfo getSSOAuthInfo(const nlohmann::json& member, const std::string& redirectURL);
|
||||
|
||||
inline void addDB(const std::shared_ptr<DB>& db)
|
||||
{
|
||||
db->addListener(this);
|
||||
std::lock_guard<std::mutex> l(_dbs_l);
|
||||
std::unique_lock<std::shared_mutex> l(_dbs_l);
|
||||
_dbs.push_back(db);
|
||||
}
|
||||
|
||||
private:
|
||||
DB::ChangeListener *const _listener;
|
||||
private:
|
||||
DB::ChangeListener* const _listener;
|
||||
std::atomic_bool _running;
|
||||
std::thread _syncCheckerThread;
|
||||
std::vector< std::shared_ptr< DB > > _dbs;
|
||||
mutable std::mutex _dbs_l;
|
||||
std::vector<std::shared_ptr<DB> > _dbs;
|
||||
mutable std::shared_mutex _dbs_l;
|
||||
};
|
||||
|
||||
} // namespace ZeroTier
|
||||
} // namespace ZeroTier
|
||||
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -4,7 +4,7 @@
|
|||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file in the project's root directory.
|
||||
*
|
||||
* Change Date: 2025-01-01
|
||||
* Change Date: 2026-01-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2.0 of the Apache License.
|
||||
|
@ -14,119 +14,109 @@
|
|||
#ifndef ZT_SQLITENETWORKCONTROLLER_HPP
|
||||
#define ZT_SQLITENETWORKCONTROLLER_HPP
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <list>
|
||||
#include <thread>
|
||||
#include <unordered_map>
|
||||
#include <atomic>
|
||||
|
||||
#include "../node/Address.hpp"
|
||||
#include "../node/Constants.hpp"
|
||||
#include "../node/InetAddress.hpp"
|
||||
#include "../node/NetworkController.hpp"
|
||||
#include "../node/Utils.hpp"
|
||||
#include "../node/Address.hpp"
|
||||
#include "../node/InetAddress.hpp"
|
||||
|
||||
#include "../osdep/BlockingQueue.hpp"
|
||||
#include "../osdep/OSUtils.hpp"
|
||||
#include "../osdep/Thread.hpp"
|
||||
#include "../osdep/BlockingQueue.hpp"
|
||||
|
||||
#include "../ext/json/json.hpp"
|
||||
|
||||
#include "DB.hpp"
|
||||
#include "DBMirrorSet.hpp"
|
||||
|
||||
#include <atomic>
|
||||
#include <cpp-httplib/httplib.h>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <set>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
class Node;
|
||||
struct RedisConfig;
|
||||
|
||||
class EmbeddedNetworkController : public NetworkController,public DB::ChangeListener
|
||||
{
|
||||
public:
|
||||
class EmbeddedNetworkController
|
||||
: public NetworkController
|
||||
, public DB::ChangeListener {
|
||||
public:
|
||||
/**
|
||||
* @param node Parent node
|
||||
* @param dbPath Database path (file path or database credentials)
|
||||
*/
|
||||
EmbeddedNetworkController(Node *node,const char *ztPath,const char *dbPath, int listenPort, RedisConfig *rc);
|
||||
EmbeddedNetworkController(Node* node, const char* ztPath, const char* dbPath, int listenPort, RedisConfig* rc);
|
||||
virtual ~EmbeddedNetworkController();
|
||||
|
||||
virtual void init(const Identity &signingId,Sender *sender);
|
||||
virtual void init(const Identity& signingId, Sender* sender);
|
||||
|
||||
virtual void request(
|
||||
uint64_t nwid,
|
||||
const InetAddress &fromAddr,
|
||||
uint64_t requestPacketId,
|
||||
const Identity &identity,
|
||||
const Dictionary<ZT_NETWORKCONFIG_METADATA_DICT_CAPACITY> &metaData);
|
||||
void setSSORedirectURL(const std::string& url);
|
||||
|
||||
unsigned int handleControlPlaneHttpGET(
|
||||
const std::vector<std::string> &path,
|
||||
const std::map<std::string,std::string> &urlArgs,
|
||||
const std::map<std::string,std::string> &headers,
|
||||
const std::string &body,
|
||||
std::string &responseBody,
|
||||
std::string &responseContentType);
|
||||
unsigned int handleControlPlaneHttpPOST(
|
||||
const std::vector<std::string> &path,
|
||||
const std::map<std::string,std::string> &urlArgs,
|
||||
const std::map<std::string,std::string> &headers,
|
||||
const std::string &body,
|
||||
std::string &responseBody,
|
||||
std::string &responseContentType);
|
||||
unsigned int handleControlPlaneHttpDELETE(
|
||||
const std::vector<std::string> &path,
|
||||
const std::map<std::string,std::string> &urlArgs,
|
||||
const std::map<std::string,std::string> &headers,
|
||||
const std::string &body,
|
||||
std::string &responseBody,
|
||||
std::string &responseContentType);
|
||||
virtual void request(uint64_t nwid, const InetAddress& fromAddr, uint64_t requestPacketId, const Identity& identity, const Dictionary<ZT_NETWORKCONFIG_METADATA_DICT_CAPACITY>& metaData);
|
||||
|
||||
void handleRemoteTrace(const ZT_RemoteTrace &rt);
|
||||
void configureHTTPControlPlane(httplib::Server& s, httplib::Server& sV6, const std::function<void(const httplib::Request&, httplib::Response&, std::string)>);
|
||||
|
||||
virtual void onNetworkUpdate(const void *db,uint64_t networkId,const nlohmann::json &network);
|
||||
virtual void onNetworkMemberUpdate(const void *db,uint64_t networkId,uint64_t memberId,const nlohmann::json &member);
|
||||
virtual void onNetworkMemberDeauthorize(const void *db,uint64_t networkId,uint64_t memberId);
|
||||
void handleRemoteTrace(const ZT_RemoteTrace& rt);
|
||||
|
||||
private:
|
||||
void _request(uint64_t nwid,const InetAddress &fromAddr,uint64_t requestPacketId,const Identity &identity,const Dictionary<ZT_NETWORKCONFIG_METADATA_DICT_CAPACITY> &metaData);
|
||||
virtual void onNetworkUpdate(const void* db, uint64_t networkId, const nlohmann::json& network);
|
||||
virtual void onNetworkMemberUpdate(const void* db, uint64_t networkId, uint64_t memberId, const nlohmann::json& member);
|
||||
virtual void onNetworkMemberDeauthorize(const void* db, uint64_t networkId, uint64_t memberId);
|
||||
|
||||
private:
|
||||
void _request(uint64_t nwid, const InetAddress& fromAddr, uint64_t requestPacketId, const Identity& identity, const Dictionary<ZT_NETWORKCONFIG_METADATA_DICT_CAPACITY>& metaData);
|
||||
void _startThreads();
|
||||
void _ssoExpiryThread();
|
||||
|
||||
struct _RQEntry
|
||||
{
|
||||
std::string networkUpdateFromPostData(uint64_t networkID, const std::string& body);
|
||||
|
||||
struct _RQEntry {
|
||||
uint64_t nwid;
|
||||
uint64_t requestPacketId;
|
||||
InetAddress fromAddr;
|
||||
Identity identity;
|
||||
Dictionary<ZT_NETWORKCONFIG_METADATA_DICT_CAPACITY> metaData;
|
||||
enum {
|
||||
RQENTRY_TYPE_REQUEST = 0
|
||||
} type;
|
||||
enum { RQENTRY_TYPE_REQUEST = 0 } type;
|
||||
};
|
||||
struct _MemberStatusKey
|
||||
{
|
||||
_MemberStatusKey() : networkId(0),nodeId(0) {}
|
||||
_MemberStatusKey(const uint64_t nwid,const uint64_t nid) : networkId(nwid),nodeId(nid) {}
|
||||
|
||||
struct _MemberStatusKey {
|
||||
_MemberStatusKey() : networkId(0), nodeId(0)
|
||||
{
|
||||
}
|
||||
_MemberStatusKey(const uint64_t nwid, const uint64_t nid) : networkId(nwid), nodeId(nid)
|
||||
{
|
||||
}
|
||||
uint64_t networkId;
|
||||
uint64_t nodeId;
|
||||
inline bool operator==(const _MemberStatusKey &k) const { return ((k.networkId == networkId)&&(k.nodeId == nodeId)); }
|
||||
inline bool operator==(const _MemberStatusKey& k) const
|
||||
{
|
||||
return ((k.networkId == networkId) && (k.nodeId == nodeId));
|
||||
}
|
||||
inline bool operator<(const _MemberStatusKey& k) const
|
||||
{
|
||||
return (k.networkId < networkId) || ((k.networkId == networkId) && (k.nodeId < nodeId));
|
||||
}
|
||||
};
|
||||
struct _MemberStatus
|
||||
{
|
||||
_MemberStatus() : lastRequestTime(0),vMajor(-1),vMinor(-1),vRev(-1),vProto(-1) {}
|
||||
uint64_t lastRequestTime;
|
||||
int vMajor,vMinor,vRev,vProto;
|
||||
struct _MemberStatus {
|
||||
_MemberStatus() : lastRequestTime(0), authenticationExpiryTime(-1), vMajor(-1), vMinor(-1), vRev(-1), vProto(-1)
|
||||
{
|
||||
}
|
||||
int64_t lastRequestTime;
|
||||
int64_t authenticationExpiryTime;
|
||||
int vMajor, vMinor, vRev, vProto;
|
||||
Dictionary<ZT_NETWORKCONFIG_METADATA_DICT_CAPACITY> lastRequestMetaData;
|
||||
Identity identity;
|
||||
inline bool online(const int64_t now) const { return ((now - lastRequestTime) < (ZT_NETWORK_AUTOCONF_DELAY * 2)); }
|
||||
inline bool online(const int64_t now) const
|
||||
{
|
||||
return ((now - lastRequestTime) < (ZT_NETWORK_AUTOCONF_DELAY * 2));
|
||||
}
|
||||
};
|
||||
struct _MemberStatusHash
|
||||
{
|
||||
inline std::size_t operator()(const _MemberStatusKey &networkIdNodeId) const
|
||||
struct _MemberStatusHash {
|
||||
inline std::size_t operator()(const _MemberStatusKey& networkIdNodeId) const
|
||||
{
|
||||
return (std::size_t)(networkIdNodeId.networkId + networkIdNodeId.nodeId);
|
||||
}
|
||||
|
@ -134,25 +124,57 @@ private:
|
|||
|
||||
const int64_t _startTime;
|
||||
int _listenPort;
|
||||
Node *const _node;
|
||||
Node* const _node;
|
||||
std::string _ztPath;
|
||||
std::string _path;
|
||||
Identity _signingId;
|
||||
std::string _signingIdAddressString;
|
||||
NetworkController::Sender *_sender;
|
||||
NetworkController::Sender* _sender;
|
||||
|
||||
DBMirrorSet _db;
|
||||
BlockingQueue< _RQEntry * > _queue;
|
||||
BlockingQueue<_RQEntry*> _queue;
|
||||
|
||||
std::vector<std::thread> _threads;
|
||||
std::mutex _threads_l;
|
||||
|
||||
std::unordered_map< _MemberStatusKey,_MemberStatus,_MemberStatusHash > _memberStatus;
|
||||
std::unordered_map<_MemberStatusKey, _MemberStatus, _MemberStatusHash> _memberStatus;
|
||||
std::mutex _memberStatus_l;
|
||||
|
||||
RedisConfig *_rc;
|
||||
std::set<std::pair<int64_t, _MemberStatusKey> > _expiringSoon;
|
||||
std::mutex _expiringSoon_l;
|
||||
|
||||
RedisConfig* _rc;
|
||||
std::string _ssoRedirectURL;
|
||||
|
||||
bool _ssoExpiryRunning;
|
||||
std::thread _ssoExpiry;
|
||||
|
||||
#ifdef CENTRAL_CONTROLLER_REQUEST_BENCHMARK
|
||||
prometheus::simpleapi::benchmark_family_t _member_status_lookup;
|
||||
prometheus::simpleapi::counter_family_t _member_status_lookup_count;
|
||||
prometheus::simpleapi::benchmark_family_t _node_is_online;
|
||||
prometheus::simpleapi::counter_family_t _node_is_online_count;
|
||||
prometheus::simpleapi::benchmark_family_t _get_and_init_member;
|
||||
prometheus::simpleapi::counter_family_t _get_and_init_member_count;
|
||||
prometheus::simpleapi::benchmark_family_t _have_identity;
|
||||
prometheus::simpleapi::counter_family_t _have_identity_count;
|
||||
prometheus::simpleapi::benchmark_family_t _determine_auth;
|
||||
prometheus::simpleapi::counter_family_t _determine_auth_count;
|
||||
prometheus::simpleapi::benchmark_family_t _sso_check;
|
||||
prometheus::simpleapi::counter_family_t _sso_check_count;
|
||||
prometheus::simpleapi::benchmark_family_t _auth_check;
|
||||
prometheus::simpleapi::counter_family_t _auth_check_count;
|
||||
prometheus::simpleapi::benchmark_family_t _json_schlep;
|
||||
prometheus::simpleapi::counter_family_t _json_schlep_count;
|
||||
prometheus::simpleapi::benchmark_family_t _issue_certificate;
|
||||
prometheus::simpleapi::counter_family_t _issue_certificate_count;
|
||||
prometheus::simpleapi::benchmark_family_t _save_member;
|
||||
prometheus::simpleapi::counter_family_t _save_member_count;
|
||||
prometheus::simpleapi::benchmark_family_t _send_netconf;
|
||||
prometheus::simpleapi::counter_family_t _send_netconf_count;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace ZeroTier
|
||||
} // namespace ZeroTier
|
||||
|
||||
#endif
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file in the project's root directory.
|
||||
*
|
||||
* Change Date: 2025-01-01
|
||||
* Change Date: 2026-01-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2.0 of the Apache License.
|
||||
|
@ -13,49 +13,57 @@
|
|||
|
||||
#include "FileDB.hpp"
|
||||
|
||||
namespace ZeroTier
|
||||
{
|
||||
#include "../node/Metrics.hpp"
|
||||
#include "opentelemetry/trace/provider.h"
|
||||
|
||||
FileDB::FileDB(const char *path) :
|
||||
DB(),
|
||||
_path(path),
|
||||
_networksPath(_path + ZT_PATH_SEPARATOR_S + "network"),
|
||||
_tracePath(_path + ZT_PATH_SEPARATOR_S + "trace"),
|
||||
_running(true)
|
||||
namespace ZeroTier {
|
||||
|
||||
FileDB::FileDB(const char* path) : DB(), _path(path), _networksPath(_path + ZT_PATH_SEPARATOR_S + "network"), _tracePath(_path + ZT_PATH_SEPARATOR_S + "trace"), _running(true)
|
||||
{
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("filedb");
|
||||
auto span = tracer->StartSpan("filedb::FileDB");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
|
||||
OSUtils::mkdir(_path.c_str());
|
||||
OSUtils::lockDownFile(_path.c_str(),true);
|
||||
OSUtils::lockDownFile(_path.c_str(), true);
|
||||
OSUtils::mkdir(_networksPath.c_str());
|
||||
OSUtils::mkdir(_tracePath.c_str());
|
||||
|
||||
std::vector<std::string> networks(OSUtils::listDirectory(_networksPath.c_str(),false));
|
||||
std::vector<std::string> networks(OSUtils::listDirectory(_networksPath.c_str(), false));
|
||||
std::string buf;
|
||||
for(auto n=networks.begin();n!=networks.end();++n) {
|
||||
for (auto n = networks.begin(); n != networks.end(); ++n) {
|
||||
buf.clear();
|
||||
if ((n->length() == 21)&&(OSUtils::readFile((_networksPath + ZT_PATH_SEPARATOR_S + *n).c_str(),buf))) {
|
||||
if ((n->length() == 21) && (OSUtils::readFile((_networksPath + ZT_PATH_SEPARATOR_S + *n).c_str(), buf))) {
|
||||
try {
|
||||
nlohmann::json network(OSUtils::jsonParse(buf));
|
||||
const std::string nwids = network["id"];
|
||||
if (nwids.length() == 16) {
|
||||
nlohmann::json nullJson;
|
||||
_networkChanged(nullJson,network,false);
|
||||
_networkChanged(nullJson, network, false);
|
||||
Metrics::network_count++;
|
||||
std::string membersPath(_networksPath + ZT_PATH_SEPARATOR_S + nwids + ZT_PATH_SEPARATOR_S "member");
|
||||
std::vector<std::string> members(OSUtils::listDirectory(membersPath.c_str(),false));
|
||||
for(auto m=members.begin();m!=members.end();++m) {
|
||||
std::vector<std::string> members(OSUtils::listDirectory(membersPath.c_str(), false));
|
||||
for (auto m = members.begin(); m != members.end(); ++m) {
|
||||
buf.clear();
|
||||
if ((m->length() == 15)&&(OSUtils::readFile((membersPath + ZT_PATH_SEPARATOR_S + *m).c_str(),buf))) {
|
||||
if ((m->length() == 15) && (OSUtils::readFile((membersPath + ZT_PATH_SEPARATOR_S + *m).c_str(), buf))) {
|
||||
try {
|
||||
nlohmann::json member(OSUtils::jsonParse(buf));
|
||||
const std::string addrs = member["id"];
|
||||
if (addrs.length() == 10) {
|
||||
nlohmann::json nullJson2;
|
||||
_memberChanged(nullJson2,member,false);
|
||||
_memberChanged(nullJson2, member, false);
|
||||
Metrics::member_count++;
|
||||
}
|
||||
} catch ( ... ) {}
|
||||
}
|
||||
catch (...) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch ( ... ) {}
|
||||
}
|
||||
catch (...) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,96 +75,135 @@ FileDB::~FileDB()
|
|||
_running = false;
|
||||
_online_l.unlock();
|
||||
_onlineUpdateThread.join();
|
||||
} catch ( ... ) {}
|
||||
}
|
||||
catch (...) {
|
||||
}
|
||||
}
|
||||
|
||||
bool FileDB::waitForReady() { return true; }
|
||||
bool FileDB::isReady() { return true; }
|
||||
|
||||
bool FileDB::save(nlohmann::json &record,bool notifyListeners)
|
||||
bool FileDB::waitForReady()
|
||||
{
|
||||
char p1[4096],p2[4096],pb[4096];
|
||||
return true;
|
||||
}
|
||||
bool FileDB::isReady()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FileDB::save(nlohmann::json& record, bool notifyListeners)
|
||||
{
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("filedb");
|
||||
auto span = tracer->StartSpan("filedb::save");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
|
||||
char p1[4096], p2[4096], pb[4096];
|
||||
bool modified = false;
|
||||
try {
|
||||
const std::string objtype = record["objtype"];
|
||||
if (objtype == "network") {
|
||||
auto span = tracer->StartSpan("filedb::save::network");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
|
||||
const uint64_t nwid = OSUtils::jsonIntHex(record["id"],0ULL);
|
||||
const uint64_t nwid = OSUtils::jsonIntHex(record["id"], 0ULL);
|
||||
if (nwid) {
|
||||
nlohmann::json old;
|
||||
get(nwid,old);
|
||||
if ((!old.is_object())||(!_compareRecords(old,record))) {
|
||||
record["revision"] = OSUtils::jsonInt(record["revision"],0ULL) + 1ULL;
|
||||
OSUtils::ztsnprintf(p1,sizeof(p1),"%s" ZT_PATH_SEPARATOR_S "%.16llx.json",_networksPath.c_str(),nwid);
|
||||
if (!OSUtils::writeFile(p1,OSUtils::jsonDump(record,-1)))
|
||||
fprintf(stderr,"WARNING: controller unable to write to path: %s" ZT_EOL_S,p1);
|
||||
_networkChanged(old,record,notifyListeners);
|
||||
get(nwid, old);
|
||||
if ((! old.is_object()) || (! _compareRecords(old, record))) {
|
||||
record["revision"] = OSUtils::jsonInt(record["revision"], 0ULL) + 1ULL;
|
||||
OSUtils::ztsnprintf(p1, sizeof(p1), "%s" ZT_PATH_SEPARATOR_S "%.16llx.json", _networksPath.c_str(), nwid);
|
||||
if (! OSUtils::writeFile(p1, OSUtils::jsonDump(record, -1))) {
|
||||
fprintf(stderr, "WARNING: controller unable to write to path: %s" ZT_EOL_S, p1);
|
||||
}
|
||||
_networkChanged(old, record, notifyListeners);
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (objtype == "member") {
|
||||
auto span = tracer->StartSpan("filedb::save::member");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
|
||||
} else if (objtype == "member") {
|
||||
|
||||
const uint64_t id = OSUtils::jsonIntHex(record["id"],0ULL);
|
||||
const uint64_t nwid = OSUtils::jsonIntHex(record["nwid"],0ULL);
|
||||
if ((id)&&(nwid)) {
|
||||
nlohmann::json network,old;
|
||||
get(nwid,network,id,old);
|
||||
if ((!old.is_object())||(!_compareRecords(old,record))) {
|
||||
record["revision"] = OSUtils::jsonInt(record["revision"],0ULL) + 1ULL;
|
||||
OSUtils::ztsnprintf(pb,sizeof(pb),"%s" ZT_PATH_SEPARATOR_S "%.16llx" ZT_PATH_SEPARATOR_S "member",_networksPath.c_str(),(unsigned long long)nwid);
|
||||
OSUtils::ztsnprintf(p1,sizeof(p1),"%s" ZT_PATH_SEPARATOR_S "%.10llx.json",pb,(unsigned long long)id);
|
||||
if (!OSUtils::writeFile(p1,OSUtils::jsonDump(record,-1))) {
|
||||
OSUtils::ztsnprintf(p2,sizeof(p2),"%s" ZT_PATH_SEPARATOR_S "%.16llx",_networksPath.c_str(),(unsigned long long)nwid);
|
||||
const uint64_t id = OSUtils::jsonIntHex(record["id"], 0ULL);
|
||||
const uint64_t nwid = OSUtils::jsonIntHex(record["nwid"], 0ULL);
|
||||
if ((id) && (nwid)) {
|
||||
nlohmann::json network, old;
|
||||
get(nwid, network, id, old);
|
||||
if ((! old.is_object()) || (! _compareRecords(old, record))) {
|
||||
record["revision"] = OSUtils::jsonInt(record["revision"], 0ULL) + 1ULL;
|
||||
OSUtils::ztsnprintf(pb, sizeof(pb), "%s" ZT_PATH_SEPARATOR_S "%.16llx" ZT_PATH_SEPARATOR_S "member", _networksPath.c_str(), (unsigned long long)nwid);
|
||||
OSUtils::ztsnprintf(p1, sizeof(p1), "%s" ZT_PATH_SEPARATOR_S "%.10llx.json", pb, (unsigned long long)id);
|
||||
if (! OSUtils::writeFile(p1, OSUtils::jsonDump(record, -1))) {
|
||||
OSUtils::ztsnprintf(p2, sizeof(p2), "%s" ZT_PATH_SEPARATOR_S "%.16llx", _networksPath.c_str(), (unsigned long long)nwid);
|
||||
OSUtils::mkdir(p2);
|
||||
OSUtils::mkdir(pb);
|
||||
if (!OSUtils::writeFile(p1,OSUtils::jsonDump(record,-1)))
|
||||
fprintf(stderr,"WARNING: controller unable to write to path: %s" ZT_EOL_S,p1);
|
||||
if (! OSUtils::writeFile(p1, OSUtils::jsonDump(record, -1))) {
|
||||
fprintf(stderr, "WARNING: controller unable to write to path: %s" ZT_EOL_S, p1);
|
||||
}
|
||||
}
|
||||
_memberChanged(old,record,notifyListeners);
|
||||
_memberChanged(old, record, notifyListeners);
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} catch ( ... ) {} // drop invalid records missing fields
|
||||
}
|
||||
catch (...) {
|
||||
} // drop invalid records missing fields
|
||||
return modified;
|
||||
}
|
||||
|
||||
void FileDB::eraseNetwork(const uint64_t networkId)
|
||||
{
|
||||
nlohmann::json network,nullJson;
|
||||
get(networkId,network);
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("filedb");
|
||||
auto span = tracer->StartSpan("filedb::eraseNetwork");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
|
||||
nlohmann::json network, nullJson;
|
||||
get(networkId, network);
|
||||
char p[16384];
|
||||
OSUtils::ztsnprintf(p,sizeof(p),"%s" ZT_PATH_SEPARATOR_S "%.16llx.json",_networksPath.c_str(),networkId);
|
||||
OSUtils::ztsnprintf(p, sizeof(p), "%s" ZT_PATH_SEPARATOR_S "%.16llx.json", _networksPath.c_str(), networkId);
|
||||
OSUtils::rm(p);
|
||||
OSUtils::ztsnprintf(p,sizeof(p),"%s" ZT_PATH_SEPARATOR_S "%.16llx" ZT_PATH_SEPARATOR_S "member",_networksPath.c_str(),(unsigned long long)networkId);
|
||||
OSUtils::ztsnprintf(p, sizeof(p), "%s" ZT_PATH_SEPARATOR_S "%.16llx", _networksPath.c_str(), (unsigned long long)networkId);
|
||||
OSUtils::rmDashRf(p);
|
||||
_networkChanged(network,nullJson,true);
|
||||
_networkChanged(network, nullJson, true);
|
||||
std::lock_guard<std::mutex> l(this->_online_l);
|
||||
this->_online.erase(networkId);
|
||||
}
|
||||
|
||||
void FileDB::eraseMember(const uint64_t networkId,const uint64_t memberId)
|
||||
void FileDB::eraseMember(const uint64_t networkId, const uint64_t memberId)
|
||||
{
|
||||
nlohmann::json network,member,nullJson;
|
||||
get(networkId,network);
|
||||
get(memberId,member);
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("filedb");
|
||||
auto span = tracer->StartSpan("filedb::eraseMember");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
|
||||
nlohmann::json network, member, nullJson;
|
||||
get(networkId, network, memberId, member);
|
||||
char p[4096];
|
||||
OSUtils::ztsnprintf(p,sizeof(p),"%s" ZT_PATH_SEPARATOR_S "%.16llx" ZT_PATH_SEPARATOR_S "member" ZT_PATH_SEPARATOR_S "%.10llx.json",_networksPath.c_str(),networkId,memberId);
|
||||
OSUtils::ztsnprintf(p, sizeof(p), "%s" ZT_PATH_SEPARATOR_S "%.16llx" ZT_PATH_SEPARATOR_S "member" ZT_PATH_SEPARATOR_S "%.10llx.json", _networksPath.c_str(), networkId, memberId);
|
||||
OSUtils::rm(p);
|
||||
_memberChanged(member,nullJson,true);
|
||||
_memberChanged(member, nullJson, true);
|
||||
std::lock_guard<std::mutex> l(this->_online_l);
|
||||
this->_online[networkId].erase(memberId);
|
||||
}
|
||||
|
||||
void FileDB::nodeIsOnline(const uint64_t networkId,const uint64_t memberId,const InetAddress &physicalAddress)
|
||||
void FileDB::nodeIsOnline(const uint64_t networkId, const uint64_t memberId, const InetAddress& physicalAddress, const char* osArch)
|
||||
{
|
||||
char mid[32],atmp[64];
|
||||
OSUtils::ztsnprintf(mid,sizeof(mid),"%.10llx",(unsigned long long)memberId);
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("filedb");
|
||||
auto span = tracer->StartSpan("filedb::nodeIsOnline");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
|
||||
char mid[32], atmp[64];
|
||||
OSUtils::ztsnprintf(mid, sizeof(mid), "%.10llx", (unsigned long long)memberId);
|
||||
physicalAddress.toString(atmp);
|
||||
std::lock_guard<std::mutex> l(this->_online_l);
|
||||
this->_online[networkId][memberId][OSUtils::now()] = physicalAddress;
|
||||
}
|
||||
|
||||
} // namespace ZeroTier
|
||||
void FileDB::nodeIsOnline(const uint64_t networkId, const uint64_t memberId, const InetAddress& physicalAddress)
|
||||
{
|
||||
this->nodeIsOnline(networkId, memberId, physicalAddress, "unknown/unknown");
|
||||
}
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file in the project's root directory.
|
||||
*
|
||||
* Change Date: 2025-01-01
|
||||
* Change Date: 2026-01-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2.0 of the Apache License.
|
||||
|
@ -16,32 +16,31 @@
|
|||
|
||||
#include "DB.hpp"
|
||||
|
||||
namespace ZeroTier
|
||||
{
|
||||
namespace ZeroTier {
|
||||
|
||||
class FileDB : public DB
|
||||
{
|
||||
public:
|
||||
FileDB(const char *path);
|
||||
class FileDB : public DB {
|
||||
public:
|
||||
FileDB(const char* path);
|
||||
virtual ~FileDB();
|
||||
|
||||
virtual bool waitForReady();
|
||||
virtual bool isReady();
|
||||
virtual bool save(nlohmann::json &record,bool notifyListeners);
|
||||
virtual bool save(nlohmann::json& record, bool notifyListeners);
|
||||
virtual void eraseNetwork(const uint64_t networkId);
|
||||
virtual void eraseMember(const uint64_t networkId,const uint64_t memberId);
|
||||
virtual void nodeIsOnline(const uint64_t networkId,const uint64_t memberId,const InetAddress &physicalAddress);
|
||||
virtual void eraseMember(const uint64_t networkId, const uint64_t memberId);
|
||||
virtual void nodeIsOnline(const uint64_t networkId, const uint64_t memberId, const InetAddress& physicalAddress);
|
||||
virtual void nodeIsOnline(const uint64_t networkId, const uint64_t memberId, const InetAddress& physicalAddress, const char* osArch);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
std::string _path;
|
||||
std::string _networksPath;
|
||||
std::string _tracePath;
|
||||
std::thread _onlineUpdateThread;
|
||||
std::map< uint64_t,std::map<uint64_t,std::map<int64_t,InetAddress> > > _online;
|
||||
std::map<uint64_t, std::map<uint64_t, std::map<int64_t, InetAddress> > > _online;
|
||||
std::mutex _online_l;
|
||||
bool _running;
|
||||
};
|
||||
|
||||
} // namespace ZeroTier
|
||||
} // namespace ZeroTier
|
||||
|
||||
#endif
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file in the project's root directory.
|
||||
*
|
||||
* Change Date: 2025-01-01
|
||||
* Change Date: 2026-01-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2.0 of the Apache License.
|
||||
|
@ -13,51 +13,52 @@
|
|||
|
||||
#include "LFDB.hpp"
|
||||
|
||||
#include <thread>
|
||||
#include "../ext/cpp-httplib/httplib.h"
|
||||
#include "../osdep/OSUtils.hpp"
|
||||
|
||||
#include <chrono>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <thread>
|
||||
|
||||
#include "../osdep/OSUtils.hpp"
|
||||
#include "../ext/cpp-httplib/httplib.h"
|
||||
namespace ZeroTier {
|
||||
|
||||
namespace ZeroTier
|
||||
{
|
||||
|
||||
LFDB::LFDB(const Identity &myId,const char *path,const char *lfOwnerPrivate,const char *lfOwnerPublic,const char *lfNodeHost,int lfNodePort,bool storeOnlineState) :
|
||||
DB(),
|
||||
_myId(myId),
|
||||
_lfOwnerPrivate((lfOwnerPrivate) ? lfOwnerPrivate : ""),
|
||||
_lfOwnerPublic((lfOwnerPublic) ? lfOwnerPublic : ""),
|
||||
_lfNodeHost((lfNodeHost) ? lfNodeHost : "127.0.0.1"),
|
||||
_lfNodePort(((lfNodePort > 0)&&(lfNodePort < 65536)) ? lfNodePort : 9980),
|
||||
_running(true),
|
||||
_ready(false),
|
||||
_storeOnlineState(storeOnlineState)
|
||||
LFDB::LFDB(const Identity& myId, const char* path, const char* lfOwnerPrivate, const char* lfOwnerPublic, const char* lfNodeHost, int lfNodePort, bool storeOnlineState)
|
||||
: DB()
|
||||
, _myId(myId)
|
||||
, _lfOwnerPrivate((lfOwnerPrivate) ? lfOwnerPrivate : "")
|
||||
, _lfOwnerPublic((lfOwnerPublic) ? lfOwnerPublic : "")
|
||||
, _lfNodeHost((lfNodeHost) ? lfNodeHost : "127.0.0.1")
|
||||
, _lfNodePort(((lfNodePort > 0) && (lfNodePort < 65536)) ? lfNodePort : 9980)
|
||||
, _running(true)
|
||||
, _ready(false)
|
||||
, _storeOnlineState(storeOnlineState)
|
||||
{
|
||||
_syncThread = std::thread([this]() {
|
||||
char controllerAddress[24];
|
||||
const uint64_t controllerAddressInt = _myId.address().toInt();
|
||||
_myId.address().toString(controllerAddress);
|
||||
std::string networksSelectorName("com.zerotier.controller.lfdb:"); networksSelectorName.append(controllerAddress); networksSelectorName.append("/network");
|
||||
std::string networksSelectorName("com.zerotier.controller.lfdb:");
|
||||
networksSelectorName.append(controllerAddress);
|
||||
networksSelectorName.append("/network");
|
||||
|
||||
// LF record masking key is the first 32 bytes of SHA512(controller private key) in hex,
|
||||
// hiding record values from anything but the controller or someone who has its key.
|
||||
uint8_t sha512pk[64];
|
||||
_myId.sha512PrivateKey(sha512pk);
|
||||
char maskingKey [128];
|
||||
Utils::hex(sha512pk,32,maskingKey);
|
||||
char maskingKey[128];
|
||||
Utils::hex(sha512pk, 32, maskingKey);
|
||||
|
||||
httplib::Client htcli(_lfNodeHost.c_str(),_lfNodePort);
|
||||
httplib::Client htcli(_lfNodeHost.c_str(), _lfNodePort);
|
||||
int64_t timeRangeStart = 0;
|
||||
while (_running.load()) {
|
||||
{
|
||||
std::lock_guard<std::mutex> sl(_state_l);
|
||||
for(auto ns=_state.begin();ns!=_state.end();++ns) {
|
||||
for (auto ns = _state.begin(); ns != _state.end(); ++ns) {
|
||||
if (ns->second.dirty) {
|
||||
nlohmann::json network;
|
||||
if (get(ns->first,network)) {
|
||||
nlohmann::json newrec,selector0;
|
||||
if (get(ns->first, network)) {
|
||||
nlohmann::json newrec, selector0;
|
||||
selector0["Name"] = networksSelectorName;
|
||||
selector0["Ordinal"] = ns->first;
|
||||
newrec["Selectors"].push_back(selector0);
|
||||
|
@ -66,30 +67,34 @@ LFDB::LFDB(const Identity &myId,const char *path,const char *lfOwnerPrivate,cons
|
|||
newrec["MaskingKey"] = maskingKey;
|
||||
newrec["PulseIfUnchanged"] = true;
|
||||
try {
|
||||
auto resp = htcli.Post("/makerecord",newrec.dump(),"application/json");
|
||||
auto resp = htcli.Post("/makerecord", newrec.dump(), "application/json");
|
||||
if (resp) {
|
||||
if (resp->status == 200) {
|
||||
ns->second.dirty = false;
|
||||
//printf("SET network %.16llx %s\n",ns->first,resp->body.c_str());
|
||||
} else {
|
||||
fprintf(stderr,"ERROR: LFDB: %d from node (create/update network): %s" ZT_EOL_S,resp->status,resp->body.c_str());
|
||||
// printf("SET network %.16llx %s\n",ns->first,resp->body.c_str());
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "ERROR: LFDB: %d from node (create/update network): %s" ZT_EOL_S, resp->status, resp->body.c_str());
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr,"ERROR: LFDB: node is offline" ZT_EOL_S);
|
||||
}
|
||||
} catch (std::exception &e) {
|
||||
fprintf(stderr,"ERROR: LFDB: unexpected exception querying node (create/update network): %s" ZT_EOL_S,e.what());
|
||||
} catch ( ... ) {
|
||||
fprintf(stderr,"ERROR: LFDB: unexpected exception querying node (create/update network): unknown exception" ZT_EOL_S);
|
||||
else {
|
||||
fprintf(stderr, "ERROR: LFDB: node is offline" ZT_EOL_S);
|
||||
}
|
||||
}
|
||||
catch (std::exception& e) {
|
||||
fprintf(stderr, "ERROR: LFDB: unexpected exception querying node (create/update network): %s" ZT_EOL_S, e.what());
|
||||
}
|
||||
catch (...) {
|
||||
fprintf(stderr, "ERROR: LFDB: unexpected exception querying node (create/update network): unknown exception" ZT_EOL_S);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(auto ms=ns->second.members.begin();ms!=ns->second.members.end();++ms) {
|
||||
if ((_storeOnlineState)&&(ms->second.lastOnlineDirty)&&(ms->second.lastOnlineAddress)) {
|
||||
nlohmann::json newrec,selector0,selector1,selectors,ip;
|
||||
char tmp[1024],tmp2[128];
|
||||
OSUtils::ztsnprintf(tmp,sizeof(tmp),"com.zerotier.controller.lfdb:%s/network/%.16llx/online",controllerAddress,(unsigned long long)ns->first);
|
||||
for (auto ms = ns->second.members.begin(); ms != ns->second.members.end(); ++ms) {
|
||||
if ((_storeOnlineState) && (ms->second.lastOnlineDirty) && (ms->second.lastOnlineAddress)) {
|
||||
nlohmann::json newrec, selector0, selector1, selectors, ip;
|
||||
char tmp[1024], tmp2[128];
|
||||
OSUtils::ztsnprintf(tmp, sizeof(tmp), "com.zerotier.controller.lfdb:%s/network/%.16llx/online", controllerAddress, (unsigned long long)ns->first);
|
||||
ms->second.lastOnlineAddress.toIpString(tmp2);
|
||||
selector0["Name"] = tmp;
|
||||
selector0["Ordinal"] = ms->first;
|
||||
|
@ -98,18 +103,18 @@ LFDB::LFDB(const Identity &myId,const char *path,const char *lfOwnerPrivate,cons
|
|||
selectors.push_back(selector0);
|
||||
selectors.push_back(selector1);
|
||||
newrec["Selectors"] = selectors;
|
||||
const uint8_t *const rawip = (const uint8_t *)ms->second.lastOnlineAddress.rawIpData();
|
||||
switch(ms->second.lastOnlineAddress.ss_family) {
|
||||
const uint8_t* const rawip = (const uint8_t*)ms->second.lastOnlineAddress.rawIpData();
|
||||
switch (ms->second.lastOnlineAddress.ss_family) {
|
||||
case AF_INET:
|
||||
for(int j=0;j<4;++j)
|
||||
for (int j = 0; j < 4; ++j)
|
||||
ip.push_back((unsigned int)rawip[j]);
|
||||
break;
|
||||
case AF_INET6:
|
||||
for(int j=0;j<16;++j)
|
||||
for (int j = 0; j < 16; ++j)
|
||||
ip.push_back((unsigned int)rawip[j]);
|
||||
break;
|
||||
default:
|
||||
ip = tmp2; // should never happen since only IP transport is currently supported
|
||||
ip = tmp2; // should never happen since only IP transport is currently supported
|
||||
break;
|
||||
}
|
||||
newrec["Value"] = ip;
|
||||
|
@ -118,28 +123,32 @@ LFDB::LFDB(const Identity &myId,const char *path,const char *lfOwnerPrivate,cons
|
|||
newrec["Timestamp"] = ms->second.lastOnlineTime;
|
||||
newrec["PulseIfUnchanged"] = true;
|
||||
try {
|
||||
auto resp = htcli.Post("/makerecord",newrec.dump(),"application/json");
|
||||
auto resp = htcli.Post("/makerecord", newrec.dump(), "application/json");
|
||||
if (resp) {
|
||||
if (resp->status == 200) {
|
||||
ms->second.lastOnlineDirty = false;
|
||||
//printf("SET member online %.16llx %.10llx %s\n",ns->first,ms->first,resp->body.c_str());
|
||||
} else {
|
||||
fprintf(stderr,"ERROR: LFDB: %d from node (create/update member online status): %s" ZT_EOL_S,resp->status,resp->body.c_str());
|
||||
// printf("SET member online %.16llx %.10llx %s\n",ns->first,ms->first,resp->body.c_str());
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "ERROR: LFDB: %d from node (create/update member online status): %s" ZT_EOL_S, resp->status, resp->body.c_str());
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr,"ERROR: LFDB: node is offline" ZT_EOL_S);
|
||||
}
|
||||
} catch (std::exception &e) {
|
||||
fprintf(stderr,"ERROR: LFDB: unexpected exception querying node (create/update member online status): %s" ZT_EOL_S,e.what());
|
||||
} catch ( ... ) {
|
||||
fprintf(stderr,"ERROR: LFDB: unexpected exception querying node (create/update member online status): unknown exception" ZT_EOL_S);
|
||||
else {
|
||||
fprintf(stderr, "ERROR: LFDB: node is offline" ZT_EOL_S);
|
||||
}
|
||||
}
|
||||
catch (std::exception& e) {
|
||||
fprintf(stderr, "ERROR: LFDB: unexpected exception querying node (create/update member online status): %s" ZT_EOL_S, e.what());
|
||||
}
|
||||
catch (...) {
|
||||
fprintf(stderr, "ERROR: LFDB: unexpected exception querying node (create/update member online status): unknown exception" ZT_EOL_S);
|
||||
}
|
||||
}
|
||||
|
||||
if (ms->second.dirty) {
|
||||
nlohmann::json network,member;
|
||||
if (get(ns->first,network,ms->first,member)) {
|
||||
nlohmann::json newrec,selector0,selector1,selectors;
|
||||
nlohmann::json network, member;
|
||||
if (get(ns->first, network, ms->first, member)) {
|
||||
nlohmann::json newrec, selector0, selector1, selectors;
|
||||
selector0["Name"] = networksSelectorName;
|
||||
selector0["Ordinal"] = ns->first;
|
||||
selector1["Name"] = "member";
|
||||
|
@ -152,21 +161,25 @@ LFDB::LFDB(const Identity &myId,const char *path,const char *lfOwnerPrivate,cons
|
|||
newrec["MaskingKey"] = maskingKey;
|
||||
newrec["PulseIfUnchanged"] = true;
|
||||
try {
|
||||
auto resp = htcli.Post("/makerecord",newrec.dump(),"application/json");
|
||||
auto resp = htcli.Post("/makerecord", newrec.dump(), "application/json");
|
||||
if (resp) {
|
||||
if (resp->status == 200) {
|
||||
ms->second.dirty = false;
|
||||
//printf("SET member %.16llx %.10llx %s\n",ns->first,ms->first,resp->body.c_str());
|
||||
} else {
|
||||
fprintf(stderr,"ERROR: LFDB: %d from node (create/update member): %s" ZT_EOL_S,resp->status,resp->body.c_str());
|
||||
// printf("SET member %.16llx %.10llx %s\n",ns->first,ms->first,resp->body.c_str());
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "ERROR: LFDB: %d from node (create/update member): %s" ZT_EOL_S, resp->status, resp->body.c_str());
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr,"ERROR: LFDB: node is offline" ZT_EOL_S);
|
||||
}
|
||||
} catch (std::exception &e) {
|
||||
fprintf(stderr,"ERROR: LFDB: unexpected exception querying node (create/update member): %s" ZT_EOL_S,e.what());
|
||||
} catch ( ... ) {
|
||||
fprintf(stderr,"ERROR: LFDB: unexpected exception querying node (create/update member): unknown exception" ZT_EOL_S);
|
||||
else {
|
||||
fprintf(stderr, "ERROR: LFDB: node is offline" ZT_EOL_S);
|
||||
}
|
||||
}
|
||||
catch (std::exception& e) {
|
||||
fprintf(stderr, "ERROR: LFDB: unexpected exception querying node (create/update member): %s" ZT_EOL_S, e.what());
|
||||
}
|
||||
catch (...) {
|
||||
fprintf(stderr, "ERROR: LFDB: unexpected exception querying node (create/update member): unknown exception" ZT_EOL_S);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -176,143 +189,161 @@ LFDB::LFDB(const Identity &myId,const char *path,const char *lfOwnerPrivate,cons
|
|||
|
||||
try {
|
||||
std::ostringstream query;
|
||||
query <<
|
||||
"{"
|
||||
"\"Ranges\":[{"
|
||||
"\"Name\":\"" << networksSelectorName << "\","
|
||||
"\"Range\":[0,18446744073709551615]"
|
||||
"}],"
|
||||
"\"TimeRange\":[" << timeRangeStart << ",9223372036854775807],"
|
||||
"\"MaskingKey\":\"" << maskingKey << "\","
|
||||
"\"Owners\":[\"" << _lfOwnerPublic << "\"]"
|
||||
"}";
|
||||
auto resp = htcli.Post("/query",query.str(),"application/json");
|
||||
query << "{"
|
||||
"\"Ranges\":[{"
|
||||
"\"Name\":\""
|
||||
<< networksSelectorName
|
||||
<< "\","
|
||||
"\"Range\":[0,18446744073709551615]"
|
||||
"}],"
|
||||
"\"TimeRange\":["
|
||||
<< timeRangeStart
|
||||
<< ",9223372036854775807],"
|
||||
"\"MaskingKey\":\""
|
||||
<< maskingKey
|
||||
<< "\","
|
||||
"\"Owners\":[\""
|
||||
<< _lfOwnerPublic
|
||||
<< "\"]"
|
||||
"}";
|
||||
auto resp = htcli.Post("/query", query.str(), "application/json");
|
||||
if (resp) {
|
||||
if (resp->status == 200) {
|
||||
nlohmann::json results(OSUtils::jsonParse(resp->body));
|
||||
if ((results.is_array())&&(!results.empty())) {
|
||||
for(std::size_t ri=0;ri<results.size();++ri) {
|
||||
nlohmann::json &rset = results[ri];
|
||||
if ((rset.is_array())&&(!rset.empty())) {
|
||||
|
||||
nlohmann::json &result = rset[0];
|
||||
if ((results.is_array()) && (! results.empty())) {
|
||||
for (std::size_t ri = 0; ri < results.size(); ++ri) {
|
||||
nlohmann::json& rset = results[ri];
|
||||
if ((rset.is_array()) && (! rset.empty())) {
|
||||
nlohmann::json& result = rset[0];
|
||||
if (result.is_object()) {
|
||||
nlohmann::json &record = result["Record"];
|
||||
nlohmann::json& record = result["Record"];
|
||||
if (record.is_object()) {
|
||||
const std::string recordValue = result["Value"];
|
||||
//printf("GET network %s\n",recordValue.c_str());
|
||||
// printf("GET network %s\n",recordValue.c_str());
|
||||
nlohmann::json network(OSUtils::jsonParse(recordValue));
|
||||
if (network.is_object()) {
|
||||
const std::string idstr = network["id"];
|
||||
const uint64_t id = Utils::hexStrToU64(idstr.c_str());
|
||||
if ((id >> 24) == controllerAddressInt) { // sanity check
|
||||
if ((id >> 24) == controllerAddressInt) { // sanity check
|
||||
|
||||
nlohmann::json oldNetwork;
|
||||
if ((timeRangeStart > 0)&&(get(id,oldNetwork))) {
|
||||
if ((timeRangeStart > 0) && (get(id, oldNetwork))) {
|
||||
const uint64_t revision = network["revision"];
|
||||
const uint64_t prevRevision = oldNetwork["revision"];
|
||||
if (prevRevision < revision) {
|
||||
_networkChanged(oldNetwork,network,timeRangeStart > 0);
|
||||
_networkChanged(oldNetwork, network, timeRangeStart > 0);
|
||||
}
|
||||
} else {
|
||||
nlohmann::json nullJson;
|
||||
_networkChanged(nullJson,network,timeRangeStart > 0);
|
||||
}
|
||||
|
||||
else {
|
||||
nlohmann::json nullJson;
|
||||
_networkChanged(nullJson, network, timeRangeStart > 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr,"ERROR: LFDB: %d from node (check for network updates): %s" ZT_EOL_S,resp->status,resp->body.c_str());
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr,"ERROR: LFDB: node is offline" ZT_EOL_S);
|
||||
else {
|
||||
fprintf(stderr, "ERROR: LFDB: %d from node (check for network updates): %s" ZT_EOL_S, resp->status, resp->body.c_str());
|
||||
}
|
||||
}
|
||||
} catch (std::exception &e) {
|
||||
fprintf(stderr,"ERROR: LFDB: unexpected exception querying node (check for network updates): %s" ZT_EOL_S,e.what());
|
||||
} catch ( ... ) {
|
||||
fprintf(stderr,"ERROR: LFDB: unexpected exception querying node (check for network updates): unknown exception" ZT_EOL_S);
|
||||
else {
|
||||
fprintf(stderr, "ERROR: LFDB: node is offline" ZT_EOL_S);
|
||||
}
|
||||
}
|
||||
catch (std::exception& e) {
|
||||
fprintf(stderr, "ERROR: LFDB: unexpected exception querying node (check for network updates): %s" ZT_EOL_S, e.what());
|
||||
}
|
||||
catch (...) {
|
||||
fprintf(stderr, "ERROR: LFDB: unexpected exception querying node (check for network updates): unknown exception" ZT_EOL_S);
|
||||
}
|
||||
|
||||
try {
|
||||
std::ostringstream query;
|
||||
query <<
|
||||
"{"
|
||||
"\"Ranges\":[{"
|
||||
"\"Name\":\"" << networksSelectorName << "\","
|
||||
"\"Range\":[0,18446744073709551615]"
|
||||
"},{"
|
||||
"\"Name\":\"member\","
|
||||
"\"Range\":[0,18446744073709551615]"
|
||||
"}],"
|
||||
"\"TimeRange\":[" << timeRangeStart << ",9223372036854775807],"
|
||||
"\"MaskingKey\":\"" << maskingKey << "\","
|
||||
"\"Owners\":[\"" << _lfOwnerPublic << "\"]"
|
||||
"}";
|
||||
auto resp = htcli.Post("/query",query.str(),"application/json");
|
||||
query << "{"
|
||||
"\"Ranges\":[{"
|
||||
"\"Name\":\""
|
||||
<< networksSelectorName
|
||||
<< "\","
|
||||
"\"Range\":[0,18446744073709551615]"
|
||||
"},{"
|
||||
"\"Name\":\"member\","
|
||||
"\"Range\":[0,18446744073709551615]"
|
||||
"}],"
|
||||
"\"TimeRange\":["
|
||||
<< timeRangeStart
|
||||
<< ",9223372036854775807],"
|
||||
"\"MaskingKey\":\""
|
||||
<< maskingKey
|
||||
<< "\","
|
||||
"\"Owners\":[\""
|
||||
<< _lfOwnerPublic
|
||||
<< "\"]"
|
||||
"}";
|
||||
auto resp = htcli.Post("/query", query.str(), "application/json");
|
||||
if (resp) {
|
||||
if (resp->status == 200) {
|
||||
nlohmann::json results(OSUtils::jsonParse(resp->body));
|
||||
if ((results.is_array())&&(!results.empty())) {
|
||||
for(std::size_t ri=0;ri<results.size();++ri) {
|
||||
nlohmann::json &rset = results[ri];
|
||||
if ((rset.is_array())&&(!rset.empty())) {
|
||||
|
||||
nlohmann::json &result = rset[0];
|
||||
if ((results.is_array()) && (! results.empty())) {
|
||||
for (std::size_t ri = 0; ri < results.size(); ++ri) {
|
||||
nlohmann::json& rset = results[ri];
|
||||
if ((rset.is_array()) && (! rset.empty())) {
|
||||
nlohmann::json& result = rset[0];
|
||||
if (result.is_object()) {
|
||||
nlohmann::json &record = result["Record"];
|
||||
nlohmann::json& record = result["Record"];
|
||||
if (record.is_object()) {
|
||||
const std::string recordValue = result["Value"];
|
||||
//printf("GET member %s\n",recordValue.c_str());
|
||||
// printf("GET member %s\n",recordValue.c_str());
|
||||
nlohmann::json member(OSUtils::jsonParse(recordValue));
|
||||
if (member.is_object()) {
|
||||
const std::string nwidstr = member["nwid"];
|
||||
const std::string idstr = member["id"];
|
||||
const uint64_t nwid = Utils::hexStrToU64(nwidstr.c_str());
|
||||
const uint64_t id = Utils::hexStrToU64(idstr.c_str());
|
||||
if ((id)&&((nwid >> 24) == controllerAddressInt)) { // sanity check
|
||||
if ((id) && ((nwid >> 24) == controllerAddressInt)) { // sanity check
|
||||
|
||||
nlohmann::json network,oldMember;
|
||||
if ((timeRangeStart > 0)&&(get(nwid,network,id,oldMember))) {
|
||||
nlohmann::json network, oldMember;
|
||||
if ((timeRangeStart > 0) && (get(nwid, network, id, oldMember))) {
|
||||
const uint64_t revision = member["revision"];
|
||||
const uint64_t prevRevision = oldMember["revision"];
|
||||
if (prevRevision < revision)
|
||||
_memberChanged(oldMember,member,timeRangeStart > 0);
|
||||
} else if (hasNetwork(nwid)) {
|
||||
nlohmann::json nullJson;
|
||||
_memberChanged(nullJson,member,timeRangeStart > 0);
|
||||
_memberChanged(oldMember, member, timeRangeStart > 0);
|
||||
}
|
||||
else if (hasNetwork(nwid)) {
|
||||
nlohmann::json nullJson;
|
||||
_memberChanged(nullJson, member, timeRangeStart > 0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr,"ERROR: LFDB: %d from node (check for member updates): %s" ZT_EOL_S,resp->status,resp->body.c_str());
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr,"ERROR: LFDB: node is offline" ZT_EOL_S);
|
||||
else {
|
||||
fprintf(stderr, "ERROR: LFDB: %d from node (check for member updates): %s" ZT_EOL_S, resp->status, resp->body.c_str());
|
||||
}
|
||||
}
|
||||
} catch (std::exception &e) {
|
||||
fprintf(stderr,"ERROR: LFDB: unexpected exception querying node (check for member updates): %s" ZT_EOL_S,e.what());
|
||||
} catch ( ... ) {
|
||||
fprintf(stderr,"ERROR: LFDB: unexpected exception querying node (check for member updates): unknown exception" ZT_EOL_S);
|
||||
else {
|
||||
fprintf(stderr, "ERROR: LFDB: node is offline" ZT_EOL_S);
|
||||
}
|
||||
}
|
||||
catch (std::exception& e) {
|
||||
fprintf(stderr, "ERROR: LFDB: unexpected exception querying node (check for member updates): %s" ZT_EOL_S, e.what());
|
||||
}
|
||||
catch (...) {
|
||||
fprintf(stderr, "ERROR: LFDB: unexpected exception querying node (check for member updates): unknown exception" ZT_EOL_S);
|
||||
}
|
||||
|
||||
timeRangeStart = time(nullptr) - 120; // start next query 2m before now to avoid losing updates
|
||||
timeRangeStart = time(nullptr) - 120; // start next query 2m before now to avoid losing updates
|
||||
_ready.store(true);
|
||||
|
||||
for(int k=0;k<4;++k) { // 2s delay between queries for remotely modified networks or members
|
||||
if (!_running.load())
|
||||
for (int k = 0; k < 4; ++k) { // 2s delay between queries for remotely modified networks or members
|
||||
if (! _running.load())
|
||||
return;
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
}
|
||||
|
@ -328,7 +359,7 @@ LFDB::~LFDB()
|
|||
|
||||
bool LFDB::waitForReady()
|
||||
{
|
||||
while (!_ready.load()) {
|
||||
while (! _ready.load()) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
}
|
||||
return true;
|
||||
|
@ -339,18 +370,18 @@ bool LFDB::isReady()
|
|||
return (_ready.load());
|
||||
}
|
||||
|
||||
bool LFDB::save(nlohmann::json &record,bool notifyListeners)
|
||||
bool LFDB::save(nlohmann::json& record, bool notifyListeners)
|
||||
{
|
||||
bool modified = false;
|
||||
const std::string objtype = record["objtype"];
|
||||
if (objtype == "network") {
|
||||
const uint64_t nwid = OSUtils::jsonIntHex(record["id"],0ULL);
|
||||
const uint64_t nwid = OSUtils::jsonIntHex(record["id"], 0ULL);
|
||||
if (nwid) {
|
||||
nlohmann::json old;
|
||||
get(nwid,old);
|
||||
if ((!old.is_object())||(!_compareRecords(old,record))) {
|
||||
record["revision"] = OSUtils::jsonInt(record["revision"],0ULL) + 1ULL;
|
||||
_networkChanged(old,record,notifyListeners);
|
||||
get(nwid, old);
|
||||
if ((! old.is_object()) || (! _compareRecords(old, record))) {
|
||||
record["revision"] = OSUtils::jsonInt(record["revision"], 0ULL) + 1ULL;
|
||||
_networkChanged(old, record, notifyListeners);
|
||||
{
|
||||
std::lock_guard<std::mutex> l(_state_l);
|
||||
_state[nwid].dirty = true;
|
||||
|
@ -358,15 +389,16 @@ bool LFDB::save(nlohmann::json &record,bool notifyListeners)
|
|||
modified = true;
|
||||
}
|
||||
}
|
||||
} else if (objtype == "member") {
|
||||
const uint64_t nwid = OSUtils::jsonIntHex(record["nwid"],0ULL);
|
||||
const uint64_t id = OSUtils::jsonIntHex(record["id"],0ULL);
|
||||
if ((id)&&(nwid)) {
|
||||
nlohmann::json network,old;
|
||||
get(nwid,network,id,old);
|
||||
if ((!old.is_object())||(!_compareRecords(old,record))) {
|
||||
record["revision"] = OSUtils::jsonInt(record["revision"],0ULL) + 1ULL;
|
||||
_memberChanged(old,record,notifyListeners);
|
||||
}
|
||||
else if (objtype == "member") {
|
||||
const uint64_t nwid = OSUtils::jsonIntHex(record["nwid"], 0ULL);
|
||||
const uint64_t id = OSUtils::jsonIntHex(record["id"], 0ULL);
|
||||
if ((id) && (nwid)) {
|
||||
nlohmann::json network, old;
|
||||
get(nwid, network, id, old);
|
||||
if ((! old.is_object()) || (! _compareRecords(old, record))) {
|
||||
record["revision"] = OSUtils::jsonInt(record["revision"], 0ULL) + 1ULL;
|
||||
_memberChanged(old, record, notifyListeners);
|
||||
{
|
||||
std::lock_guard<std::mutex> l(_state_l);
|
||||
_state[nwid].members[id].dirty = true;
|
||||
|
@ -383,12 +415,12 @@ void LFDB::eraseNetwork(const uint64_t networkId)
|
|||
// TODO
|
||||
}
|
||||
|
||||
void LFDB::eraseMember(const uint64_t networkId,const uint64_t memberId)
|
||||
void LFDB::eraseMember(const uint64_t networkId, const uint64_t memberId)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void LFDB::nodeIsOnline(const uint64_t networkId,const uint64_t memberId,const InetAddress &physicalAddress)
|
||||
void LFDB::nodeIsOnline(const uint64_t networkId, const uint64_t memberId, const InetAddress& physicalAddress, const char* osArch)
|
||||
{
|
||||
std::lock_guard<std::mutex> l(_state_l);
|
||||
auto nw = _state.find(networkId);
|
||||
|
@ -403,4 +435,9 @@ void LFDB::nodeIsOnline(const uint64_t networkId,const uint64_t memberId,const I
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace ZeroTier
|
||||
void LFDB::nodeIsOnline(const uint64_t networkId, const uint64_t memberId, const InetAddress& physicalAddress)
|
||||
{
|
||||
this->nodeIsOnline(networkId, memberId, physicalAddress, "unknown/unknown");
|
||||
}
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file in the project's root directory.
|
||||
*
|
||||
* Change Date: 2025-01-01
|
||||
* Change Date: 2026-01-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2.0 of the Apache License.
|
||||
|
@ -16,19 +16,18 @@
|
|||
|
||||
#include "DB.hpp"
|
||||
|
||||
#include <atomic>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <atomic>
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
/**
|
||||
* DB implementation for controller that stores data in LF
|
||||
*/
|
||||
class LFDB : public DB
|
||||
{
|
||||
public:
|
||||
class LFDB : public DB {
|
||||
public:
|
||||
/**
|
||||
* @param myId This controller's identity
|
||||
* @param path Base path for ZeroTier node itself
|
||||
|
@ -38,44 +37,41 @@ public:
|
|||
* @param lfNodePort LF node http (not https) port
|
||||
* @param storeOnlineState If true, store online/offline state and IP info in LF (a lot of data, only for private networks!)
|
||||
*/
|
||||
LFDB(const Identity &myId,const char *path,const char *lfOwnerPrivate,const char *lfOwnerPublic,const char *lfNodeHost,int lfNodePort,bool storeOnlineState);
|
||||
LFDB(const Identity& myId, const char* path, const char* lfOwnerPrivate, const char* lfOwnerPublic, const char* lfNodeHost, int lfNodePort, bool storeOnlineState);
|
||||
virtual ~LFDB();
|
||||
|
||||
virtual bool waitForReady();
|
||||
virtual bool isReady();
|
||||
virtual bool save(nlohmann::json &record,bool notifyListeners);
|
||||
virtual bool save(nlohmann::json& record, bool notifyListeners);
|
||||
virtual void eraseNetwork(const uint64_t networkId);
|
||||
virtual void eraseMember(const uint64_t networkId,const uint64_t memberId);
|
||||
virtual void nodeIsOnline(const uint64_t networkId,const uint64_t memberId,const InetAddress &physicalAddress);
|
||||
virtual void eraseMember(const uint64_t networkId, const uint64_t memberId);
|
||||
virtual void nodeIsOnline(const uint64_t networkId, const uint64_t memberId, const InetAddress& physicalAddress);
|
||||
virtual void nodeIsOnline(const uint64_t networkId, const uint64_t memberId, const InetAddress& physicalAddress, const char* osArch);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
const Identity _myId;
|
||||
|
||||
std::string _lfOwnerPrivate,_lfOwnerPublic;
|
||||
std::string _lfOwnerPrivate, _lfOwnerPublic;
|
||||
std::string _lfNodeHost;
|
||||
int _lfNodePort;
|
||||
|
||||
struct _MemberState
|
||||
{
|
||||
_MemberState() :
|
||||
lastOnlineAddress(),
|
||||
lastOnlineTime(0),
|
||||
dirty(false),
|
||||
lastOnlineDirty(false) {}
|
||||
struct _MemberState {
|
||||
_MemberState() : lastOnlineAddress(), lastOnlineTime(0), dirty(false), lastOnlineDirty(false)
|
||||
{
|
||||
}
|
||||
InetAddress lastOnlineAddress;
|
||||
int64_t lastOnlineTime;
|
||||
bool dirty;
|
||||
bool lastOnlineDirty;
|
||||
};
|
||||
struct _NetworkState
|
||||
{
|
||||
_NetworkState() :
|
||||
members(),
|
||||
dirty(false) {}
|
||||
std::unordered_map<uint64_t,_MemberState> members;
|
||||
struct _NetworkState {
|
||||
_NetworkState() : members(), dirty(false)
|
||||
{
|
||||
}
|
||||
std::unordered_map<uint64_t, _MemberState> members;
|
||||
bool dirty;
|
||||
};
|
||||
std::unordered_map<uint64_t,_NetworkState> _state;
|
||||
std::unordered_map<uint64_t, _NetworkState> _state;
|
||||
std::mutex _state_l;
|
||||
|
||||
std::atomic_bool _running;
|
||||
|
@ -84,6 +80,6 @@ protected:
|
|||
bool _storeOnlineState;
|
||||
};
|
||||
|
||||
} // namespace ZeroTier
|
||||
} // namespace ZeroTier
|
||||
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,116 +1,195 @@
|
|||
/*
|
||||
* Copyright (c)2019 ZeroTier, Inc.
|
||||
* Copyright (c)2025 ZeroTier, Inc.
|
||||
*
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file in the project's root directory.
|
||||
*
|
||||
* Change Date: 2025-01-01
|
||||
* Change Date: 2026-01-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2.0 of the Apache License.
|
||||
*/
|
||||
/****/
|
||||
|
||||
#include "DB.hpp"
|
||||
|
||||
#ifdef ZT_CONTROLLER_USE_LIBPQ
|
||||
|
||||
#ifndef ZT_CONTROLLER_LIBPQ_HPP
|
||||
#define ZT_CONTROLLER_LIBPQ_HPP
|
||||
#ifndef ZT_CONTROLLER_POSTGRESQL_HPP
|
||||
#define ZT_CONTROLLER_POSTGRESQL_HPP
|
||||
|
||||
#define ZT_CENTRAL_CONTROLLER_COMMIT_THREADS 4
|
||||
#include "ConnectionPool.hpp"
|
||||
#include "DB.hpp"
|
||||
#include "opentelemetry/trace/provider.h"
|
||||
|
||||
#include <memory>
|
||||
#include <redis++/redis++.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <pqxx/pqxx>
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
extern "C" {
|
||||
typedef struct pg_conn PGconn;
|
||||
}
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
struct RedisConfig;
|
||||
|
||||
/**
|
||||
* A controller database driver that talks to PostgreSQL
|
||||
*
|
||||
* This is for use with ZeroTier Central. Others are free to build and use it
|
||||
* but be aware taht we might change it at any time.
|
||||
*/
|
||||
class PostgreSQL : public DB
|
||||
{
|
||||
public:
|
||||
PostgreSQL(const Identity &myId, const char *path, int listenPort, RedisConfig *rc);
|
||||
virtual ~PostgreSQL();
|
||||
|
||||
virtual bool waitForReady();
|
||||
virtual bool isReady();
|
||||
virtual bool save(nlohmann::json &record,bool notifyListeners);
|
||||
virtual void eraseNetwork(const uint64_t networkId);
|
||||
virtual void eraseMember(const uint64_t networkId, const uint64_t memberId);
|
||||
virtual void nodeIsOnline(const uint64_t networkId, const uint64_t memberId, const InetAddress &physicalAddress);
|
||||
|
||||
protected:
|
||||
struct _PairHasher
|
||||
class PostgresConnection : public Connection {
|
||||
public:
|
||||
virtual ~PostgresConnection()
|
||||
{
|
||||
inline std::size_t operator()(const std::pair<uint64_t,uint64_t> &p) const { return (std::size_t)(p.first ^ p.second); }
|
||||
};
|
||||
}
|
||||
|
||||
private:
|
||||
void initializeNetworks(PGconn *conn);
|
||||
void initializeMembers(PGconn *conn);
|
||||
void heartbeat();
|
||||
void membersDbWatcher();
|
||||
void _membersWatcher_Postgres(PGconn *conn);
|
||||
void networksDbWatcher();
|
||||
void _networksWatcher_Postgres(PGconn *conn);
|
||||
|
||||
void _membersWatcher_Redis();
|
||||
void _networksWatcher_Redis();
|
||||
|
||||
void commitThread();
|
||||
void onlineNotificationThread();
|
||||
void onlineNotification_Postgres();
|
||||
void onlineNotification_Redis();
|
||||
void _doRedisUpdate(sw::redis::Transaction &tx, std::string &controllerId,
|
||||
std::unordered_map< std::pair<uint64_t,uint64_t>,std::pair<int64_t,InetAddress>,_PairHasher > &lastOnline);
|
||||
|
||||
enum OverrideMode {
|
||||
ALLOW_PGBOUNCER_OVERRIDE = 0,
|
||||
NO_OVERRIDE = 1
|
||||
};
|
||||
|
||||
PGconn * getPgConn( OverrideMode m = ALLOW_PGBOUNCER_OVERRIDE );
|
||||
|
||||
const Identity _myId;
|
||||
const Address _myAddress;
|
||||
std::string _myAddressStr;
|
||||
std::string _connString;
|
||||
|
||||
BlockingQueue< std::pair<nlohmann::json,bool> > _commitQueue;
|
||||
|
||||
std::thread _heartbeatThread;
|
||||
std::thread _membersDbWatcher;
|
||||
std::thread _networksDbWatcher;
|
||||
std::thread _commitThread[ZT_CENTRAL_CONTROLLER_COMMIT_THREADS];
|
||||
std::thread _onlineNotificationThread;
|
||||
|
||||
std::unordered_map< std::pair<uint64_t,uint64_t>,std::pair<int64_t,InetAddress>,_PairHasher > _lastOnline;
|
||||
|
||||
mutable std::mutex _lastOnline_l;
|
||||
mutable std::mutex _readyLock;
|
||||
std::atomic<int> _ready, _connected, _run;
|
||||
mutable volatile bool _waitNoticePrinted;
|
||||
|
||||
int _listenPort;
|
||||
|
||||
RedisConfig *_rc;
|
||||
std::shared_ptr<sw::redis::Redis> _redis;
|
||||
std::shared_ptr<sw::redis::RedisCluster> _cluster;
|
||||
std::shared_ptr<pqxx::connection> c;
|
||||
int a;
|
||||
};
|
||||
|
||||
} // namespace ZeroTier
|
||||
class PostgresConnFactory : public ConnectionFactory {
|
||||
public:
|
||||
PostgresConnFactory(std::string& connString) : m_connString(connString)
|
||||
{
|
||||
}
|
||||
|
||||
#endif // ZT_CONTROLLER_LIBPQ_HPP
|
||||
virtual std::shared_ptr<Connection> create()
|
||||
{
|
||||
Metrics::conn_counter++;
|
||||
auto c = std::shared_ptr<PostgresConnection>(new PostgresConnection());
|
||||
c->c = std::make_shared<pqxx::connection>(m_connString);
|
||||
return std::static_pointer_cast<Connection>(c);
|
||||
}
|
||||
|
||||
#endif // ZT_CONTROLLER_USE_LIBPQ
|
||||
private:
|
||||
std::string m_connString;
|
||||
};
|
||||
|
||||
template <typename T> class MemberNotificationReceiver : public pqxx::notification_receiver {
|
||||
public:
|
||||
MemberNotificationReceiver(T* p, pqxx::connection& c, const std::string& channel) : pqxx::notification_receiver(c, channel), _psql(p)
|
||||
{
|
||||
fprintf(stderr, "initialize MemberNotificationReceiver\n");
|
||||
}
|
||||
|
||||
virtual ~MemberNotificationReceiver()
|
||||
{
|
||||
fprintf(stderr, "MemberNotificationReceiver destroyed\n");
|
||||
}
|
||||
|
||||
virtual void operator()(const std::string& payload, int backendPid)
|
||||
{
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("db_member_notification");
|
||||
auto span = tracer->StartSpan("db_member_notification::operator()");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
span->SetAttribute("payload", payload);
|
||||
span->SetAttribute("psqlReady", _psql->isReady());
|
||||
|
||||
fprintf(stderr, "Member Notification received: %s\n", payload.c_str());
|
||||
Metrics::pgsql_mem_notification++;
|
||||
nlohmann::json tmp(nlohmann::json::parse(payload));
|
||||
nlohmann::json& ov = tmp["old_val"];
|
||||
nlohmann::json& nv = tmp["new_val"];
|
||||
nlohmann::json oldConfig, newConfig;
|
||||
if (ov.is_object())
|
||||
oldConfig = ov;
|
||||
if (nv.is_object())
|
||||
newConfig = nv;
|
||||
|
||||
if (oldConfig.is_object() && newConfig.is_object()) {
|
||||
_psql->save(newConfig, _psql->isReady());
|
||||
fprintf(stderr, "payload sent\n");
|
||||
}
|
||||
else if (newConfig.is_object() && ! oldConfig.is_object()) {
|
||||
// new member
|
||||
Metrics::member_count++;
|
||||
_psql->save(newConfig, _psql->isReady());
|
||||
fprintf(stderr, "new member payload sent\n");
|
||||
}
|
||||
else if (! newConfig.is_object() && oldConfig.is_object()) {
|
||||
// member delete
|
||||
uint64_t networkId = OSUtils::jsonIntHex(oldConfig["nwid"], 0ULL);
|
||||
uint64_t memberId = OSUtils::jsonIntHex(oldConfig["id"], 0ULL);
|
||||
if (memberId && networkId) {
|
||||
_psql->eraseMember(networkId, memberId);
|
||||
fprintf(stderr, "member delete payload sent\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
T* _psql;
|
||||
};
|
||||
|
||||
template <typename T> class NetworkNotificationReceiver : public pqxx::notification_receiver {
|
||||
public:
|
||||
NetworkNotificationReceiver(T* p, pqxx::connection& c, const std::string& channel) : pqxx::notification_receiver(c, channel), _psql(p)
|
||||
{
|
||||
fprintf(stderr, "initialize NetworkrNotificationReceiver\n");
|
||||
}
|
||||
|
||||
virtual ~NetworkNotificationReceiver()
|
||||
{
|
||||
fprintf(stderr, "NetworkNotificationReceiver destroyed\n");
|
||||
};
|
||||
|
||||
virtual void operator()(const std::string& payload, int packend_pid)
|
||||
{
|
||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||
auto tracer = provider->GetTracer("db_network_notification");
|
||||
auto span = tracer->StartSpan("db_network_notification::operator()");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
span->SetAttribute("payload", payload);
|
||||
span->SetAttribute("psqlReady", _psql->isReady());
|
||||
|
||||
fprintf(stderr, "Network Notification received: %s\n", payload.c_str());
|
||||
Metrics::pgsql_net_notification++;
|
||||
nlohmann::json tmp(nlohmann::json::parse(payload));
|
||||
|
||||
nlohmann::json& ov = tmp["old_val"];
|
||||
nlohmann::json& nv = tmp["new_val"];
|
||||
nlohmann::json oldConfig, newConfig;
|
||||
|
||||
if (ov.is_object())
|
||||
oldConfig = ov;
|
||||
if (nv.is_object())
|
||||
newConfig = nv;
|
||||
|
||||
if (oldConfig.is_object() && newConfig.is_object()) {
|
||||
std::string nwid = oldConfig["id"];
|
||||
span->SetAttribute("action", "network_change");
|
||||
span->SetAttribute("network_id", nwid);
|
||||
_psql->save(newConfig, _psql->isReady());
|
||||
fprintf(stderr, "payload sent\n");
|
||||
}
|
||||
else if (newConfig.is_object() && ! oldConfig.is_object()) {
|
||||
std::string nwid = newConfig["id"];
|
||||
span->SetAttribute("network_id", nwid);
|
||||
span->SetAttribute("action", "new_network");
|
||||
// new network
|
||||
_psql->save(newConfig, _psql->isReady());
|
||||
fprintf(stderr, "new network payload sent\n");
|
||||
}
|
||||
else if (! newConfig.is_object() && oldConfig.is_object()) {
|
||||
// network delete
|
||||
span->SetAttribute("action", "delete_network");
|
||||
std::string nwid = oldConfig["id"];
|
||||
span->SetAttribute("network_id", nwid);
|
||||
uint64_t networkId = Utils::hexStrToU64(nwid.c_str());
|
||||
span->SetAttribute("network_id_int", networkId);
|
||||
if (networkId) {
|
||||
_psql->eraseNetwork(networkId);
|
||||
fprintf(stderr, "network delete payload sent\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
T* _psql;
|
||||
};
|
||||
|
||||
struct NodeOnlineRecord {
|
||||
uint64_t lastSeen;
|
||||
InetAddress physicalAddress;
|
||||
std::string osArch;
|
||||
};
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
||||
#endif // ZT_CONTROLLER_POSTGRESQL_HPP
|
||||
|
||||
#endif // ZT_CONTROLLER_USE_LIBPQ
|
|
@ -3,7 +3,7 @@ Network Controller Microservice
|
|||
|
||||
Every ZeroTier virtual network has a *network controller* responsible for admitting members to the network, issuing certificates, and issuing default configuration information.
|
||||
|
||||
This is our reference controller implementation and is the same one we use to power our own hosted services at [my.zerotier.com](https://my.zerotier.com/). As of ZeroTier One version 1.2.0 this code is included in normal builds for desktop, laptop, and server (Linux, etc.) targets.
|
||||
This is our reference controller implementation and is almost the same as the one we use to power our own hosted services at [my.zerotier.com](https://my.zerotier.com/). The only difference is the database backend used.
|
||||
|
||||
Controller data is stored in JSON format under `controller.d` in the ZeroTier working directory. It can be copied, rsync'd, placed in `git`, etc. The files under `controller.d` should not be modified in place while the controller is running or data loss may result, and if they are edited directly take care not to save corrupt JSON since that can also lead to data loss when the controller is restarted. Going through the API is strongly preferred to directly modifying these files.
|
||||
|
||||
|
@ -19,10 +19,6 @@ Since ZeroTier nodes are mobile and do not need static IPs, implementing high av
|
|||
|
||||
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.
|
||||
|
||||
### PostgreSQL Database Implementation
|
||||
|
||||
The default controller stores its data in the filesystem in `controller.d` under ZeroTier's home folder. There's an alternative implementation that stores data in PostgreSQL that can be built with `make central-controller`. Right now this is only guaranteed to build and run on Centos 7 Linux with PostgreSQL 10 installed via the [PostgreSQL Yum Repository](https://www.postgresql.org/download/linux/redhat/) and is designed for use with [ZeroTier Central](https://my.zerotier.com/). You're welcome to use it but we don't "officially" support it for end-user use and it could change at any time.
|
||||
|
||||
### Upgrading from Older (1.1.14 or earlier) Versions
|
||||
|
||||
Older versions of this code used a SQLite database instead of in-filesystem JSON. A migration utility called `migrate-sqlite` is included here and *must* be used to migrate this data to the new format. If the controller is started with an old `controller.db` in its working directory it will terminate after printing an error to *stderr*. This is done to prevent "surprises" for those running DIY controllers using the old code.
|
||||
|
@ -43,210 +39,17 @@ While networks with any valid ID can be added to the controller's database, it w
|
|||
|
||||
The controller JSON API is *very* sensitive about types. Integers must be integers and strings strings, etc. Incorrect types may be ignored, set to default values, or set to undefined values.
|
||||
|
||||
#### `/controller`
|
||||
Full documentation of the Controller API can be found on our [documentation site](https://docs.zerotier.com/service/v1#tag/controller)
|
||||
|
||||
* Purpose: Check for controller function and return controller status
|
||||
* Methods: GET
|
||||
* Returns: { object }
|
||||
### Prometheus Metrics
|
||||
|
||||
| Field | Type | Description | Writable |
|
||||
| ------------------ | ----------- | ------------------------------------------------- | -------- |
|
||||
| controller | boolean | Always 'true' | no |
|
||||
| apiVersion | integer | Controller API version, currently 3 | no |
|
||||
| clock | integer | Current clock on controller, ms since epoch | no |
|
||||
|
||||
#### `/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.
|
||||
|
||||
Example:
|
||||
|
||||
`curl -X POST --header "X-ZT1-Auth: secret" -d '{"name":"my network"}' http://localhost:9993/controller/network/305f406058______`
|
||||
|
||||
**Network object format:**
|
||||
|
||||
| Field | Type | Description | Writable |
|
||||
| --------------------- | ------------- | ------------------------------------------------- | -------- |
|
||||
| id | string | 16-digit network ID | no |
|
||||
| nwid | string | 16-digit network ID (legacy) | no |
|
||||
| objtype | string | Always "network" | no |
|
||||
| name | string | A short name for this network | YES |
|
||||
| creationTime | integer | Time network record was created (ms since epoch) | no |
|
||||
| private | boolean | Is access control enabled? | YES |
|
||||
| enableBroadcast | boolean | Ethernet ff:ff:ff:ff:ff:ff allowed? | YES |
|
||||
| v4AssignMode | object | IPv4 management and assign options (see below) | YES |
|
||||
| v6AssignMode | object | IPv6 management and assign options (see below) | YES |
|
||||
| mtu | integer | Network MTU (default: 2800) | YES |
|
||||
| multicastLimit | integer | Maximum recipients for a multicast packet | YES |
|
||||
| revision | integer | Network config revision counter | no |
|
||||
| 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 |
|
||||
| capabilities | array[object] | Array of capability objects (see below) | YES |
|
||||
| tags | array[object] | Array of tag objects (see below) | YES |
|
||||
| remoteTraceTarget | string | 10-digit ZeroTier ID of remote trace target | YES |
|
||||
| remoteTraceLevel | integer | Remote trace verbosity level | YES |
|
||||
|
||||
* Networks without rules won't carry any traffic. If you don't specify any on network creation an "accept anything" rule set will automatically be added.
|
||||
* 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 otherwise not common.
|
||||
* Changing the MTU can be disruptive and on some operating systems may require a leave/rejoin of the network or a restart of the ZeroTier service.
|
||||
|
||||
**Auto-Assign Modes:**
|
||||
|
||||
Auto assign modes (`v4AssignMode` and `v6AssignMode`) contain objects that map assignment modes to booleans.
|
||||
|
||||
For IPv4 the only valid setting is `zt` which, if true, causes IPv4 addresses to be auto-assigned from `ipAssignmentPools` to members that do not have an IPv4 assignment. Note that active bridges are exempt and will not get auto-assigned IPs since this can interfere with bridging. (You can still manually assign one if you want.)
|
||||
|
||||
IPv6 includes this option and two others: `6plane` and `rfc4193`. These assign private IPv6 addresses to each member based on a deterministic assignment scheme that allows members to emulate IPv6 NDP to skip multicast for better performance and scalability. The `rfc4193` mode gives every member a /128 on a /88 network, while `6plane` gives every member a /80 within a /40 network but uses NDP emulation to route *all* IPs under that /80 to its owner. The `6plane` mode is great for use cases like Docker since it allows every member to assign IPv6 addresses within its /80 that just work instantly and globally across the network.
|
||||
|
||||
**IP assignment pool object format:**
|
||||
|
||||
| Field | Type | Description |
|
||||
| --------------------- | ------------- | ------------------------------------------------- |
|
||||
| ipRangeStart | string | Starting IP address in range |
|
||||
| ipRangeEnd | string | Ending IP address in range (inclusive) |
|
||||
|
||||
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.
|
||||
|
||||
**Managed Route object format:**
|
||||
|
||||
| Field | Type | Description |
|
||||
| --------------------- | ------------- | ------------------------------------------------- |
|
||||
| target | string | Subnet in CIDR notation |
|
||||
| via | string/null | Next hop router IP address |
|
||||
|
||||
Managed Route objects look like this:
|
||||
|
||||
{
|
||||
"target": "10.147.20.0/24"
|
||||
}
|
||||
|
||||
or
|
||||
|
||||
{
|
||||
"target": "192.168.168.0/24",
|
||||
"via": "10.147.20.1"
|
||||
}
|
||||
|
||||
**Rule object format:**
|
||||
|
||||
Each rule is actually a sequence of zero or more `MATCH_` entries in the rule array followed by an `ACTION_` entry that describes what to do if all the preceding entries match. An `ACTION_` without any preceding `MATCH_` entries is always taken, so setting a single `ACTION_ACCEPT` rule yields a network that allows all traffic. If no rules are present the default action is `ACTION_DROP`.
|
||||
|
||||
Rules are evaluated in the order in which they appear in the array. There is currently a limit of 256 entries per network. Capabilities should be used if a larger and more complex rule set is needed since they allow rules to be grouped by purpose and only shipped to members that need them.
|
||||
|
||||
Each rule table entry has two common fields.
|
||||
|
||||
| Field | Type | Description |
|
||||
| --------------------- | ------------- | ------------------------------------------------- |
|
||||
| type | string | Entry type (all caps, case sensitive) |
|
||||
| not | boolean | If true, MATCHes match if they don't match |
|
||||
|
||||
The following fields may or may not be present depending on rule type:
|
||||
|
||||
| Field | Type | Description |
|
||||
| --------------------- | ------------- | ------------------------------------------------- |
|
||||
| zt | string | 10-digit hex ZeroTier address |
|
||||
| etherType | integer | Ethernet frame type |
|
||||
| mac | string | Hex MAC address (with or without :'s) |
|
||||
| ip | string | IPv4 or IPv6 address |
|
||||
| ipTos | integer | IP type of service |
|
||||
| ipProtocol | integer | IP protocol (e.g. TCP) |
|
||||
| start | integer | Start of an integer range (e.g. port range) |
|
||||
| end | integer | End of an integer range (inclusive) |
|
||||
| id | integer | Tag ID |
|
||||
| value | integer | Tag value or comparison value |
|
||||
| mask | integer | Bit mask (for characteristics flags) |
|
||||
|
||||
The entry types and their additional fields are:
|
||||
|
||||
| Entry type | Description | Fields |
|
||||
| ------------------------------- | ----------------------------------------------------------------- | -------------- |
|
||||
| `ACTION_DROP` | Drop any packets matching this rule | (none) |
|
||||
| `ACTION_ACCEPT` | Accept any packets matching this rule | (none) |
|
||||
| `ACTION_TEE` | Send a copy of this packet to a node (rule parsing continues) | `zt` |
|
||||
| `ACTION_REDIRECT` | Redirect this packet to another node | `zt` |
|
||||
| `ACTION_DEBUG_LOG` | Output debug info on match (if built with rules engine debug) | (none) |
|
||||
| `MATCH_SOURCE_ZEROTIER_ADDRESS` | Match VL1 ZeroTier address of packet sender. | `zt` |
|
||||
| `MATCH_DEST_ZEROTIER_ADDRESS` | Match VL1 ZeroTier address of recipient | `zt` |
|
||||
| `MATCH_ETHERTYPE` | Match Ethernet frame type | `etherType` |
|
||||
| `MATCH_MAC_SOURCE` | Match source Ethernet MAC address | `mac` |
|
||||
| `MATCH_MAC_DEST` | Match destination Ethernet MAC address | `mac` |
|
||||
| `MATCH_IPV4_SOURCE` | Match source IPv4 address | `ip` |
|
||||
| `MATCH_IPV4_DEST` | Match destination IPv4 address | `ip` |
|
||||
| `MATCH_IPV6_SOURCE` | Match source IPv6 address | `ip` |
|
||||
| `MATCH_IPV6_DEST` | Match destination IPv6 address | `ip` |
|
||||
| `MATCH_IP_TOS` | Match IP TOS field | `ipTos` |
|
||||
| `MATCH_IP_PROTOCOL` | Match IP protocol field | `ipProtocol` |
|
||||
| `MATCH_IP_SOURCE_PORT_RANGE` | Match a source IP port range | `start`,`end` |
|
||||
| `MATCH_IP_DEST_PORT_RANGE` | Match a destination IP port range | `start`,`end` |
|
||||
| `MATCH_CHARACTERISTICS` | Match on characteristics flags | `mask`,`value` |
|
||||
| `MATCH_FRAME_SIZE_RANGE` | Match a range of Ethernet frame sizes | `start`,`end` |
|
||||
| `MATCH_TAGS_SAMENESS` | Match if both sides' tags differ by no more than value | `id`,`value` |
|
||||
| `MATCH_TAGS_BITWISE_AND` | Match if both sides' tags AND to value | `id`,`value` |
|
||||
| `MATCH_TAGS_BITWISE_OR` | Match if both sides' tags OR to value | `id`,`value` |
|
||||
| `MATCH_TAGS_BITWISE_XOR` | Match if both sides' tags XOR to value | `id`,`value` |
|
||||
|
||||
Important notes about rules engine behavior:
|
||||
|
||||
* IPv4 and IPv6 IP address rules do not match for frames that are not IPv4 or IPv6 respectively.
|
||||
* `ACTION_DEBUG_LOG` is a no-op on nodes not built with `ZT_RULES_ENGINE_DEBUGGING` enabled (see Network.cpp). If that is enabled nodes will dump a trace of rule evaluation results to *stdout* when this action is encountered but will otherwise keep evaluating rules. This is used for basic "smoke testing" of the rules engine.
|
||||
* Multicast packets and packets destined for bridged devices treated a little differently. They are matched more than once. They are matched at the point of send with a NULL ZeroTier destination address, meaning that `MATCH_DEST_ZEROTIER_ADDRESS` is useless. That's because the true VL1 destination is not yet known. Then they are matched again for each true VL1 destination. On these later subsequent matches TEE actions are ignored and REDIRECT rules are interpreted as DROPs. This prevents multiple TEE or REDIRECT packets from being sent to third party devices.
|
||||
* Rules in capabilities are always matched as if the current device is the sender (inbound == false). A capability specifies sender side rules that can be enforced on both sides.
|
||||
|
||||
#### `/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>/member/<address>`
|
||||
|
||||
* Purpose: Create, authorize, or remove a network member
|
||||
* Methods: GET, POST, DELETE
|
||||
* Returns: { object }
|
||||
|
||||
| Field | Type | Description | Writable |
|
||||
| --------------------- | ------------- | ------------------------------------------------- | -------- |
|
||||
| id | string | Member's 10-digit ZeroTier address | no |
|
||||
| address | string | Member's 10-digit ZeroTier address | no |
|
||||
| nwid | string | 16-digit network ID | 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 |
|
||||
| revision | integer | Member revision counter | no |
|
||||
| vMajor | integer | Most recently known major version | no |
|
||||
| vMinor | integer | Most recently known minor version | no |
|
||||
| vRev | integer | Most recently known revision | no |
|
||||
| vProto | integer | Most recently known protocl version | no |
|
||||
|
||||
Note that managed IP assignments are only used if they fall within a managed route. Otherwise they are ignored.
|
||||
Controller specific metrics are available from the `/metrics` endpoint.
|
||||
|
||||
| Metric Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| controller_network_count | Gauge | number of networks the controller is serving |
|
||||
| controller_member_count | Gauge | number of network members the controller is serving |
|
||||
| controller_network_change_count | Counter | number of times a network configuration is changed |
|
||||
| controller_member_change_count | Counter | number of times a network member configuration is changed |
|
||||
| controller_member_auth_count | Counter | number of network member auths |
|
||||
| controller_member_deauth_count | Counter | number of network member deauths|
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
|
||||
namespace ZeroTier {
|
||||
struct RedisConfig {
|
||||
std::string hostname;
|
||||
int port;
|
||||
std::string password;
|
||||
bool clusterMode;
|
||||
std::string hostname;
|
||||
int port;
|
||||
std::string password;
|
||||
bool clusterMode;
|
||||
};
|
||||
}
|
||||
} // namespace ZeroTier
|
||||
|
||||
#endif
|
158
debian/changelog
vendored
158
debian/changelog
vendored
|
@ -1,3 +1,161 @@
|
|||
zerotier-one (1.14.2) unstable; urgency=medium
|
||||
|
||||
* See RELEASE-NOTES.md for release notes.
|
||||
|
||||
-- Adam Ierymenko <adam.ierymenko@zerotier.com> Wed, 23 Oct 2024 01:00:00 -0700
|
||||
|
||||
zerotier-one (1.14.1) unstable; urgency=medium
|
||||
|
||||
* See RELEASE-NOTES.md for release notes.
|
||||
|
||||
-- Adam Ierymenko <adam.ierymenko@zerotier.com> Wed, 11 Sep 2024 01:00:00 -0700
|
||||
|
||||
zerotier-one (1.14.0) unstable; urgency=medium
|
||||
|
||||
* See RELEASE-NOTES.md for release notes.
|
||||
|
||||
-- Adam Ierymenko <adam.ierymenko@zerotier.com> Tue, 19 Mar 2024 01:00:00 -0700
|
||||
|
||||
zerotier-one (1.12.2) unstable; urgency=medium
|
||||
|
||||
* See RELEASE-NOTES.md for release notes.
|
||||
|
||||
-- Adam Ierymenko <adam.ierymenko@zerotier.com> Tue, 12 Sep 2023 01:00:00 -0700
|
||||
|
||||
zerotier-one (1.12.1) unstable; urgency=medium
|
||||
|
||||
* See RELEASE-NOTES.md for release notes.
|
||||
|
||||
-- Adam Ierymenko <adam.ierymenko@zerotier.com> Fri, 25 Aug 2023 01:00:00 -0700
|
||||
|
||||
zerotier-one (1.12.0) unstable; urgency=medium
|
||||
|
||||
* See RELEASE-NOTES.md for release notes.
|
||||
|
||||
-- Adam Ierymenko <adam.ierymenko@zerotier.com> Thu, 17 Aug 2023 01:00:00 -0700
|
||||
|
||||
zerotier-one (1.10.6) unstable; urgency=medium
|
||||
|
||||
* See RELEASE-NOTES.md for release notes.
|
||||
|
||||
-- Adam Ierymenko <adam.ierymenko@zerotier.com> Tue, 21 Mar 2023 01:00:00 -0700
|
||||
|
||||
zerotier-one (1.10.5) unstable; urgency=medium
|
||||
|
||||
* See RELEASE-NOTES.md for release notes.
|
||||
|
||||
-- Adam Ierymenko <adam.ierymenko@zerotier.com> Fri, 10 Mar 2023 01:00:00 -0700
|
||||
|
||||
zerotier-one (1.10.4) unstable; urgency=medium
|
||||
|
||||
* See RELEASE-NOTES.md for release notes.
|
||||
|
||||
-- Adam Ierymenko <adam.ierymenko@zerotier.com> Mon, 06 Mar 2023 01:00:00 -0700
|
||||
|
||||
zerotier-one (1.10.3) unstable; urgency=medium
|
||||
|
||||
* See RELEASE-NOTES.md for release notes.
|
||||
|
||||
-- Adam Ierymenko <adam.ierymenko@zerotier.com> Sat, 21 Jan 2023 01:00:00 -0700
|
||||
|
||||
zerotier-one (1.10.2) unstable; urgency=medium
|
||||
|
||||
* See RELEASE-NOTES.md for release notes.
|
||||
|
||||
-- Adam Ierymenko <adam.ierymenko@zerotier.com> Thu, 13 Oct 2022 01:00:00 -0700
|
||||
|
||||
zerotier-one (1.10.1) unstable; urgency=medium
|
||||
|
||||
* See RELEASE-NOTES.md for release notes.
|
||||
|
||||
-- Adam Ierymenko <adam.ierymenko@zerotier.com> Mon, 27 Jun 2022 01:00:00 -0700
|
||||
|
||||
zerotier-one (1.10.0) unstable; urgency=medium
|
||||
|
||||
* See RELEASE-NOTES.md for release notes.
|
||||
|
||||
-- Adam Ierymenko <adam.ierymenko@zerotier.com> Fri, 03 Jun 2022 01:00:00 -0700
|
||||
|
||||
zerotier-one (1.8.10) unstable; urgency=medium
|
||||
|
||||
* See RELEASE-NOTES.md for release notes.
|
||||
|
||||
-- Adam Ierymenko <adam.ierymenko@zerotier.com> Tue, 10 May 2022 01:00:00 -0700
|
||||
|
||||
zerotier-one (1.8.9) unstable; urgency=medium
|
||||
|
||||
* See RELEASE-NOTES.md for release notes.
|
||||
|
||||
-- Adam Ierymenko <adam.ierymenko@zerotier.com> Mon, 25 Apr 2022 01:00:00 -0700
|
||||
|
||||
zerotier-one (1.8.8) unstable; urgency=medium
|
||||
|
||||
* See RELEASE-NOTES.md for release notes.
|
||||
|
||||
-- Adam Ierymenko <adam.ierymenko@zerotier.com> Mon, 11 Apr 2022 01:00:00 -0700
|
||||
|
||||
zerotier-one (1.8.7) unstable; urgency=medium
|
||||
|
||||
* See RELEASE-NOTES.md for release notes.
|
||||
|
||||
-- Adam Ierymenko <adam.ierymenko@zerotier.com> Mon, 21 Mar 2022 01:00:00 -0700
|
||||
|
||||
zerotier-one (1.8.6) unstable; urgency=medium
|
||||
|
||||
* See RELEASE-NOTES.md for release notes.
|
||||
|
||||
-- Adam Ierymenko <adam.ierymenko@zerotier.com> Mon, 07 Mar 2022 01:00:00 -0700
|
||||
|
||||
zerotier-one (1.8.5) unstable; urgency=medium
|
||||
|
||||
* See RELEASE-NOTES.md for release notes.
|
||||
|
||||
-- Adam Ierymenko <adam.ierymenko@zerotier.com> Fri, 17 Dec 2021 01:00:00 -0700
|
||||
|
||||
zerotier-one (1.8.4) unstable; urgency=medium
|
||||
|
||||
* See RELEASE-NOTES.md for release notes.
|
||||
|
||||
-- Adam Ierymenko <adam.ierymenko@zerotier.com> Mon, 23 Nov 2021 01:00:00 -0700
|
||||
|
||||
zerotier-one (1.8.3) unstable; urgency=medium
|
||||
|
||||
* See RELEASE-NOTES.md for release notes.
|
||||
|
||||
-- Adam Ierymenko <adam.ierymenko@zerotier.com> Mon, 15 Nov 2021 01:00:00 -0700
|
||||
|
||||
zerotier-one (1.8.2) unstable; urgency=medium
|
||||
|
||||
* See RELEASE-NOTES.md for release notes.
|
||||
|
||||
-- Adam Ierymenko <adam.ierymenko@zerotier.com> Mon, 08 Nov 2021 01:00:00 -0700
|
||||
|
||||
zerotier-one (1.8.1) unstable; urgency=medium
|
||||
|
||||
* See RELEASE-NOTES.md for release notes.
|
||||
|
||||
-- Adam Ierymenko <adam.ierymenko@zerotier.com> Wed, 20 Oct 2021 01:00:00 -0700
|
||||
|
||||
zerotier-one (1.8.0) unstable; urgency=medium
|
||||
|
||||
* See RELEASE-NOTES.md for release notes.
|
||||
|
||||
-- Adam Ierymenko <adam.ierymenko@zerotier.com> Wed, 15 Sep 2021 01:00:00 -0700
|
||||
|
||||
zerotier-one (1.6.6) unstable; urgency=medium
|
||||
|
||||
* Backport endpoint mitigation against address collision attack.
|
||||
|
||||
-- Adam Ierymenko <adam.ierymenko@zerotier.com> Tue, 21 Sep 2021 01:00:00 -0700
|
||||
|
||||
zerotier-one (1.6.5) unstable; urgency=medium
|
||||
|
||||
* Fix path filtering bug that could cause "software laser" effect.
|
||||
* Fix printf overflow in CLI (not exploitable or security related)
|
||||
* Fix Windows device enumeration issue.
|
||||
|
||||
-- Adam Ierymenko <adam.ierymenko@zerotier.com> Tue, 13 Apr 2021 01:00:00 -0700
|
||||
|
||||
zerotier-one (1.6.4) unstable; urgency=medium
|
||||
|
||||
* REALLY fix a problem causing nodes to go into a "coma" with some network configurations.
|
||||
|
|
2
debian/compat
vendored
2
debian/compat
vendored
|
@ -1 +1 @@
|
|||
8
|
||||
10
|
4
debian/control
vendored
4
debian/control
vendored
|
@ -3,14 +3,14 @@ Maintainer: Adam Ierymenko <adam.ierymenko@zerotier.com>
|
|||
Section: net
|
||||
Priority: optional
|
||||
Standards-Version: 3.9.6
|
||||
Build-Depends: debhelper (>= 9)
|
||||
Build-Depends: debhelper
|
||||
Vcs-Git: git://github.com/zerotier/ZeroTierOne
|
||||
Vcs-Browser: https://github.com/zerotier/ZeroTierOne
|
||||
Homepage: https://www.zerotier.com/
|
||||
|
||||
Package: zerotier-one
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, iproute2, adduser, libstdc++6
|
||||
Depends: adduser, libstdc++6 (>= 5), openssl
|
||||
Homepage: https://www.zerotier.com/
|
||||
Description: ZeroTier network virtualization service
|
||||
ZeroTier One lets you join ZeroTier virtual networks and
|
||||
|
|
2
debian/control.wheezy
vendored
2
debian/control.wheezy
vendored
|
@ -10,7 +10,7 @@ Homepage: https://www.zerotier.com/
|
|||
|
||||
Package: zerotier-one
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, iproute, libstdc++6
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, libstdc++6
|
||||
Homepage: https://www.zerotier.com/
|
||||
Description: ZeroTier network virtualization service
|
||||
ZeroTier One lets you join ZeroTier virtual networks and
|
||||
|
|
2
debian/copyright
vendored
2
debian/copyright
vendored
|
@ -12,7 +12,7 @@ License: ZeroTier BSL 1.1
|
|||
Use of this software is governed by the Business Source License included
|
||||
in the LICENSE.TXT file in the project's root directory.
|
||||
|
||||
Change Date: 2025-01-01
|
||||
Change Date: 2026-01-01
|
||||
|
||||
On the date above, in accordance with the Business Source License, use
|
||||
of this software will be governed by version 2.0 of the Apache License.
|
||||
|
|
2
debian/postinst
vendored
2
debian/postinst
vendored
|
@ -3,7 +3,7 @@
|
|||
case "$1" in
|
||||
configure)
|
||||
if ! id zerotier-one >>/dev/null 2>&1; then
|
||||
useradd --system --user-group --home-dir /var/lib/zerotier-one --no-create-home zerotier-one
|
||||
useradd --system --user-group --home-dir /var/lib/zerotier-one --shell /usr/sbin/nologin --no-create-home zerotier-one
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
|
2
debian/rules
vendored
Executable file → Normal file
2
debian/rules
vendored
Executable file → Normal file
|
@ -7,7 +7,7 @@ CXXFLAGS=-O3 -fstack-protector-strong
|
|||
dh $@ --with systemd
|
||||
|
||||
override_dh_auto_build:
|
||||
make -j
|
||||
make
|
||||
|
||||
override_dh_systemd_start:
|
||||
dh_systemd_start --restart-after-upgrade
|
||||
|
|
0
debian/rules.wheezy
vendored
Executable file → Normal file
0
debian/rules.wheezy
vendored
Executable file → Normal file
2
debian/zerotier-one.service
vendored
2
debian/zerotier-one.service
vendored
|
@ -1,6 +1,6 @@
|
|||
[Unit]
|
||||
Description=ZeroTier One
|
||||
After=network-online.target
|
||||
After=network-online.target network.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
|
|
|
@ -3,4 +3,4 @@ Manual Pages and Other Documentation
|
|||
|
||||
Use "./build.sh" to build the manual pages.
|
||||
|
||||
You'll need either NodeJS/npm installed (script will then automatically install the npm *marked-man* package) or */usr/bin/ronn*. The latter is a Ruby program packaged on some distributions as *rubygem-ronn* or *ruby-ronn* or installable as *gem install ronn*. The Node *marked-man* package and *ronn* from rubygems are two roughly equivalent alternatives for compiling MarkDown into roff/man format.
|
||||
You'll need either Node.js/npm installed (script will then automatically install the npm *marked-man* package) or */usr/bin/ronn*. The latter is a Ruby program packaged on some distributions as *rubygem-ronn* or *ruby-ronn* or installable as *gem install ronn*. The Node *marked-man* package and *ronn* from RubyGems are two roughly equivalent alternatives for compiling Markdown into roff/man format.
|
||||
|
|
|
@ -81,7 +81,7 @@ These are found in the service's working directory.
|
|||
If the ZeroTier One service is built with the network controller enabled, it periodically backs up its controller.db database in this file (currently every 5 minutes if there have been changes). Since this file is not a currently in use SQLite3 database it's safer to back up without corruption. On new backups the file is rotated out rather than being rewritten in place.
|
||||
|
||||
* `iddb.d/` (directory):
|
||||
Caches the public identity of every peer ZeroTier has spoken with in the last 60 days. This directory and its contents can be deleted, but this may result in slower connection initations since it will require that we go out and re-fetch full identities for peers we're speaking to.
|
||||
Caches the public identity of every peer ZeroTier has spoken with in the last 60 days. This directory and its contents can be deleted, but this may result in slower connection initiations since it will require that we go out and re-fetch full identities for peers we're speaking to.
|
||||
|
||||
* `networks.d` (directory):
|
||||
This caches network configurations and certificate information for networks you belong to. ZeroTier scans this directory for <network ID>.conf files on startup to recall its networks, so "touch"ing an empty <network ID>.conf file in this directory is a way of pre-configuring ZeroTier to join a specific network on startup without using the API. If the config file is empty ZeroTIer will just fetch it from the network's controller.
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
FROM alpine:3.11.3
|
||||
|
||||
ARG go_pkg_url
|
||||
|
||||
RUN apk add --update alpine-sdk linux-headers cmake openssh curl
|
||||
|
||||
|
||||
RUN adduser -D -s /bin/ash jenkins && \
|
||||
passwd -u jenkins && \
|
||||
ssh-keygen -A && \
|
||||
mkdir /home/jenkins/.ssh && \
|
||||
chown -R jenkins:jenkins /home/jenkins
|
||||
|
||||
RUN curl -s $go_pkg_url -o go.tar.gz && \
|
||||
tar -C /usr/local -xzf go.tar.gz
|
||||
|
||||
COPY authorized_keys /home/jenkins/.ssh/authorized_keys
|
||||
RUN chown -R jenkins:jenkins /home/jenkins/.ssh && \
|
||||
chmod 600 /home/jenkins/.ssh/authorized_keys
|
||||
|
||||
EXPOSE 22
|
||||
CMD ["/usr/sbin/sshd", "-D"]
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
FROM centos:6
|
||||
|
||||
ARG go_pkg_url
|
||||
|
||||
RUN yum update -y
|
||||
RUN yum install -y curl git wget openssh-server sudo make rpmdevtools && yum clean all
|
||||
|
||||
RUN curl -s $go_pkg_url -o go.tar.gz && \
|
||||
tar -C /usr/local -xzf go.tar.gz && \
|
||||
rm go.tar.gz
|
||||
|
||||
RUN groupadd -g 1000 jenkins-build && useradd -u 1000 -g 1000 jenkins-build
|
||||
|
||||
RUN echo $'\n\
|
||||
export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin\n'\
|
||||
>> ~/.bash_profile
|
||||
|
||||
RUN mkdir /rpmbuild && chmod 777 /rpmbuild
|
||||
|
||||
CMD ["/usr/sbin/sshd", "-D"]
|
|
@ -1,21 +0,0 @@
|
|||
FROM i386/centos:6
|
||||
|
||||
ARG go_pkg_url
|
||||
|
||||
RUN echo i386 > /etc/yum/vars/basearch && echo i686 > /etc/yum/vars/arch
|
||||
|
||||
RUN yum install -y curl git wget openssh-server sudo make rpmdevtools && yum clean all
|
||||
|
||||
RUN curl -s $go_pkg_url -o go.tar.gz && \
|
||||
tar -C /usr/local -xzf go.tar.gz && \
|
||||
rm go.tar.gz
|
||||
|
||||
RUN groupadd -g 1000 jenkins-build && useradd -u 1000 -g 1000 jenkins-build
|
||||
|
||||
RUN echo $'\n\
|
||||
export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin\n'\
|
||||
>> ~/.bash_profile
|
||||
|
||||
RUN mkdir /rpmbuild && chmod 777 /rpmbuild
|
||||
|
||||
CMD ["/usr/sbin/sshd", "-D"]
|
|
@ -1,25 +0,0 @@
|
|||
FROM centos:7
|
||||
|
||||
ARG go_pkg_url
|
||||
|
||||
RUN yum install -y epel-release
|
||||
RUN yum install -y curl git wget openssh-server sudo make development-tools rpmdevtools clang gcc-c++ ruby ruby-devel centos-release-scl devtoolset-8 llvm-toolset-7 && yum clean all
|
||||
|
||||
RUN curl -s $go_pkg_url -o go.tar.gz && \
|
||||
tar -C /usr/local -xzf go.tar.gz && \
|
||||
rm go.tar.gz
|
||||
|
||||
RUN wget -qO- "https://cmake.org/files/v3.15/cmake-3.15.1-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C /usr/local
|
||||
|
||||
RUN /usr/bin/ssh-keygen -A
|
||||
RUN useradd jenkins-build
|
||||
|
||||
RUN echo $'\n\
|
||||
export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin\n\
|
||||
source scl_source enable devtoolset-8 llvm-toolset-7\n'\
|
||||
>> ~/.bash_profile
|
||||
|
||||
RUN mkdir /rpmbuild && chmod 777 /rpmbuild
|
||||
|
||||
CMD ["/usr/sbin/sshd", "-D"]
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
FROM centos:7
|
||||
|
||||
ARG go_pkg_url
|
||||
|
||||
RUN yum install -y curl git wget openssh-server sudo make development-tools rpmdevtools clang gcc-c++ ruby ruby-devel && yum clean all
|
||||
|
||||
RUN curl -s $go_pkg_url -o go.tar.gz && \
|
||||
tar -C /usr/local -xzf go.tar.gz && \
|
||||
rm go.tar.gz
|
||||
|
||||
RUN /usr/bin/ssh-keygen -A
|
||||
|
||||
RUN useradd jenkins-build
|
||||
|
||||
RUN echo $'\n\
|
||||
export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin\n'\
|
||||
>> ~/.bash_profile
|
||||
|
||||
RUN mkdir /rpmbuild && chmod 777 /rpmbuild
|
||||
|
||||
CMD ["/usr/sbin/sshd", "-D"]
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
FROM centos:8
|
||||
|
||||
ARG go_pkg_url
|
||||
|
||||
RUN yum install -y epel-release
|
||||
RUN yum install -y curl git wget openssh-server sudo make rpmdevtools clang gcc-c++ ruby ruby-devel && yum clean all
|
||||
|
||||
RUN curl -s $go_pkg_url -o go.tar.gz && \
|
||||
tar -C /usr/local -xzf go.tar.gz && \
|
||||
rm go.tar.gz
|
||||
|
||||
RUN wget -qO- "https://cmake.org/files/v3.15/cmake-3.15.1-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C /usr/local
|
||||
|
||||
RUN /usr/bin/ssh-keygen -A
|
||||
RUN useradd jenkins-build
|
||||
|
||||
RUN echo $'\n\
|
||||
export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin\n\
|
||||
source scl_source enable devtoolset-8 llvm-toolset-7\n'\
|
||||
>> ~/.bash_profile
|
||||
|
||||
RUN mkdir /rpmbuild && chmod 777 /rpmbuild
|
||||
|
||||
CMD ["/usr/sbin/sshd", "-D"]
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
FROM s390x/clefos:7
|
||||
|
||||
ARG go_pkg_url
|
||||
|
||||
RUN yum install -y curl git wget openssh-server sudo make development-tools rpmdevtools clang gcc-c++ ruby ruby-devel && yum clean all
|
||||
|
||||
RUN curl -s $go_pkg_url -o go.tar.gz && \
|
||||
tar -C /usr/local -xzf go.tar.gz && \
|
||||
rm go.tar.gz
|
||||
|
||||
RUN /usr/bin/ssh-keygen -A
|
||||
|
||||
RUN echo $'\n\
|
||||
export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin\n'\
|
||||
>> ~/.bash_profile
|
||||
|
||||
RUN mkdir /rpmbuild && chmod 777 /rpmbuild
|
||||
|
||||
CMD ["/usr/sbin/sshd", "-D"]
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
FROM debian:bullseye-20191224
|
||||
|
||||
ARG go_pkg_url
|
||||
|
||||
RUN apt-get update && apt-get upgrade -y && apt-get -y install build-essential curl ca-certificates devscripts dh-systemd
|
||||
|
||||
RUN curl -s -k $go_pkg_url -o go.tar.gz && \
|
||||
tar -C /usr/local -xzf go.tar.gz && \
|
||||
rm go.tar.gz
|
||||
|
||||
RUN groupadd -g 1000 jenkins-build && useradd -u 1000 -g 1000 jenkins-build
|
||||
RUN chmod 777 /home
|
||||
|
||||
CMD ["/usr/bin/sshd", "-D"]
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
FROM debian:buster-20191224
|
||||
|
||||
ARG go_pkg_url
|
||||
|
||||
RUN apt-get update && apt-get -y install build-essential curl ca-certificates devscripts dh-systemd
|
||||
|
||||
RUN curl -s -k $go_pkg_url -o go.tar.gz && \
|
||||
tar -C /usr/local -xzf go.tar.gz && \
|
||||
rm go.tar.gz
|
||||
|
||||
RUN groupadd -g 1000 jenkins-build && useradd -u 1000 -g 1000 jenkins-build
|
||||
RUN chmod 777 /home
|
||||
|
||||
CMD ["/usr/bin/sshd", "-D"]
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
FROM debian:jessie-20191224
|
||||
|
||||
ARG go_pkg_url
|
||||
|
||||
RUN apt-get update && apt-get -y install build-essential curl ca-certificates devscripts dh-systemd
|
||||
|
||||
RUN curl -s -k $go_pkg_url -o go.tar.gz && \
|
||||
tar -C /usr/local -xzf go.tar.gz && \
|
||||
rm go.tar.gz
|
||||
|
||||
RUN groupadd -g 1000 jenkins-build && useradd -u 1000 -g 1000 jenkins-build
|
||||
RUN chmod 777 /home
|
||||
|
||||
CMD ["/usr/bin/sshd", "-D"]
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
FROM debian:sid-20191224
|
||||
|
||||
ARG go_pkg_url
|
||||
|
||||
RUN apt-get update && apt-get upgrade -y && apt-get -y install build-essential curl ca-certificates devscripts dh-systemd
|
||||
|
||||
RUN curl -s -k $go_pkg_url -o go.tar.gz && \
|
||||
tar -C /usr/local -xzf go.tar.gz && \
|
||||
rm go.tar.gz
|
||||
|
||||
RUN groupadd -g 1000 jenkins-build && useradd -u 1000 -g 1000 jenkins-build
|
||||
RUN chmod 777 /home
|
||||
|
||||
CMD ["/usr/bin/sshd", "-D"]
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
FROM debian:stretch-20191224
|
||||
|
||||
ARG go_pkg_url
|
||||
|
||||
RUN apt-get update && apt-get -y install build-essential curl ca-certificates devscripts dh-systemd
|
||||
|
||||
RUN curl -s -k $go_pkg_url -o go.tar.gz && \
|
||||
tar -C /usr/local -xzf go.tar.gz && \
|
||||
rm go.tar.gz
|
||||
|
||||
RUN groupadd -g 1000 jenkins-build && useradd -u 1000 -g 1000 jenkins-build
|
||||
RUN chmod 777 /home
|
||||
|
||||
CMD ["/usr/bin/sshd", "-D"]
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
FROM debian:wheezy-20190228
|
||||
|
||||
ARG go_pkg_url
|
||||
|
||||
RUN echo "deb http://archive.debian.org/debian/ wheezy contrib main non-free" > /etc/apt/sources.list && \
|
||||
echo "deb-src http://archive.debian.org/debian/ wheezy contrib main non-free" >> /etc/apt/sources.list && \
|
||||
apt-get update && apt-get install -y apt-utils && \
|
||||
apt-get install -y --force-yes \
|
||||
curl gcc make sudo expect gnupg fakeroot perl-base=5.14.2-21+deb7u3 perl \
|
||||
libc-bin=2.13-38+deb7u10 libc6=2.13-38+deb7u10 libc6-dev build-essential \
|
||||
cdbs devscripts equivs automake autoconf libtool libaudit-dev selinux-basics \
|
||||
libdb5.1=5.1.29-5 libdb5.1-dev libssl1.0.0=1.0.1e-2+deb7u20 procps gawk libsigsegv2 \
|
||||
curl ca-certificates devscripts
|
||||
|
||||
RUN curl -s -k $go_pkg_url -o go.tar.gz && \
|
||||
tar -C /usr/local -xzf go.tar.gz && \
|
||||
rm go.tar.gz
|
||||
|
||||
RUN groupadd -g 1000 jenkins-build && useradd -u 1000 -g 1000 jenkins-build
|
||||
RUN chmod 777 /home
|
||||
|
||||
CMD ["/usr/bin/sshd", "-D"]
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
FROM kalilinux/kali-rolling:latest
|
||||
|
||||
ARG go_pkg_url
|
||||
|
||||
RUN apt-get update && apt-get upgrade -y && apt-get -y install build-essential curl ca-certificates devscripts dh-systemd cmake
|
||||
|
||||
RUN curl -s -k $go_pkg_url -o go.tar.gz && \
|
||||
tar -C /usr/local -xzf go.tar.gz && \
|
||||
rm go.tar.gz
|
||||
|
||||
RUN groupadd -g 1000 jenkins-build && useradd -u 1000 -g 1000 jenkins-build
|
||||
RUN chmod 777 /home
|
||||
|
||||
CMD ["/usr/bin/sshd", "-D"]
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
FROM ubuntu:bionic-20200112
|
||||
|
||||
ARG go_pkg_url
|
||||
|
||||
RUN apt-get update && apt-get upgrade -y && apt-get -y install build-essential curl ca-certificates devscripts dh-systemd
|
||||
|
||||
RUN curl -s -k $go_pkg_url -o go.tar.gz && \
|
||||
tar -C /usr/local -xzf go.tar.gz && \
|
||||
rm go.tar.gz
|
||||
|
||||
RUN groupadd -g 1000 jenkins-build && useradd -u 1000 -g 1000 jenkins-build
|
||||
RUN chmod 777 /home
|
||||
|
||||
CMD ["/usr/bin/sshd", "-D"]
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
FROM ubuntu:eoan-20200114
|
||||
|
||||
ARG go_pkg_url
|
||||
|
||||
RUN apt-get update && apt-get upgrade -y && apt-get -y install build-essential curl ca-certificates devscripts dh-systemd
|
||||
|
||||
RUN curl -s -k $go_pkg_url -o go.tar.gz && \
|
||||
tar -C /usr/local -xzf go.tar.gz && \
|
||||
rm go.tar.gz
|
||||
|
||||
RUN groupadd -g 1000 jenkins-build && useradd -u 1000 -g 1000 jenkins-build
|
||||
RUN chmod 777 /home
|
||||
|
||||
CMD ["/usr/bin/sshd", "-D"]
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
FROM ubuntu:trusty-20191217
|
||||
|
||||
ARG go_pkg_url
|
||||
|
||||
RUN apt-get update && apt-get upgrade -y && apt-get -y install build-essential curl ca-certificates devscripts dh-systemd
|
||||
|
||||
RUN curl -s -k $go_pkg_url -o go.tar.gz && \
|
||||
tar -C /usr/local -xzf go.tar.gz && \
|
||||
rm go.tar.gz
|
||||
|
||||
RUN groupadd -g 1000 jenkins-build && useradd -u 1000 -g 1000 jenkins-build
|
||||
RUN chmod 777 /home
|
||||
|
||||
CMD ["/usr/bin/sshd", "-D"]
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
FROM ubuntu:xenial-20200114
|
||||
|
||||
ARG go_pkg_url
|
||||
|
||||
RUN apt-get update && apt-get -y install build-essential curl ca-certificates devscripts dh-systemd
|
||||
|
||||
RUN curl -s -k $go_pkg_url -o go.tar.gz && \
|
||||
tar -C /usr/local -xzf go.tar.gz && \
|
||||
rm go.tar.gz
|
||||
|
||||
RUN groupadd -g 1000 jenkins-build && useradd -u 1000 -g 1000 jenkins-build
|
||||
RUN chmod 777 /home
|
||||
|
||||
CMD ["/usr/bin/sshd", "-D"]
|
||||
|
|
@ -1,108 +0,0 @@
|
|||
.PHONY: all
|
||||
|
||||
all: alpine centos debian ubuntu kali-rolling
|
||||
|
||||
alpine:
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-arm64.tar.gz" --platform linux/arm64 -f Dockerfile.alpine . -t ztbuild/alpine-arm64 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-386.tar.gz" --platform linux/386 -f Dockerfile.alpine . -t ztbuild/alpine-i386 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-amd64.tar.gz" --platform linux/amd64 -f Dockerfile.alpine . -t ztbuild/alpine-amd64 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-armv6l.tar.gz" --platform linux/arm/v6 -f Dockerfile.alpine . -t ztbuild/alpine-armel --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-armv6l.tar.gz" --platform linux/arm/v7 -f Dockerfile.alpine . -t ztbuild/alpine-armhf --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-ppc64le.tar.gz" --platform linux/ppc64le -f Dockerfile.alpine . -t ztbuild/alpine-ppc64le --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-s390x.tar.gz" --platform linux/s390x -f Dockerfile.alpine . -t ztbuild/alpine-s390x --load
|
||||
|
||||
centos:
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-amd64.tar.gz" --platform linux/amd64 -f Dockerfile.centos7 . -t ztbuild/centos7-amd64 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-386.tar.gz" --platform linux/386 -f Dockerfile.centos7-i386 . -t ztbuild/centos7-i386 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-amd64.tar.gz" --platform linux/amd64 -f Dockerfile.centos6 . -t ztbuild/centos6-amd64 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-386.tar.gz" --platform linux/386 -f Dockerfile.centos6-i386 . -t ztbuild/centos6-i386 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-amd64.tar.gz" --platform linux/amd64 -f Dockerfile.centos8 . -t ztbuild/centos8-amd64 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-arm64.tar.gz" --platform linux/arm64 -f Dockerfile.centos8 . -t ztbuild/centos8-arm64 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-ppc64le.tar.gz" --platform linux/ppc64le -f Dockerfile.centos8 . -t ztbuild/centos8-ppc64le --load
|
||||
|
||||
debian: debian-wheezy debian-jessie debian-buster debian-stretch debian-bullseye debian-sid
|
||||
|
||||
debian-wheezy:
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-amd64.tar.gz" --platform linux/amd64 -f Dockerfile.debian-wheezy . -t ztbuild/debian-wheezy-amd64 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-armv6l.tar.gz" --platform linux/arm/v7 -f Dockerfile.debian-wheezy . -t ztbuild/debian-wheezy-armhf --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-armv6l.tar.gz" --platform linux/arm/v6 -f Dockerfile.debian-wheezy . -t ztbuild/debian-wheezy-armel --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-386.tar.gz" --platform linux/386 -f Dockerfile.debian-wheezy . -t ztbuild/debian-wheezy-i386 --load
|
||||
|
||||
debian-jessie:
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-amd64.tar.gz" --platform linux/amd64 -f Dockerfile.debian-jessie . -t ztbuild/debian-jessie-amd64 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-armv6l.tar.gz" --platform linux/arm/v7 -f Dockerfile.debian-jessie . -t ztbuild/debian-jessie-armhf --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-armv6l.tar.gz" --platform linux/arm/v6 -f Dockerfile.debian-jessie . -t ztbuild/debian-jessie-armel --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-386.tar.gz" --platform linux/386 -f Dockerfile.debian-jessie . -t ztbuild/debian-jessie-i386 --load
|
||||
|
||||
debian-buster:
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-amd64.tar.gz" --platform linux/amd64 -f Dockerfile.debian-buster . -t ztbuild/debian-buster-amd64 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-arm64.tar.gz" --platform linux/arm64 -f Dockerfile.debian-buster . -t ztbuild/debian-buster-arm64 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-armv6l.tar.gz" --platform linux/arm/v6 -f Dockerfile.debian-buster . -t ztbuild/debian-buster-armel --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-armv6l.tar.gz" --platform linux/arm/v7 -f Dockerfile.debian-buster . -t ztbuild/debian-buster-armhf --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-386.tar.gz" --platform linux/386 -f Dockerfile.debian-buster . -t ztbuild/debian-buster-i386 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-ppc64le.tar.gz" --platform linux/ppc64le -f Dockerfile.debian-buster . -t ztbuild/debian-buster-ppc64le --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-s390x.tar.gz" --platform linux/s390x -f Dockerfile.debian-buster . -t ztbuild/debian-buster-s390x --load
|
||||
|
||||
debian-stretch:
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-amd64.tar.gz" --platform linux/amd64 -f Dockerfile.debian-stretch . -t ztbuild/debian-stretch-amd64 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-arm64.tar.gz" --platform linux/arm64 -f Dockerfile.debian-stretch . -t ztbuild/debian-stretch-arm64 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-armv6l.tar.gz" --platform linux/arm/v6 -f Dockerfile.debian-stretch . -t ztbuild/debian-stretch-armel --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-armv6l.tar.gz" --platform linux/arm/v7 -f Dockerfile.debian-stretch . -t ztbuild/debian-stretch-armhf --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-386.tar.gz" --platform linux/386 -f Dockerfile.debian-stretch . -t ztbuild/debian-stretch-i386 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-ppc64le.tar.gz" --platform linux/ppc64le -f Dockerfile.debian-stretch . -t ztbuild/debian-stretch-ppc64le --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-s390x.tar.gz" --platform linux/s390x -f Dockerfile.debian-stretch . -t ztbuild/debian-stretch-s390x --load
|
||||
|
||||
debian-bullseye:
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-amd64.tar.gz" --platform linux/amd64 -f Dockerfile.debian-bullseye . -t ztbuild/debian-bullseye-amd64 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-arm64.tar.gz" --platform linux/arm64 -f Dockerfile.debian-bullseye . -t ztbuild/debian-bullseye-arm64 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-armv6l.tar.gz" --platform linux/arm/v6 -f Dockerfile.debian-bullseye . -t ztbuild/debian-bullseye-armel --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-armv6l.tar.gz" --platform linux/arm/v7 -f Dockerfile.debian-bullseye . -t ztbuild/debian-bullseye-armhf --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-386.tar.gz" --platform linux/386 -f Dockerfile.debian-bullseye . -t ztbuild/debian-bullseye-i386 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-ppc64le.tar.gz" --platform linux/ppc64le -f Dockerfile.debian-bullseye . -t ztbuild/debian-bullseye-ppc64le --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-s390x.tar.gz" --platform linux/s390x -f Dockerfile.debian-bullseye . -t ztbuild/debian-bullseye-s390x --load
|
||||
|
||||
debian-sid:
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-amd64.tar.gz" --platform linux/amd64 -f Dockerfile.debian-sid . -t ztbuild/debian-sid-amd64 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-arm64.tar.gz" --platform linux/arm64 -f Dockerfile.debian-sid . -t ztbuild/debian-sid-arm64 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-armv6l.tar.gz" --platform linux/arm/v6 -f Dockerfile.debian-sid . -t ztbuild/debian-sid-armel --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-armv6l.tar.gz" --platform linux/arm/v7 -f Dockerfile.debian-sid . -t ztbuild/debian-sid-armhf --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-386.tar.gz" --platform linux/386 -f Dockerfile.debian-sid . -t ztbuild/debian-sid-i386 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-ppc64le.tar.gz" --platform linux/ppc64le -f Dockerfile.debian-sid . -t ztbuild/debian-sid-ppc64le --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-s390x.tar.gz" --platform linux/s390x -f Dockerfile.debian-sid . -t ztbuild/debian-sid-s390x --load
|
||||
|
||||
ubuntu: ubuntu-trusty ubuntu-xenial ubuntu-bionic ubuntu-eoan
|
||||
|
||||
ubuntu-trusty:
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-amd64.tar.gz" --platform linux/amd64 -f Dockerfile.ubuntu-trusty . -t ztbuild/ubuntu-trusty-amd64 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-arm64.tar.gz" --platform linux/arm64 -f Dockerfile.ubuntu-trusty . -t ztbuild/ubuntu-trusty-arm64 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-armv6l.tar.gz" --platform linux/arm/v7 -f Dockerfile.ubuntu-trusty . -t ztbuild/ubuntu-trusty-armhf --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-386.tar.gz" --platform linux/386 -f Dockerfile.ubuntu-trusty . -t ztbuild/ubuntu-trusty-i386 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-ppc64le.tar.gz" --platform linux/ppc64le -f Dockerfile.ubuntu-trusty . -t ztbuild/ubuntu-trusty-ppc64le --load
|
||||
|
||||
ubuntu-xenial:
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-amd64.tar.gz" --platform linux/amd64 -f Dockerfile.ubuntu-xenial . -t ztbuild/ubuntu-xenial-amd64 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-arm64.tar.gz" --platform linux/arm64 -f Dockerfile.ubuntu-xenial . -t ztbuild/ubuntu-xenial-arm64 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-armv6l.tar.gz" --platform linux/arm/v7 -f Dockerfile.ubuntu-xenial . -t ztbuild/ubuntu-xenial-armhf --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-386.tar.gz" --platform linux/386 -f Dockerfile.ubuntu-xenial . -t ztbuild/ubuntu-xenial-i386 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-ppc64le.tar.gz" --platform linux/ppc64le -f Dockerfile.ubuntu-xenial . -t ztbuild/ubuntu-xenial-ppc64le --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-s390x.tar.gz" --platform linux/s390x -f Dockerfile.ubuntu-xenial . -t ztbuild/ubuntu-xenial-s390x --load
|
||||
|
||||
ubuntu-bionic:
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-amd64.tar.gz" --platform linux/amd64 -f Dockerfile.ubuntu-bionic . -t ztbuild/ubuntu-bionic-amd64 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-arm64.tar.gz" --platform linux/arm64 -f Dockerfile.ubuntu-bionic . -t ztbuild/ubuntu-bionic-arm64 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-armv6l.tar.gz" --platform linux/arm/v7 -f Dockerfile.ubuntu-bionic . -t ztbuild/ubuntu-bionic-armhf --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-386.tar.gz" --platform linux/386 -f Dockerfile.ubuntu-bionic . -t ztbuild/ubuntu-bionic-i386 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-ppc64le.tar.gz" --platform linux/ppc64le -f Dockerfile.ubuntu-bionic . -t ztbuild/ubuntu-bionic-ppc64le --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-s390x.tar.gz" --platform linux/s390x -f Dockerfile.ubuntu-bionic . -t ztbuild/ubuntu-bionic-s390x --load
|
||||
|
||||
ubuntu-eoan:
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-amd64.tar.gz" --platform linux/amd64 -f Dockerfile.ubuntu-eoan . -t ztbuild/ubuntu-eoan-amd64 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-arm64.tar.gz" --platform linux/arm64 -f Dockerfile.ubuntu-eoan . -t ztbuild/ubuntu-eoan-arm64 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-armv6l.tar.gz" --platform linux/arm/v7 -f Dockerfile.ubuntu-eoan . -t ztbuild/ubuntu-eoan-armhf --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-386.tar.gz" --platform linux/386 -f Dockerfile.ubuntu-eoan . -t ztbuild/ubuntu-eoan-i386 --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-ppc64le.tar.gz" --platform linux/ppc64le -f Dockerfile.ubuntu-eoan . -t ztbuild/ubuntu-eoan-ppc64le --load
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-s390x.tar.gz" --platform linux/s390x -f Dockerfile.ubuntu-eoan . -t ztbuild/ubuntu-eoan-s390x --load
|
||||
|
||||
kali-rolling:
|
||||
@docker buildx build --build-arg go_pkg_url="https://dl.google.com/go/go1.13.6.linux-amd64.tar.gz" --platform linux/amd64 -f Dockerfile.kali-rolling . -t ztbuild/kali-rolling-amd64 --load
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8hgysbj2Luu3aN/Ya2wr4Y9LpUGqWWfn3k+UhIwOIE/Kd7/YpLjxHpseUA1hLnj9kHFShH8eiqoY0S6EDIYrTUwbXMMu8454lX/LcJOCJ9RlSeMMf7vpkxcI7cVRgOA430a3FR7M0Q8vKlyJzxxAEjMIxMyuVyinknfanNt+sQFiDUvOXoacqgZAHBWMlO7wOPyHWHNOzy7g8N0dHiJveKZqX/UUwuqJuS6UBq7MBMSU6TcMvJwHr+AbNvfyIUWCqlTByqFL9cmviRbIvQanxoRxi/5fVUGhtVBXUYvbCdFxDw5W2Svo9fDMm4Z5xWAD7rY1J3AM15RVyRTTtYvgD
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
# curl (REST API)
|
||||
# User
|
||||
JENKINS_USER=grant
|
||||
|
||||
# Api key from "/me/configure" on my Jenkins instance
|
||||
JENKINS_USER_KEY=11edf2d49321321119712c46c6349eaad7
|
||||
|
||||
# Url for my local Jenkins instance.
|
||||
JENKINS_URL=http://$JENKINS_USER:$JENKINS_USER_KEY@jenkins.int.zerotier.com
|
||||
|
||||
# JENKINS_CRUMB is needed if your Jenkins master has CRSF protection enabled (which it should)
|
||||
JENKINS_CRUMB=`curl "$JENKINS_URL/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,\":\",//crumb)"`
|
||||
curl -X POST -H $JENKINS_CRUMB -F "jenkinsfile=<Jenkinsfile" $JENKINS_URL/pipeline-model-converter/validate
|
130
entrypoint.sh.release
Normal file
130
entrypoint.sh.release
Normal file
|
@ -0,0 +1,130 @@
|
|||
#!/bin/sh
|
||||
|
||||
grepzt() {
|
||||
[ -f /var/lib/zerotier-one/zerotier-one.pid -a -n "$(cat /var/lib/zerotier-one/zerotier-one.pid 2>/dev/null)" -a -d "/proc/$(cat /var/lib/zerotier-one/zerotier-one.pid 2>/dev/null)" ]
|
||||
return $?
|
||||
}
|
||||
|
||||
mkztfile() {
|
||||
file=$1
|
||||
mode=$2
|
||||
content=$3
|
||||
echo "creating $file"
|
||||
mkdir -p /var/lib/zerotier-one
|
||||
echo -n "$content" > "/var/lib/zerotier-one/$file"
|
||||
chmod "$mode" "/var/lib/zerotier-one/$file"
|
||||
}
|
||||
|
||||
if [ "x$ZEROTIER_API_SECRET" != "x" ]
|
||||
then
|
||||
mkztfile authtoken.secret 0600 "$ZEROTIER_API_SECRET"
|
||||
mkztfile metricstoken.secret 0600 "$ZEROTIER_API_SECRET"
|
||||
fi
|
||||
|
||||
if [ "x$ZEROTIER_IDENTITY_PUBLIC" != "x" ]
|
||||
then
|
||||
mkztfile identity.public 0644 "$ZEROTIER_IDENTITY_PUBLIC"
|
||||
fi
|
||||
|
||||
if [ "x$ZEROTIER_IDENTITY_SECRET" != "x" ]
|
||||
then
|
||||
mkztfile identity.secret 0600 "$ZEROTIER_IDENTITY_SECRET"
|
||||
fi
|
||||
|
||||
if [ "x$ZEROTIER_LOCAL_CONF" != "x" ]
|
||||
then
|
||||
mkztfile local.conf 0644 "$ZEROTIER_LOCAL_CONF"
|
||||
fi
|
||||
|
||||
mkztfile zerotier-one.port 0600 "9993"
|
||||
|
||||
killzerotier() {
|
||||
log "Killing zerotier"
|
||||
kill $(cat /var/lib/zerotier-one/zerotier-one.pid 2>/dev/null)
|
||||
exit 0
|
||||
}
|
||||
|
||||
log_header() {
|
||||
echo -n "\r=>"
|
||||
}
|
||||
|
||||
log_detail_header() {
|
||||
echo -n "\r===>"
|
||||
}
|
||||
|
||||
log() {
|
||||
echo "$(log_header)" "$@"
|
||||
}
|
||||
|
||||
log_params() {
|
||||
title=$1
|
||||
shift
|
||||
log "$title" "[$@]"
|
||||
}
|
||||
|
||||
log_detail() {
|
||||
echo "$(log_detail_header)" "$@"
|
||||
}
|
||||
|
||||
log_detail_params() {
|
||||
title=$1
|
||||
shift
|
||||
log_detail "$title" "[$@]"
|
||||
}
|
||||
|
||||
trap killzerotier INT TERM
|
||||
|
||||
log "Configuring networks to join"
|
||||
mkdir -p /var/lib/zerotier-one/networks.d
|
||||
|
||||
log_params "Joining networks from command line:" $@
|
||||
for i in "$@"
|
||||
do
|
||||
log_detail_params "Configuring join:" "$i"
|
||||
touch "/var/lib/zerotier-one/networks.d/${i}.conf"
|
||||
done
|
||||
|
||||
if [ "x$ZEROTIER_JOIN_NETWORKS" != "x" ]
|
||||
then
|
||||
log_params "Joining networks from environment:" $ZEROTIER_JOIN_NETWORKS
|
||||
for i in $ZEROTIER_JOIN_NETWORKS
|
||||
do
|
||||
log_detail_params "Configuring join:" "$i"
|
||||
touch "/var/lib/zerotier-one/networks.d/${i}.conf"
|
||||
done
|
||||
fi
|
||||
|
||||
log "Starting ZeroTier"
|
||||
nohup /usr/sbin/zerotier-one &
|
||||
|
||||
while ! grepzt
|
||||
do
|
||||
log_detail "ZeroTier hasn't started, waiting a second"
|
||||
|
||||
if [ -f nohup.out ]
|
||||
then
|
||||
tail -n 10 nohup.out
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
done
|
||||
|
||||
log_params "Writing healthcheck for networks:" $@
|
||||
|
||||
cat >/healthcheck.sh <<EOF
|
||||
#!/bin/bash
|
||||
for i in $@ $ZEROTIER_JOIN_NETWORKS
|
||||
do
|
||||
[ "\$(zerotier-cli get \$i status)" = "OK" ] || exit 1
|
||||
done
|
||||
EOF
|
||||
|
||||
chmod +x /healthcheck.sh
|
||||
|
||||
log_params "zerotier-cli info:" "$(zerotier-cli info)"
|
||||
|
||||
log "Sleeping infinitely"
|
||||
while true
|
||||
do
|
||||
sleep 1
|
||||
done
|
|
@ -1,36 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>tap</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.zerotier.tap</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>tap</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>KEXT</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>20150118</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>OSBundleLibraries</key>
|
||||
<dict>
|
||||
<key>com.apple.kpi.mach</key>
|
||||
<string>8.0</string>
|
||||
<key>com.apple.kpi.bsd</key>
|
||||
<string>8.0</string>
|
||||
<key>com.apple.kpi.libkern</key>
|
||||
<string>8.0</string>
|
||||
<key>com.apple.kpi.unsupported</key>
|
||||
<string>8.0</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
Binary file not shown.
|
@ -1,105 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>files</key>
|
||||
<dict/>
|
||||
<key>files2</key>
|
||||
<dict/>
|
||||
<key>rules</key>
|
||||
<dict>
|
||||
<key>^Resources/</key>
|
||||
<true/>
|
||||
<key>^Resources/.*\.lproj/</key>
|
||||
<dict>
|
||||
<key>optional</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1000</real>
|
||||
</dict>
|
||||
<key>^Resources/.*\.lproj/locversion.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1100</real>
|
||||
</dict>
|
||||
<key>^version.plist$</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>rules2</key>
|
||||
<dict>
|
||||
<key>.*\.dSYM($|/)</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>11</real>
|
||||
</dict>
|
||||
<key>^(.*/)?\.DS_Store$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>2000</real>
|
||||
</dict>
|
||||
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
|
||||
<dict>
|
||||
<key>nested</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>10</real>
|
||||
</dict>
|
||||
<key>^.*</key>
|
||||
<true/>
|
||||
<key>^Info\.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^PkgInfo$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^Resources/</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^Resources/.*\.lproj/</key>
|
||||
<dict>
|
||||
<key>optional</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1000</real>
|
||||
</dict>
|
||||
<key>^Resources/.*\.lproj/locversion.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1100</real>
|
||||
</dict>
|
||||
<key>^[^/]+$</key>
|
||||
<dict>
|
||||
<key>nested</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>10</real>
|
||||
</dict>
|
||||
<key>^embedded\.provisionprofile$</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^version\.plist$</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
BIN
ext/bin/tap-windows-ndis6/arm64/zttap300.cat
Normal file
BIN
ext/bin/tap-windows-ndis6/arm64/zttap300.cat
Normal file
Binary file not shown.
|
@ -1,10 +1,15 @@
|
|||
;
|
||||
; ****************************************************************************
|
||||
; * Copyright (C) 2002-2014 OpenVPN Technologies, Inc. *
|
||||
; * This program is free software; you can redistribute it and/or modify *
|
||||
; * it under the terms of the GNU General Public License version 2 *
|
||||
; * as published by the Free Software Foundation. *
|
||||
; ****************************************************************************
|
||||
;
|
||||
|
||||
;
|
||||
; ZeroTier One Virtual Network Port NDIS6 Driver
|
||||
;
|
||||
; Based on the OpenVPN tap-windows6 driver version 9.21.1 git
|
||||
; commit 48f027cfca52b16b5fd23d82e6016ed8a91fc4d3.
|
||||
; See: https://github.com/OpenVPN/tap-windows6
|
||||
;
|
||||
; Modified by ZeroTier, Inc. - https://www.zerotier.com/
|
||||
;
|
||||
; (1) Comment out 'tun' functionality and related features such as DHCP
|
||||
|
@ -15,14 +20,6 @@
|
|||
; (5) Rename/rebrand driver as ZeroTier network port driver.
|
||||
;
|
||||
; Original copyright below. Modifications released under GPLv2 as well.
|
||||
;
|
||||
; ****************************************************************************
|
||||
; * Copyright (C) 2002-2014 OpenVPN Technologies, Inc. *
|
||||
; * This program is free software; you can redistribute it and/or modify *
|
||||
; * it under the terms of the GNU General Public License version 2 *
|
||||
; * as published by the Free Software Foundation. *
|
||||
; ****************************************************************************
|
||||
;
|
||||
|
||||
[Version]
|
||||
Signature = "$Windows NT$"
|
||||
|
@ -30,17 +27,18 @@ CatalogFile = zttap300.cat
|
|||
ClassGUID = {4d36e972-e325-11ce-bfc1-08002be10318}
|
||||
Provider = %Provider%
|
||||
Class = Net
|
||||
DriverVer=08/13/2015,6.2.9200.20557
|
||||
DriverVer=11/24/2020,3.00.00.1
|
||||
|
||||
[Strings]
|
||||
DeviceDescription = "ZeroTier One Virtual Port"
|
||||
Provider = "ZeroTier Networks LLC" ; We're ZeroTier, Inc. now but kernel mode certs are $300+ so fuqdat.
|
||||
DeviceDescription = "ZeroTier Virtual Port"
|
||||
Provider = "ZeroTier"
|
||||
|
||||
; To build for x86, take NTamd64 off this and off the named section manually, build, then put it back!
|
||||
[Manufacturer]
|
||||
%Provider%=zttap300,NTx86
|
||||
%Provider%=zttap300,NTamd64
|
||||
%Provider%=zttap300,NTarm64
|
||||
|
||||
[zttap300]
|
||||
[zttap300.NTx86]
|
||||
%DeviceDescription% = zttap300.ndi, root\zttap300 ; Root enumerated
|
||||
%DeviceDescription% = zttap300.ndi, zttap300 ; Legacy
|
||||
|
||||
|
@ -48,6 +46,10 @@ Provider = "ZeroTier Networks LLC" ; We're ZeroTier, Inc. now but kernel mode ce
|
|||
%DeviceDescription% = zttap300.ndi, root\zttap300 ; Root enumerated
|
||||
%DeviceDescription% = zttap300.ndi, zttap300 ; Legacy
|
||||
|
||||
[zttap300.NTarm64]
|
||||
%DeviceDescription% = zttap300.ndi, root\zttap300 ; Root enumerated
|
||||
%DeviceDescription% = zttap300.ndi, zttap300 ; Legacy
|
||||
|
||||
;----------------- Characteristics ------------
|
||||
; NCF_PHYSICAL = 0x04
|
||||
; NCF_VIRTUAL = 0x01
|
BIN
ext/bin/tap-windows-ndis6/arm64/zttap300.sys
Normal file
BIN
ext/bin/tap-windows-ndis6/arm64/zttap300.sys
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,143 +0,0 @@
|
|||
;
|
||||
; ZeroTier One Virtual Network Port NDIS6 Driver
|
||||
;
|
||||
; Based on the OpenVPN tap-windows6 driver version 9.21.1 git
|
||||
; commit 48f027cfca52b16b5fd23d82e6016ed8a91fc4d3.
|
||||
; See: https://github.com/OpenVPN/tap-windows6
|
||||
;
|
||||
; Modified by ZeroTier, Inc. - https://www.zerotier.com/
|
||||
;
|
||||
; (1) Comment out 'tun' functionality and related features such as DHCP
|
||||
; emulation, since we don't use any of that. Just want straight 'tap'.
|
||||
; (2) Added custom IOCTL to enumerate L2 multicast memberships.
|
||||
; (3) Increase maximum number of multicast memberships to 128.
|
||||
; (4) Set default and max device MTU to 2800.
|
||||
; (5) Rename/rebrand driver as ZeroTier network port driver.
|
||||
;
|
||||
; Original copyright below. Modifications released under GPLv2 as well.
|
||||
;
|
||||
; ****************************************************************************
|
||||
; * Copyright (C) 2002-2014 OpenVPN Technologies, Inc. *
|
||||
; * This program is free software; you can redistribute it and/or modify *
|
||||
; * it under the terms of the GNU General Public License version 2 *
|
||||
; * as published by the Free Software Foundation. *
|
||||
; ****************************************************************************
|
||||
;
|
||||
|
||||
[Version]
|
||||
Signature = "$Windows NT$"
|
||||
CatalogFile = zttap300.cat
|
||||
ClassGUID = {4d36e972-e325-11ce-bfc1-08002be10318}
|
||||
Provider = %Provider%
|
||||
Class = Net
|
||||
DriverVer=08/13/2015,6.2.9200.20557
|
||||
|
||||
[Strings]
|
||||
DeviceDescription = "ZeroTier One Virtual Port"
|
||||
Provider = "ZeroTier Networks LLC" ; We're ZeroTier, Inc. now but kernel mode certs are $300+ so fuqdat.
|
||||
|
||||
; To build for x86, take NTamd64 off this and off the named section manually, build, then put it back!
|
||||
[Manufacturer]
|
||||
%Provider%=zttap300,NTamd64
|
||||
|
||||
[zttap300]
|
||||
%DeviceDescription% = zttap300.ndi, root\zttap300 ; Root enumerated
|
||||
%DeviceDescription% = zttap300.ndi, zttap300 ; Legacy
|
||||
|
||||
[zttap300.NTamd64]
|
||||
%DeviceDescription% = zttap300.ndi, root\zttap300 ; Root enumerated
|
||||
%DeviceDescription% = zttap300.ndi, zttap300 ; Legacy
|
||||
|
||||
;----------------- Characteristics ------------
|
||||
; NCF_PHYSICAL = 0x04
|
||||
; NCF_VIRTUAL = 0x01
|
||||
; NCF_SOFTWARE_ENUMERATED = 0x02
|
||||
; NCF_HIDDEN = 0x08
|
||||
; NCF_NO_SERVICE = 0x10
|
||||
; NCF_HAS_UI = 0x80
|
||||
;----------------- Characteristics ------------
|
||||
[zttap300.ndi]
|
||||
CopyFiles = zttap300.driver, zttap300.files
|
||||
AddReg = zttap300.reg
|
||||
AddReg = zttap300.params.reg
|
||||
Characteristics = 0x81
|
||||
*IfType = 0x6 ; IF_TYPE_ETHERNET_CSMACD
|
||||
*MediaType = 0x0 ; NdisMedium802_3
|
||||
*PhysicalMediaType = 14 ; NdisPhysicalMedium802_3
|
||||
|
||||
[zttap300.ndi.Services]
|
||||
AddService = zttap300, 2, zttap300.service
|
||||
|
||||
[zttap300.reg]
|
||||
HKR, Ndi, Service, 0, "zttap300"
|
||||
HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" ; yes, 'ndis5' is correct... yup, Windows.
|
||||
HKR, Ndi\Interfaces, LowerRange, 0, "ethernet"
|
||||
HKR, , Manufacturer, 0, "%Provider%"
|
||||
HKR, , ProductName, 0, "%DeviceDescription%"
|
||||
|
||||
[zttap300.params.reg]
|
||||
HKR, Ndi\params\MTU, ParamDesc, 0, "MTU"
|
||||
HKR, Ndi\params\MTU, Type, 0, "int"
|
||||
HKR, Ndi\params\MTU, Default, 0, "2800"
|
||||
HKR, Ndi\params\MTU, Optional, 0, "0"
|
||||
HKR, Ndi\params\MTU, Min, 0, "100"
|
||||
HKR, Ndi\params\MTU, Max, 0, "2800"
|
||||
HKR, Ndi\params\MTU, Step, 0, "1"
|
||||
HKR, Ndi\params\MediaStatus, ParamDesc, 0, "Media Status"
|
||||
HKR, Ndi\params\MediaStatus, Type, 0, "enum"
|
||||
HKR, Ndi\params\MediaStatus, Default, 0, "0"
|
||||
HKR, Ndi\params\MediaStatus, Optional, 0, "0"
|
||||
HKR, Ndi\params\MediaStatus\enum, "0", 0, "Application Controlled"
|
||||
HKR, Ndi\params\MediaStatus\enum, "1", 0, "Always Connected"
|
||||
HKR, Ndi\params\MAC, ParamDesc, 0, "MAC Address"
|
||||
HKR, Ndi\params\MAC, Type, 0, "edit"
|
||||
HKR, Ndi\params\MAC, Optional, 0, "1"
|
||||
HKR, Ndi\params\AllowNonAdmin, ParamDesc, 0, "Non-Admin Access"
|
||||
HKR, Ndi\params\AllowNonAdmin, Type, 0, "enum"
|
||||
HKR, Ndi\params\AllowNonAdmin, Default, 0, "0"
|
||||
HKR, Ndi\params\AllowNonAdmin, Optional, 0, "0"
|
||||
HKR, Ndi\params\AllowNonAdmin\enum, "0", 0, "Not Allowed"
|
||||
HKR, Ndi\params\AllowNonAdmin\enum, "1", 0, "Allowed"
|
||||
|
||||
;---------- Service Type -------------
|
||||
; SERVICE_KERNEL_DRIVER = 0x01
|
||||
; SERVICE_WIN32_OWN_PROCESS = 0x10
|
||||
;---------- Service Type -------------
|
||||
|
||||
;---------- Start Mode ---------------
|
||||
; SERVICE_BOOT_START = 0x0
|
||||
; SERVICE_SYSTEM_START = 0x1
|
||||
; SERVICE_AUTO_START = 0x2
|
||||
; SERVICE_DEMAND_START = 0x3
|
||||
; SERVICE_DISABLED = 0x4
|
||||
;---------- Start Mode ---------------
|
||||
|
||||
[zttap300.service]
|
||||
DisplayName = %DeviceDescription%
|
||||
ServiceType = 1
|
||||
StartType = 3
|
||||
ErrorControl = 1
|
||||
LoadOrderGroup = NDIS
|
||||
ServiceBinary = %12%\zttap300.sys
|
||||
|
||||
;----------------- Copy Flags ------------
|
||||
; COPYFLG_NOSKIP = 0x02
|
||||
; COPYFLG_NOVERSIONCHECK = 0x04
|
||||
;----------------- Copy Flags ------------
|
||||
|
||||
[SourceDisksNames]
|
||||
1 = %DeviceDescription%, zttap300.sys
|
||||
|
||||
[SourceDisksFiles]
|
||||
zttap300.sys = 1
|
||||
|
||||
[DestinationDirs]
|
||||
zttap300.files = 11
|
||||
zttap300.driver = 12
|
||||
|
||||
[zttap300.files]
|
||||
;
|
||||
|
||||
[zttap300.driver]
|
||||
zttap300.sys,,,6 ; COPYFLG_NOSKIP | COPYFLG_NOVERSIONCHECK
|
||||
|
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue