mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-11-24 10:21:39 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
28f6f4289e | ||
|
|
8208af72ac | ||
|
|
bcb83578d9 | ||
|
|
102330f968 | ||
|
|
de3c7ff37e | ||
|
|
7fc9e5e773 | ||
|
|
2eeb120091 | ||
|
|
301df12dee | ||
|
|
673a408dca | ||
|
|
04922b1898 | ||
|
|
3540c09b93 | ||
|
|
25618424e6 | ||
|
|
eac79f2080 | ||
|
|
b0ec582349 | ||
|
|
c0bfc731ec | ||
|
|
99bbd49406 | ||
|
|
0b8995879f | ||
|
|
65a50758e1 | ||
|
|
138ba19b25 | ||
|
|
336cde087e | ||
|
|
a48b4cbd89 | ||
|
|
05b6802cfa | ||
|
|
a9713335fd | ||
|
|
66beaf541e | ||
|
|
dd9cdbc712 | ||
|
|
384344ead3 | ||
|
|
6aecbe2750 | ||
|
|
2a38f30125 | ||
|
|
4658dfc6c6 | ||
|
|
fb0063221d | ||
|
|
f50ca2244b | ||
|
|
de7460ec7c | ||
|
|
c53c2375c4 | ||
|
|
3f986d584e | ||
|
|
103e266ebc | ||
|
|
55b18b2271 | ||
|
|
3439be1bbb | ||
|
|
a349a0d769 | ||
|
|
310206a889 | ||
|
|
be54f9afef | ||
|
|
673485755c | ||
|
|
33e63afb0f | ||
|
|
37da1712e0 | ||
|
|
080f1c56aa | ||
|
|
82098a8760 | ||
|
|
6d431a2c43 | ||
|
|
08986ad405 | ||
|
|
aea28ca6dc | ||
|
|
e6b7c6ca75 | ||
|
|
7d84f7d3e0 | ||
|
|
ba4146ea31 | ||
|
|
e4ec3b0345 | ||
|
|
6720a27109 | ||
|
|
cfddedb3da | ||
|
|
2e238abe01 | ||
|
|
ec497c7dda | ||
|
|
0a5078a848 | ||
|
|
f7e6a85166 | ||
|
|
680f37182f | ||
|
|
495446cf4f | ||
|
|
4b30a03adf | ||
|
|
c86164bd1b | ||
|
|
bd059fc8aa | ||
|
|
fcee5656b9 | ||
|
|
24d1f271bf | ||
|
|
b3a45e0839 | ||
|
|
4e91d92c5f | ||
|
|
96fe4f7317 | ||
|
|
20b4b8e17d | ||
|
|
87c4f84a89 | ||
|
|
0e75f5f45c | ||
|
|
28b25598ed | ||
|
|
1e2846a1a5 | ||
|
|
ce25e7791d | ||
|
|
0b850d6b56 | ||
|
|
a8091761d7 | ||
|
|
097f784e7a | ||
|
|
06a82b6601 | ||
|
|
baa8580efd | ||
|
|
059508ed7a | ||
|
|
5572b3c329 | ||
|
|
0dd17d78d8 | ||
|
|
baa99c6f8f | ||
|
|
9ea88e556a | ||
|
|
2f766be0be | ||
|
|
5c50f7a084 | ||
|
|
93a4bbacbe | ||
|
|
eb6db316cc | ||
|
|
ec3e95935f | ||
|
|
10d37384f0 | ||
|
|
e797c2d0ba | ||
|
|
9bf39f85f9 | ||
|
|
475eb7c845 | ||
|
|
b3a6dcda5f | ||
|
|
cdbfceafd1 | ||
|
|
34397d5dc8 | ||
|
|
9220eb136c | ||
|
|
525e98b05b | ||
|
|
251a508fae | ||
|
|
c90f3564e8 | ||
|
|
1698e6cf66 | ||
|
|
ec884dd508 | ||
|
|
6e09f2892a | ||
|
|
e09e3b49f9 | ||
|
|
510586c4f8 | ||
|
|
442177de59 | ||
|
|
7a20afb289 | ||
|
|
88ab140cf9 | ||
|
|
df0946c2a4 | ||
|
|
b84fb4952e | ||
|
|
80044d655f | ||
|
|
b491cac8f7 | ||
|
|
866f93fa2d | ||
|
|
bc5f34343f | ||
|
|
33e42bf423 | ||
|
|
71aedcac87 | ||
|
|
30d40d09de | ||
|
|
b9c7d52582 | ||
|
|
b2f1f630d9 | ||
|
|
086e0b87cf | ||
|
|
18398cd3f2 | ||
|
|
61f950bf61 | ||
|
|
fc57a1b8ac | ||
|
|
abf7fe1b5b | ||
|
|
71c2388bed | ||
|
|
f61d14b3ae | ||
|
|
e4c8b49eaf | ||
|
|
3afd290278 | ||
|
|
ee0ff1c4a2 | ||
|
|
5d424ea2ac | ||
|
|
90d75b9673 | ||
|
|
013dab8737 | ||
|
|
6269e1c2b3 | ||
|
|
b02ec478c5 | ||
|
|
719676519d | ||
|
|
2df7a9bac7 | ||
|
|
23ca3b415f | ||
|
|
668ced35f8 | ||
|
|
1f7d571017 | ||
|
|
a072f21978 | ||
|
|
9dfe842794 | ||
|
|
f65065fdf3 | ||
|
|
3af1325a93 | ||
|
|
5ee69759e1 | ||
|
|
b9572e5812 | ||
|
|
0a4e4c8061 | ||
|
|
b4600dd4f7 | ||
|
|
24d2626b52 | ||
|
|
5ba8abd0fd | ||
|
|
c66dd4c8ad | ||
|
|
ae2c5c84ef | ||
|
|
58d2ed88aa | ||
|
|
680f37e9a6 | ||
|
|
c7c9feef95 | ||
|
|
9a96e63643 | ||
|
|
7f1a2bd2be | ||
|
|
2c65ed1ea1 | ||
|
|
73e9ff81de | ||
|
|
4f330d73ec | ||
|
|
9eb60234fc | ||
|
|
9a543cfe42 | ||
|
|
2e0466da94 | ||
|
|
13ca2511b1 | ||
|
|
9bb5bf421d | ||
|
|
4b79c5bdf1 | ||
|
|
678b3d1703 | ||
|
|
16c8393569 | ||
|
|
9531a6a9cd | ||
|
|
7b3993db12 | ||
|
|
b0eaf05225 | ||
|
|
970d93d428 | ||
|
|
b35a747dab | ||
|
|
fa743743e1 | ||
|
|
17b12494de | ||
|
|
7004fc6fd4 | ||
|
|
edb7e1da15 | ||
|
|
9df9269421 | ||
|
|
017e2c53de | ||
|
|
ec544485b9 | ||
|
|
97bbf2a9a4 | ||
|
|
1e2f1d04da | ||
|
|
01e5196c12 | ||
|
|
fa479edc12 | ||
|
|
bcae189da3 | ||
|
|
5f2054bf90 | ||
|
|
14fd94e9d4 | ||
|
|
d1d19fcca3 | ||
|
|
154d74b7a0 | ||
|
|
2eacabec1d | ||
|
|
485761cbe8 | ||
|
|
31922cb2ba | ||
|
|
98512fc8f6 | ||
|
|
2d581b35f3 | ||
|
|
99242f4113 | ||
|
|
20846b2183 | ||
|
|
7fc5657e8f | ||
|
|
70c8549f02 | ||
|
|
12431fe93c | ||
|
|
fbc260b430 | ||
|
|
d43170b00a | ||
|
|
16f2a39298 | ||
|
|
38b447c6b4 | ||
|
|
a123c041f7 | ||
|
|
2a7240ae27 | ||
|
|
d8cd38d31b | ||
|
|
7e1187a48f | ||
|
|
9ef9a411b2 | ||
|
|
a89cac300d | ||
|
|
1f4e9e75ed | ||
|
|
c12367a013 | ||
|
|
2bd6a233dc | ||
|
|
5d7a0d92c6 | ||
|
|
3d237fed39 | ||
|
|
4b853215c6 | ||
|
|
b151c9e88d | ||
|
|
07e83f5981 | ||
|
|
3b9f5a0193 | ||
|
|
c03353ad0e | ||
|
|
0d2fb35733 | ||
|
|
fe34a79277 | ||
|
|
87dc0f797d | ||
|
|
27fe18d715 | ||
|
|
18fd5d7a7a | ||
|
|
39a0167cbb | ||
|
|
704853b3be | ||
|
|
f720383adc | ||
|
|
9895d60484 | ||
|
|
97b7c5f91f | ||
|
|
6da670ac45 | ||
|
|
ae0c62aae8 | ||
|
|
d9290bc940 | ||
|
|
3c016c978b | ||
|
|
caf940c805 | ||
|
|
14b8f1bd4d | ||
|
|
f8a623e0c6 | ||
|
|
35540b4ff3 | ||
|
|
87c2b89120 | ||
|
|
a0fcede368 | ||
|
|
c17407ec94 | ||
|
|
c9fb076dd7 | ||
|
|
9471dde765 | ||
|
|
2bbff23640 | ||
|
|
9ab4c0f5cb | ||
|
|
1322c0671b | ||
|
|
7963713314 | ||
|
|
0e7f176a16 | ||
|
|
2496c846f4 | ||
|
|
b4e670c36f | ||
|
|
63373385f5 | ||
|
|
a33858523f | ||
|
|
9bcc0f1d37 | ||
|
|
836fa8ce58 | ||
|
|
7de1c4b4cf | ||
|
|
6877fba346 | ||
|
|
c56d0f2462 | ||
|
|
2ddfecb47a | ||
|
|
3e8ea4e590 | ||
|
|
a04daaff75 | ||
|
|
8e8d1dcca8 | ||
|
|
40e2b5fd4b | ||
|
|
c82163f287 | ||
|
|
2515811356 | ||
|
|
3f242a7114 | ||
|
|
c322ad5d33 | ||
|
|
5cce5454e1 | ||
|
|
fe88004eaf | ||
|
|
435d7e0cdf | ||
|
|
42ca206037 | ||
|
|
ac7f1ca3aa | ||
|
|
2b691a94a4 | ||
|
|
3b4f7c8ab7 | ||
|
|
bc6f9703e3 | ||
|
|
cdf596da19 | ||
|
|
d72c1d9be7 | ||
|
|
ba059b0b2a | ||
|
|
22e852cf36 | ||
|
|
496043dd9c | ||
|
|
d2b10d3b09 | ||
|
|
bd9a10d349 | ||
|
|
f24691cd60 | ||
|
|
07cdca0a2b | ||
|
|
7f86dffa06 | ||
|
|
1735da6c17 | ||
|
|
37ac4d6b16 | ||
|
|
cd77e78f0a | ||
|
|
86170406af | ||
|
|
03412b12d0 | ||
|
|
da18cb70fa | ||
|
|
01b3d19d6d | ||
|
|
564cb451ac | ||
|
|
1cde511d6d | ||
|
|
39592518b0 | ||
|
|
57c62b5330 | ||
|
|
0c7b333743 | ||
|
|
6766b17131 | ||
|
|
bd602b6d11 | ||
|
|
56f91dfeab | ||
|
|
849ac908c8 | ||
|
|
0b5391447e | ||
|
|
d34fbe99e8 | ||
|
|
0aefee74c6 | ||
|
|
1c99c4ceac | ||
|
|
4f15700db3 | ||
|
|
1389e2fd8e | ||
|
|
4444f297c2 | ||
|
|
c375fb0b7f | ||
|
|
f7634d5846 | ||
|
|
e4a4e8c790 | ||
|
|
9d8d4b8796 | ||
|
|
b5ebaa1fc0 | ||
|
|
bf41bb4ced | ||
|
|
cdb88a33ac | ||
|
|
077a4a0b54 | ||
|
|
e8f6936480 | ||
|
|
6126cc2158 | ||
|
|
4926a0cb91 | ||
|
|
f74146648e | ||
|
|
b0491faeee | ||
|
|
9fa673d105 | ||
|
|
7ac8e5c0ab | ||
|
|
b900e3513c | ||
|
|
65380457b8 | ||
|
|
efbd84276c | ||
|
|
f260e771ea | ||
|
|
dec3f0713f | ||
|
|
21a23d7488 | ||
|
|
cb664d1a4b | ||
|
|
45ca32dcb9 | ||
|
|
93df3ef612 | ||
|
|
f682ceb8e2 | ||
|
|
545424b86b | ||
|
|
1d10636a5f | ||
|
|
9f34cdb2f8 | ||
|
|
da4c532efb | ||
|
|
97c981764d | ||
|
|
3310474137 | ||
|
|
6c81ddd00f | ||
|
|
da50e2969d | ||
|
|
7afc0aa2ba | ||
|
|
1e35987658 | ||
|
|
44c9c36c65 | ||
|
|
00d3ed46bf | ||
|
|
d6b9f693c4 | ||
|
|
051e928b01 | ||
|
|
b644e671c2 | ||
|
|
4c02326989 | ||
|
|
af40956e58 | ||
|
|
3b22615aec | ||
|
|
cc1c891400 | ||
|
|
3d85cbd7f0 | ||
|
|
17ec3c71af | ||
|
|
6849e26ee7 | ||
|
|
fd7cd31d21 | ||
|
|
d763884442 | ||
|
|
a29b4ea1e8 | ||
|
|
4d0eedd474 | ||
|
|
256d42ad18 | ||
|
|
cb88d94d6d | ||
|
|
2979fe6e7f | ||
|
|
a22671d7c4 | ||
|
|
1dd63d4dcb | ||
|
|
9d1745d29d | ||
|
|
7da573f187 | ||
|
|
9d103249e2 | ||
|
|
3708fa1876 | ||
|
|
dba80e614e | ||
|
|
c8f76760be | ||
|
|
c9e81856e5 | ||
|
|
9791fa52fb | ||
|
|
62cc3959b9 | ||
|
|
1533244d34 | ||
|
|
890544e88b | ||
|
|
51531186d0 | ||
|
|
513910462e | ||
|
|
1f1d6d9a87 | ||
|
|
cb0051d64d | ||
|
|
397fb4d20a | ||
|
|
67a600dbfb | ||
|
|
9d7e9b9562 | ||
|
|
3c4a5a6ed3 | ||
|
|
d72f0ec1c7 | ||
|
|
79bc79eeef | ||
|
|
c8c41c2038 | ||
|
|
4056231e5c | ||
|
|
ee808c46be | ||
|
|
7b9439f761 | ||
|
|
dcfdd8a184 | ||
|
|
dc4ca85cbb | ||
|
|
61ede421b4 | ||
|
|
cb74ad78de | ||
|
|
b6e554e4c0 | ||
|
|
95f2d6302f | ||
|
|
0df408d807 | ||
|
|
abdaa55e17 | ||
|
|
c243a5b6e5 | ||
|
|
b4ec688f1a | ||
|
|
2e083b2d8f | ||
|
|
909f19640c | ||
|
|
a79e16c03c | ||
|
|
d2805ffcc9 | ||
|
|
7c19b660b4 | ||
|
|
33907d2e23 | ||
|
|
ea48501b1d | ||
|
|
ff11f007ec | ||
|
|
dc4170ad6b | ||
|
|
03f2be2ee6 | ||
|
|
6941854ce2 | ||
|
|
09d2dca3c3 | ||
|
|
425bfaf779 | ||
|
|
df39546485 | ||
|
|
4624fd51b1 | ||
|
|
7067276170 | ||
|
|
b19e232df2 | ||
|
|
0f1763877c | ||
|
|
1e826a201d | ||
|
|
a27453e4f7 | ||
|
|
2a77348470 | ||
|
|
1ae82a483a | ||
|
|
93e34d124b | ||
|
|
edf38d33d6 | ||
|
|
31acf60eca | ||
|
|
25a600db24 | ||
|
|
ef2a012301 | ||
|
|
7bfad732e2 | ||
|
|
0b7ffbaafa | ||
|
|
6bae28b771 | ||
|
|
72a8723e13 | ||
|
|
4e1af0600b | ||
|
|
6397675574 | ||
|
|
7d847c0583 | ||
|
|
8f006316b2 | ||
|
|
627912a788 | ||
|
|
2cbc7691f0 | ||
|
|
d174962a04 | ||
|
|
9c80cf371c | ||
|
|
9f5ccf43d4 | ||
|
|
6f6af8e902 | ||
|
|
6cddffd546 | ||
|
|
a59e9ec9e3 | ||
|
|
9ebec50a72 | ||
|
|
9ff7a84afe | ||
|
|
7a0354699a | ||
|
|
978b951169 | ||
|
|
e363c2ff78 | ||
|
|
0577c28120 | ||
|
|
195a33379d | ||
|
|
78b2e12fbd | ||
|
|
0f4d38bf6c | ||
|
|
e03346c671 | ||
|
|
fca766704a | ||
|
|
da0cd68115 | ||
|
|
3d4616746c | ||
|
|
90522ddcb9 | ||
|
|
761b7f4e12 | ||
|
|
9b3da79c32 | ||
|
|
4f532b8426 | ||
|
|
a28ab15feb | ||
|
|
05b86282a5 | ||
|
|
c8f1667270 | ||
|
|
e61cf3ccfb | ||
|
|
a44631607d | ||
|
|
d61694a1a8 | ||
|
|
9f89dcf4e0 | ||
|
|
0b98a5c126 | ||
|
|
88f7f88f3f | ||
|
|
7c72d2d866 | ||
|
|
b953954b60 | ||
|
|
1086ab2563 | ||
|
|
0baff42864 | ||
|
|
2b995ea10a | ||
|
|
5e0b32460a | ||
|
|
5e7fd7ad78 | ||
|
|
a47f39fa2b | ||
|
|
338aa551d1 | ||
|
|
429182a349 | ||
|
|
b6f7d62bb6 | ||
|
|
ad8cd9a5a3 | ||
|
|
76880eb46b | ||
|
|
600693e8af | ||
|
|
b4c625543a | ||
|
|
3fc0501424 | ||
|
|
2f139af2d1 | ||
|
|
115f859cc7 | ||
|
|
383a1824c1 | ||
|
|
412c996322 | ||
|
|
d166f0da8b | ||
|
|
e31b5fac0e | ||
|
|
6475a5e036 | ||
|
|
e52a4b8d7d | ||
|
|
6548c17110 | ||
|
|
8214f98ceb | ||
|
|
d1c53d21fe | ||
|
|
470866935e | ||
|
|
1cb7950810 | ||
|
|
34b09a8ef3 | ||
|
|
764ae8107c | ||
|
|
15a197a69e | ||
|
|
98a31e153c | ||
|
|
5b6e493605 | ||
|
|
b7f6d7dad9 | ||
|
|
14af370487 | ||
|
|
3c6083e56a | ||
|
|
0ea10ad7ad | ||
|
|
d9e871e60e | ||
|
|
851ac2322e | ||
|
|
ab21560d09 | ||
|
|
7c4a7e8921 | ||
|
|
50a4c51a4f | ||
|
|
088ed5452e | ||
|
|
48d6ef6607 | ||
|
|
afa89b6c3e | ||
|
|
5ea6af2dd2 | ||
|
|
616e654d05 | ||
|
|
d1ce692c09 | ||
|
|
b0bf6bb96a | ||
|
|
87a4ce5552 | ||
|
|
0487a96b04 | ||
|
|
c307b8dc2d | ||
|
|
ddb757a25c | ||
|
|
0d774d32d6 | ||
|
|
680a91e12a | ||
|
|
2550983998 | ||
|
|
7c3a19c2fe | ||
|
|
553cfa1f9f | ||
|
|
74cbcd3723 | ||
|
|
f102ef1d94 | ||
|
|
9306f69bc0 | ||
|
|
3312b8da50 | ||
|
|
ead1b6688f | ||
|
|
614af37bc4 | ||
|
|
a3fc14f35f | ||
|
|
65dedd3a6f | ||
|
|
8947cb243e | ||
|
|
782c46be29 | ||
|
|
83d3a6d4e1 | ||
|
|
f9bfa850c4 | ||
|
|
71f6a2ab4e | ||
|
|
8b64ae650b | ||
|
|
d942ecc904 | ||
|
|
94a3e293fd | ||
|
|
c3de6a25fb | ||
|
|
24610b61c5 | ||
|
|
b3523abad5 | ||
|
|
97af29dc6f | ||
|
|
60dd7ea5c9 | ||
|
|
d395680ca2 | ||
|
|
e4bc459975 | ||
|
|
9ba5a05020 | ||
|
|
3124cdd661 | ||
|
|
9cfb117903 | ||
|
|
b3606e33a6 | ||
|
|
2d8843103d | ||
|
|
9b72b352d5 | ||
|
|
9d7812fbf1 | ||
|
|
fb61987d93 | ||
|
|
7ee7a267b2 | ||
|
|
a80ef94f09 | ||
|
|
e974da41aa | ||
|
|
3a236d9c3c | ||
|
|
d58386fd12 | ||
|
|
ca76c56377 | ||
|
|
6c1ff4a8c1 | ||
|
|
0bd109d7bc | ||
|
|
9e6924a3f3 | ||
|
|
55a3a1e594 | ||
|
|
9b155ba467 | ||
|
|
ea5896ed91 | ||
|
|
7ed5ef6da4 | ||
|
|
1de293eb14 | ||
|
|
bb3ad9c694 | ||
|
|
7f44f908d9 | ||
|
|
39bfb37b83 | ||
|
|
d5adb54bc6 | ||
|
|
0438de610f | ||
|
|
1cfcea769f | ||
|
|
acd176ca95 | ||
|
|
f43fc797d4 | ||
|
|
32f91a4faa | ||
|
|
8e3176b789 | ||
|
|
41b2d51390 | ||
|
|
025b947a24 | ||
|
|
ff1b4bfcc9 | ||
|
|
76fa3c2e5e | ||
|
|
a3ebacd17c | ||
|
|
53db1f178c | ||
|
|
b38cf87444 | ||
|
|
55ec8abf17 | ||
|
|
0b8746a133 | ||
|
|
5a957fd750 | ||
|
|
2b1f475b3f | ||
|
|
7c3d8cf8db | ||
|
|
9bb1b847be | ||
|
|
0b42a02292 | ||
|
|
813b634d08 | ||
|
|
4a2aac6bc9 | ||
|
|
d9b435fb62 | ||
|
|
6c430555aa | ||
|
|
354b4b040e | ||
|
|
c782f63849 | ||
|
|
7ffdc48b49 | ||
|
|
c5fa529f27 | ||
|
|
e15bdf11eb | ||
|
|
af60ef7647 | ||
|
|
e3bcb06c3e | ||
|
|
4a8ef9d5cb | ||
|
|
84d2280960 | ||
|
|
5042967836 | ||
|
|
4fd2532b0a | ||
|
|
a19b3a6971 | ||
|
|
02ccde6c71 | ||
|
|
8cc97afac4 | ||
|
|
e98b4ad449 | ||
|
|
a8064cf7cd | ||
|
|
d09182614c | ||
|
|
75f64acd9f | ||
|
|
6381de7bab | ||
|
|
fdfd0ffb07 | ||
|
|
b0c6762bc1 | ||
|
|
fcdea284e1 | ||
|
|
7425100bac | ||
|
|
3564cdf07e | ||
|
|
d454aa0fdf | ||
|
|
38e0832cf4 | ||
|
|
a3623eb41a | ||
|
|
fd28e167b9 | ||
|
|
72bc4c1f87 | ||
|
|
e5053ffcda | ||
|
|
9ac1e2ff32 | ||
|
|
f3a79dda87 | ||
|
|
0045103d14 | ||
|
|
5eefbbb9ed | ||
|
|
d2a933784c | ||
|
|
828c324b18 | ||
|
|
3f05a37f65 | ||
|
|
60c8e40386 | ||
|
|
b8e5a71450 | ||
|
|
572b4d3477 | ||
|
|
c13faa8e3c | ||
|
|
f192904009 | ||
|
|
7623bcd19e | ||
|
|
8bf01b7add | ||
|
|
795d1c2892 | ||
|
|
fbb51d2cae | ||
|
|
6913b11e0a | ||
|
|
b94b427d8f | ||
|
|
1e57c06295 | ||
|
|
3df45319a0 | ||
|
|
ea464cef8d | ||
|
|
952cce0d8e | ||
|
|
a8e3cd3256 | ||
|
|
53850e99d4 | ||
|
|
686cf1f304 | ||
|
|
b0487c6600 | ||
|
|
9fbfb87723 | ||
|
|
6da6aff8b4 | ||
|
|
d2fa21d07b | ||
|
|
ecbdba3e1e | ||
|
|
d3768cca36 | ||
|
|
baf76d88ad | ||
|
|
0889ddd001 | ||
|
|
acf3dd8056 | ||
|
|
f46fbf188a | ||
|
|
6eff43b36d | ||
|
|
f2d15139f5 | ||
|
|
ea67013cc8 | ||
|
|
041646b728 | ||
|
|
5764a92e59 | ||
|
|
b990de2e12 | ||
|
|
0b388be33c | ||
|
|
fe585157d2 | ||
|
|
2e1cb43042 | ||
|
|
eed6a36e5d | ||
|
|
e7a770c977 | ||
|
|
eb0f38544c | ||
|
|
797801f527 | ||
|
|
3e546b916a | ||
|
|
673a11379f | ||
|
|
54468a1a2a | ||
|
|
5b27caa338 | ||
|
|
8289bbd846 | ||
|
|
4bd2a359e3 | ||
|
|
49c450d942 | ||
|
|
dec3f7847e | ||
|
|
b68394bbe2 | ||
|
|
a7ee943216 | ||
|
|
ab1fb1dce0 | ||
|
|
8bb4c4dd32 | ||
|
|
0153ec1a69 | ||
|
|
67621ee6ba | ||
|
|
b8a398a9a5 | ||
|
|
a09ffe6a0f | ||
|
|
7388824759 | ||
|
|
e0be8743f6 | ||
|
|
bbedd5383a | ||
|
|
0b04528803 | ||
|
|
45353fbe2c | ||
|
|
65875e6dac | ||
|
|
0d67ea0413 | ||
|
|
c8be4417a6 | ||
|
|
78057bc9c8 | ||
|
|
7c141d4afc | ||
|
|
494fa5a9da | ||
|
|
4984fc05bc | ||
|
|
4d6fb1d38d | ||
|
|
0af59a3a0a | ||
|
|
305b930d90 | ||
|
|
bcd9bfa614 | ||
|
|
bc3884ca91 | ||
|
|
5ddaf78fdc | ||
|
|
df0bf927e4 | ||
|
|
89f31c6ab2 | ||
|
|
efe20ea51c | ||
|
|
a50f64a6c8 | ||
|
|
e21a72fcd1 | ||
|
|
999fb83b61 | ||
|
|
e1477bd065 | ||
|
|
559eb5ed71 | ||
|
|
aa495fce38 | ||
|
|
77edcaf011 | ||
|
|
9cd60c28c0 | ||
|
|
2a1c465d62 | ||
|
|
2ba896c5ac | ||
|
|
14eb5395b3 | ||
|
|
1d388547ee | ||
|
|
8ef2b826c3 | ||
|
|
e343cec4d5 | ||
|
|
c4bb80d2f0 | ||
|
|
d58efc5d01 | ||
|
|
5d219a4111 | ||
|
|
4b26ab16fb | ||
|
|
ea9b80dc92 | ||
|
|
0e27312eda | ||
|
|
e942da339b | ||
|
|
d28a7ffba1 | ||
|
|
4e0a953b98 | ||
|
|
23e2d28c21 | ||
|
|
27c5b0b1af | ||
|
|
c490e06b29 | ||
|
|
84019b06d9 | ||
|
|
66d89918aa | ||
|
|
7fd21f8bf4 | ||
|
|
5e4f6437ca | ||
|
|
88695b0d1f | ||
|
|
88db068ea3 | ||
|
|
fb269c9032 | ||
|
|
798e5cbec6 | ||
|
|
e62dc7bfa2 | ||
|
|
7bcb2df6be | ||
|
|
f295e195b5 | ||
|
|
82482741df | ||
|
|
ab76062a41 | ||
|
|
14ca4b9607 | ||
|
|
d14417d392 | ||
|
|
b5aaac8518 | ||
|
|
96c5c27610 | ||
|
|
e269ad6528 | ||
|
|
91f92bee49 | ||
|
|
845288be86 | ||
|
|
9066702ddd | ||
|
|
395e63130f | ||
|
|
5a689bee8c | ||
|
|
150d004eed | ||
|
|
be457896dd | ||
|
|
efa88fac6d | ||
|
|
4d082ff5b9 | ||
|
|
7ff25431c0 | ||
|
|
1803471e02 | ||
|
|
19d9c17d5a | ||
|
|
3de56d344e | ||
|
|
8a050baf37 | ||
|
|
c71abbdfb8 | ||
|
|
50b28e1edd | ||
|
|
48591b1436 | ||
|
|
ed15121e95 | ||
|
|
f009c7be63 | ||
|
|
46c6945da5 | ||
|
|
46453be6dd | ||
|
|
1beb4cb002 | ||
|
|
28c1f2c51e | ||
|
|
4c65fea1ac | ||
|
|
da06212268 | ||
|
|
8ae93a98e5 | ||
|
|
5af16a47a8 | ||
|
|
6da7e538e1 | ||
|
|
52737fadd1 | ||
|
|
13e6ba4cb2 | ||
|
|
681c51195f | ||
|
|
93b7328c3f | ||
|
|
5cc0eab30e | ||
|
|
11dc5bcbe1 | ||
|
|
8c4f7ce5a4 | ||
|
|
fa3ab87b11 | ||
|
|
96cf5822a0 | ||
|
|
9bd9e9a58b | ||
|
|
2cbf6d2b6c | ||
|
|
9d6dee7451 | ||
|
|
cf5333562d | ||
|
|
9c2cdc7203 | ||
|
|
acc3d774cb | ||
|
|
65150f5cc3 | ||
|
|
4621b39024 | ||
|
|
21a1512e6c | ||
|
|
c744edcd35 | ||
|
|
9eb61e8e6f | ||
|
|
368beb147d | ||
|
|
a7f1d0b835 | ||
|
|
c958c8075f | ||
|
|
48546f7777 | ||
|
|
bd7cb38666 | ||
|
|
ded1eb9635 | ||
|
|
a865f67b59 | ||
|
|
8436c06718 | ||
|
|
cf4791f1ad | ||
|
|
847cbcdae8 | ||
|
|
0bc66e5a56 | ||
|
|
6dd94ec7e6 | ||
|
|
c9dd381736 | ||
|
|
4cf4f8e884 | ||
|
|
f734a055e4 | ||
|
|
d48236da94 | ||
|
|
9bdb7990dd | ||
|
|
4c05d7b888 | ||
|
|
44c9c4af4b | ||
|
|
94ed42caf1 | ||
|
|
a50fba62dc | ||
|
|
e0c18cc3d4 | ||
|
|
d4696a9e37 | ||
|
|
0817c25f4c | ||
|
|
7c2bdf0407 | ||
|
|
7745a97cca | ||
|
|
2574c05770 | ||
|
|
b7a16c7ef1 | ||
|
|
fe872dacc9 | ||
|
|
b86eaea5b2 | ||
|
|
3e230bf3ad | ||
|
|
5610a2d4c3 | ||
|
|
848023b03a | ||
|
|
ab9a37e0d4 | ||
|
|
a3aaf2cb92 | ||
|
|
9e4eb52a82 | ||
|
|
b2998a19ab | ||
|
|
9bcd715d31 | ||
|
|
d65c447afe | ||
|
|
6a95c66bc7 | ||
|
|
701248d820 | ||
|
|
b5800847ae | ||
|
|
ac873fd537 | ||
|
|
aa85cbb86e | ||
|
|
ca253a2892 | ||
|
|
c59991420e | ||
|
|
aa99aa2d2b | ||
|
|
c0304b8362 | ||
|
|
28e19d2292 | ||
|
|
d1f1271a02 | ||
|
|
d736c5811c | ||
|
|
de4fdbe553 | ||
|
|
8a676fc338 | ||
|
|
804606042f | ||
|
|
fa890d47a0 | ||
|
|
53f2db3f97 | ||
|
|
b7d7d487a1 | ||
|
|
1f2fdec89d | ||
|
|
4652eb2bb5 | ||
|
|
8714c157c9 | ||
|
|
f3d3680f74 | ||
|
|
657fba4ca5 | ||
|
|
2a9517a9a2 | ||
|
|
0a69621207 | ||
|
|
b9be5e3de7 | ||
|
|
1a0e413300 | ||
|
|
6bd4157a9c | ||
|
|
fd1dadc3e0 | ||
|
|
5d95ea3a97 | ||
|
|
58ccf82e0b | ||
|
|
298efba16d | ||
|
|
ceab244329 | ||
|
|
b2f77cd78c | ||
|
|
58fcdceca2 | ||
|
|
e847748f69 | ||
|
|
98af3c0ad6 | ||
|
|
2fc11b43af | ||
|
|
1d1b40c8b2 | ||
|
|
ca831f367a | ||
|
|
c7811a159d | ||
|
|
172a9d5e4e | ||
|
|
dd067b6e75 | ||
|
|
aba8346bd6 | ||
|
|
264e7ad3ee | ||
|
|
a3983eab47 | ||
|
|
d8e269e0ac | ||
|
|
5f7d49ca5a | ||
|
|
c45ea8dfac | ||
|
|
962988aa4c | ||
|
|
a2d313c59b | ||
|
|
92bd2edad7 | ||
|
|
15722b06dd | ||
|
|
5fdb29396b | ||
|
|
d230dae0a5 | ||
|
|
6177981707 | ||
|
|
6db8307fd8 | ||
|
|
400aa437fd | ||
|
|
e11dbf3a8e | ||
|
|
c98fb6615a | ||
|
|
baa9f29f0d | ||
|
|
332bbacf67 | ||
|
|
55b6e7dbfe | ||
|
|
1c57f08148 | ||
|
|
ccff578358 | ||
|
|
a05e05a47c | ||
|
|
dd20d2dd96 | ||
|
|
c2fb08b323 | ||
|
|
c1dc6cb0fb | ||
|
|
e180b8362d | ||
|
|
432fe1b3c9 | ||
|
|
7940a48f55 | ||
|
|
8dd8897fd8 | ||
|
|
879848f6eb | ||
|
|
4b357da0bb | ||
|
|
9f5db8e8c1 | ||
|
|
9d9549078f | ||
|
|
ff58edb1c1 | ||
|
|
eadd41c4ce | ||
|
|
79bab39502 | ||
|
|
ca3bbb1687 | ||
|
|
a4d5d59901 | ||
|
|
5b9f98c8c7 | ||
|
|
1af14a0237 | ||
|
|
90f7953dee | ||
|
|
944a9986d9 | ||
|
|
260145e8f7 | ||
|
|
bcf5ba02da | ||
|
|
4a83d436a2 | ||
|
|
625f31f67c | ||
|
|
61826bc189 | ||
|
|
8cc0e48117 | ||
|
|
a456e2072f | ||
|
|
60a1e4c866 | ||
|
|
2a8d7dec64 | ||
|
|
5d67c131fa | ||
|
|
778be9cbb5 | ||
|
|
b9cc87d35a | ||
|
|
0716079d4a | ||
|
|
490d501257 | ||
|
|
638aedd1a0 | ||
|
|
725e4adc46 | ||
|
|
9f9626446a | ||
|
|
4a14d39cad | ||
|
|
eafb8be23f | ||
|
|
8ec58c96f5 | ||
|
|
4bedd71627 | ||
|
|
e8450b2e61 | ||
|
|
40394bc4c8 | ||
|
|
30c3855e4b | ||
|
|
30a004af7b | ||
|
|
ccf90aee8a | ||
|
|
2ed258ebac | ||
|
|
e6c03fd448 | ||
|
|
0bdef55d2a | ||
|
|
e0f1cdf464 | ||
|
|
51a5451a5f | ||
|
|
8d88c6532f | ||
|
|
97397b867c | ||
|
|
3890bd2be7 | ||
|
|
694d694d8c | ||
|
|
6cd1eb9b94 | ||
|
|
4bc27e7cb5 | ||
|
|
f196b7a583 | ||
|
|
fae770c98b | ||
|
|
bd9935eebb | ||
|
|
4ee7c1039e | ||
|
|
0e0e838ff5 | ||
|
|
9541ef8bcb | ||
|
|
0caebd3171 | ||
|
|
469c0f648b | ||
|
|
7d2944eba9 | ||
|
|
fb11c2f6d7 | ||
|
|
a5db2feb5e | ||
|
|
6be2464420 | ||
|
|
708ceb3d29 | ||
|
|
193bd0d5ea | ||
|
|
157e33f2a4 | ||
|
|
bf619e67ab | ||
|
|
1d4fb83313 | ||
|
|
4cd79cef55 | ||
|
|
85f5f6cebb | ||
|
|
28d2ff2492 | ||
|
|
6a750f4522 | ||
|
|
8107377d7f | ||
|
|
46c2cc37c3 | ||
|
|
f085917d8c | ||
|
|
aa8dd6e44f | ||
|
|
dbd06758c0 | ||
|
|
4e94a64dcc | ||
|
|
4caa950da9 | ||
|
|
494990f914 | ||
|
|
909d1c9df9 | ||
|
|
95ccb837d3 | ||
|
|
bb955f9a08 | ||
|
|
24b33a43fc | ||
|
|
9131a80656 | ||
|
|
8ae16aa452 | ||
|
|
d0da619bc9 | ||
|
|
bf4a9edc89 | ||
|
|
024f7b3072 | ||
|
|
78b4eac974 | ||
|
|
0a3f98bd2f | ||
|
|
a34868468f | ||
|
|
26e6a163a3 | ||
|
|
e392c70b6f | ||
|
|
c657f995cf | ||
|
|
511d1bb3fa | ||
|
|
2cc7c953f1 | ||
|
|
4273ffa77e | ||
|
|
e67e2d5fef | ||
|
|
f5ccf746ea | ||
|
|
984e328839 | ||
|
|
b2d90b7d86 | ||
|
|
be12b1d3d1 | ||
|
|
e0a78fde07 | ||
|
|
4c38b70790 | ||
|
|
203f4134b0 | ||
|
|
fbbc64dadf | ||
|
|
c2b697a778 | ||
|
|
ba49af1ce8 | ||
|
|
ddec2ab282 | ||
|
|
380a1aa163 | ||
|
|
35ff7d1fb4 | ||
|
|
1512f65c98 | ||
|
|
cba18635c8 | ||
|
|
691c442c21 | ||
|
|
0d8c7a9c5d | ||
|
|
e52736b2c0 | ||
|
|
faff3174a3 | ||
|
|
899c2ed7b1 | ||
|
|
2fc1b672cc | ||
|
|
50859575f2 | ||
|
|
143983b585 | ||
|
|
c7086b8759 | ||
|
|
4afdf4153a | ||
|
|
e3bf40daea | ||
|
|
750dc9c3e0 | ||
|
|
42d62a1e21 | ||
|
|
48b7adde7d | ||
|
|
464554ab8f | ||
|
|
0585f6d065 | ||
|
|
4f69035de1 | ||
|
|
8101a7b0bd | ||
|
|
0fd51633f4 | ||
|
|
e8620587dd | ||
|
|
40ccecb341 | ||
|
|
a89680fa2d | ||
|
|
120c4f8a4c | ||
|
|
b919039c43 | ||
|
|
8b2adb0bc7 | ||
|
|
9b0960bb5a | ||
|
|
3313c6e0b2 | ||
|
|
ad7b982242 | ||
|
|
48939dfb26 | ||
|
|
7e68013b05 | ||
|
|
869efaad58 | ||
|
|
ac427b98f4 | ||
|
|
56682e32ba | ||
|
|
a5fb467db2 | ||
|
|
9b7dc7f877 | ||
|
|
a930356b04 | ||
|
|
0b6fe45fb9 | ||
|
|
5bc0dfa9dd | ||
|
|
35062abc34 | ||
|
|
743b460e51 | ||
|
|
701b82279d | ||
|
|
8d8ca282a1 | ||
|
|
c9c686369f | ||
|
|
cd56eaaba2 | ||
|
|
9905aa5c6f | ||
|
|
e92938364d | ||
|
|
6d4e1d333f | ||
|
|
1c4614318e | ||
|
|
e354670c36 | ||
|
|
0f5cda4169 | ||
|
|
d4897abb53 | ||
|
|
d87c9fd242 | ||
|
|
529f050a56 | ||
|
|
fce21607bd | ||
|
|
5470977941 | ||
|
|
3dc285be8c | ||
|
|
3e3b2d0b29 | ||
|
|
79bbce3db3 | ||
|
|
f76f179907 | ||
|
|
dfd95b2615 | ||
|
|
50732226c4 | ||
|
|
ab0869c972 | ||
|
|
0acf11ff70 | ||
|
|
9ac0539ffd | ||
|
|
bc86dcec9b | ||
|
|
cb4deb0c20 | ||
|
|
e901bb8d06 | ||
|
|
6b90b61358 | ||
|
|
63a1edc0de | ||
|
|
ed1ee4c3a4 | ||
|
|
e7c387b49b | ||
|
|
7f3ea8dbd8 | ||
|
|
07042cdcca | ||
|
|
12b055989b | ||
|
|
c034da1d0d | ||
|
|
49056b5060 | ||
|
|
03f5eca54c | ||
|
|
c530995832 | ||
|
|
4f9f088e40 | ||
|
|
60d81a73d9 | ||
|
|
c387601c27 | ||
|
|
e9c46cc359 | ||
|
|
a8a4467bc3 | ||
|
|
9110851af3 | ||
|
|
47392e55a2 | ||
|
|
107f92381b | ||
|
|
e2ba72e7c1 | ||
|
|
f84129ca79 | ||
|
|
6f00a94eb9 | ||
|
|
44fafcef73 | ||
|
|
3a33affe43 | ||
|
|
a5e09fcd43 | ||
|
|
0d7f40e60d | ||
|
|
387b42c9c2 | ||
|
|
99466af6b7 | ||
|
|
044eb728cb | ||
|
|
14bec14972 | ||
|
|
2be8a45f14 | ||
|
|
56518e827e | ||
|
|
1336987756 | ||
|
|
51d9ff9812 | ||
|
|
e3473d3de0 | ||
|
|
958799e85e | ||
|
|
bba92146b1 | ||
|
|
ce778e569b | ||
|
|
48f84b31d6 | ||
|
|
dd489ab415 | ||
|
|
1c846df903 | ||
|
|
9a66482483 | ||
|
|
0bd98a300f | ||
|
|
52e4ddbb86 | ||
|
|
87eaf3ce6e | ||
|
|
5c8b07acfe | ||
|
|
239e6ec701 | ||
|
|
bc029ca5fe | ||
|
|
5be1887f92 | ||
|
|
d373f57e57 | ||
|
|
65264afdf9 | ||
|
|
158f246d1d | ||
|
|
fecdbf20de | ||
|
|
6fdd08ac2d | ||
|
|
1f03080540 | ||
|
|
bde9463a22 | ||
|
|
737162e75a | ||
|
|
ce28df923d | ||
|
|
51ce402dbb | ||
|
|
41c530ac8f | ||
|
|
8b404b5a4c | ||
|
|
2ec0977115 | ||
|
|
7a212f7c7b | ||
|
|
3ce94d50dd | ||
|
|
43823da9cd | ||
|
|
29d56fca9c | ||
|
|
a2c9fdd7b6 | ||
|
|
ab18010ee1 | ||
|
|
e3e6e9067c | ||
|
|
e69c202c79 | ||
|
|
2b732cef16 | ||
|
|
0a812f2a46 | ||
|
|
e923f63606 | ||
|
|
fffe9fc566 | ||
|
|
53f0e142e5 | ||
|
|
6fdf27a701 | ||
|
|
0b68c1d276 | ||
|
|
7fa7d4f0a9 | ||
|
|
21bff4ba42 | ||
|
|
f511ebc1d4 | ||
|
|
cb89991fe1 | ||
|
|
84bbdc2eba | ||
|
|
2453747018 | ||
|
|
568612fc70 | ||
|
|
59314bbce4 | ||
|
|
d78828fd81 | ||
|
|
2cc7894a0d | ||
|
|
f56d9ab945 | ||
|
|
4637874b3c | ||
|
|
86fabd6a22 | ||
|
|
9f7368a4dc | ||
|
|
24a1e7cee4 | ||
|
|
83e0a8bc48 | ||
|
|
223dd8bb1a | ||
|
|
0f5810c43c | ||
|
|
68448de7d0 | ||
|
|
4eb91d69fe | ||
|
|
1ebff74c21 | ||
|
|
b1800571e7 | ||
|
|
f0cd3422c1 | ||
|
|
671c49ca6f | ||
|
|
e385a98ced | ||
|
|
b651ac4f39 | ||
|
|
670f32baee | ||
|
|
0f38dbba4c | ||
|
|
92beba066b | ||
|
|
86289d667c | ||
|
|
24a85e7773 | ||
|
|
04e8a7a5f4 | ||
|
|
2747a00ba2 | ||
|
|
063d20d221 | ||
|
|
48e76038d0 | ||
|
|
5f8a7d96b4 | ||
|
|
6421252d44 | ||
|
|
d1b303bf90 | ||
|
|
216c4c8bd4 | ||
|
|
61c33e6db4 | ||
|
|
5841d410a1 | ||
|
|
764232eff0 | ||
|
|
63c8207d7a | ||
|
|
0082297e92 | ||
|
|
5f9f095c7b | ||
|
|
edeb84ecc3 | ||
|
|
19097906a2 | ||
|
|
2f95050c27 | ||
|
|
e7a31d7a4c | ||
|
|
378d03f4fe | ||
|
|
54ed58499d | ||
|
|
841a0fc469 | ||
|
|
b1bdc18c85 | ||
|
|
f514e4a39f | ||
|
|
a38030cc0b | ||
|
|
123b31b48a | ||
|
|
4626aa2cb0 | ||
|
|
9232171ec6 | ||
|
|
5a40b673a4 | ||
|
|
712f7b3ced | ||
|
|
541f63fee4 | ||
|
|
21fe1ba677 | ||
|
|
5de6f4a14f | ||
|
|
8179612f4d | ||
|
|
5658830077 | ||
|
|
ef000b332b | ||
|
|
0e50edc009 | ||
|
|
cc7e1c1b95 | ||
|
|
444f454810 | ||
|
|
010cc83eb9 | ||
|
|
d0e1fd6c7e | ||
|
|
8ab0a78d7a | ||
|
|
17b4d1e010 | ||
|
|
a3b3955f1c | ||
|
|
06791470c9 | ||
|
|
93d1cfe6e0 | ||
|
|
ef14c8ca0e | ||
|
|
eb4cacec06 | ||
|
|
36dc883c7c | ||
|
|
e331ae8a92 | ||
|
|
6557bd7029 | ||
|
|
869528acba | ||
|
|
41b30c91d9 | ||
|
|
ea50eea398 | ||
|
|
0f767d5ce1 | ||
|
|
0aa52d57c7 | ||
|
|
328a6de797 | ||
|
|
82648278eb | ||
|
|
886be6414d | ||
|
|
1c1407797a | ||
|
|
9362d3cab3 | ||
|
|
e131f857bd | ||
|
|
ced2e39dbf | ||
|
|
342df44427 | ||
|
|
2159d8877b | ||
|
|
3180efe42c | ||
|
|
cb7dba3eff | ||
|
|
6775c029df | ||
|
|
d9d7f7880d | ||
|
|
a4265930dd | ||
|
|
a031aaf2c0 | ||
|
|
adeb572e8d | ||
|
|
4bca951773 | ||
|
|
e55c0679dc | ||
|
|
140735dbde | ||
|
|
82d4e87dd6 | ||
|
|
714a68bba1 | ||
|
|
3fad8858bb | ||
|
|
13c826bfa3 | ||
|
|
c1ced4d495 | ||
|
|
650e57feff | ||
|
|
d2d4e13af7 | ||
|
|
573c6179ab | ||
|
|
c525437256 | ||
|
|
510bf05e36 | ||
|
|
67ed3c0fd9 | ||
|
|
ae852e0be4 | ||
|
|
475dc17c8a | ||
|
|
1955002ed8 | ||
|
|
d25b749d82 | ||
|
|
44559fb7b9 | ||
|
|
2c6aa1f52b | ||
|
|
0977c5cf73 | ||
|
|
341e2c7d65 | ||
|
|
07697bf931 | ||
|
|
f0292d30ef | ||
|
|
5d1d1a1456 | ||
|
|
8df94f091f | ||
|
|
146383499e | ||
|
|
709cdc1f95 | ||
|
|
e81a76fdf9 | ||
|
|
c368dbf1c2 | ||
|
|
de13137418 | ||
|
|
71089ea924 | ||
|
|
e42b818c2a | ||
|
|
1df4962468 | ||
|
|
fcde0c94e0 | ||
|
|
112d37b80e | ||
|
|
1af83e997d | ||
|
|
5158296b2f | ||
|
|
59ee7be72a | ||
|
|
f419d0ce5e | ||
|
|
c331ee3d5c | ||
|
|
80b68baf95 | ||
|
|
36babe4bef | ||
|
|
412aeda674 | ||
|
|
c5f2cea802 | ||
|
|
383105167b | ||
|
|
8a200bf913 | ||
|
|
fad41589ce | ||
|
|
f16468e74f | ||
|
|
f707dcf194 | ||
|
|
79c0b9f51d | ||
|
|
bce6af069f | ||
|
|
f98a3a4f65 | ||
|
|
979b6df8d2 | ||
|
|
b14cecaeb2 | ||
|
|
45387f3231 | ||
|
|
2594745ef8 | ||
|
|
38c5d92a0c | ||
|
|
cc3041322e | ||
|
|
8507461549 | ||
|
|
f352f84483 | ||
|
|
1edac3cfff | ||
|
|
cbf48e9b8c | ||
|
|
40c3c7f506 | ||
|
|
0ef7e8eca2 | ||
|
|
6f8d04d609 | ||
|
|
1a18e43a88 | ||
|
|
412fa4cfbc | ||
|
|
6849288d6d | ||
|
|
5a401ea2bf | ||
|
|
2edfed7d91 | ||
|
|
3b96bed864 | ||
|
|
30c069f5b7 | ||
|
|
b2cc54fb87 | ||
|
|
649163cb7b | ||
|
|
556d908d5d | ||
|
|
980e96250b | ||
|
|
a6189c56c6 | ||
|
|
963bc4b647 | ||
|
|
2efdd4dd7c | ||
|
|
031f25c1c1 | ||
|
|
51b085c94e | ||
|
|
b40f642fa4 | ||
|
|
93c0fb6067 | ||
|
|
22782ca6fc | ||
|
|
746d07de91 | ||
|
|
1468d83895 | ||
|
|
ed5fc07493 | ||
|
|
97f0dc8a60 | ||
|
|
26636843af | ||
|
|
ee02532ab5 | ||
|
|
c2946c80d3 | ||
|
|
f1dd0dba78 | ||
|
|
40b5c137f1 | ||
|
|
f4ed684146 | ||
|
|
465b481c7b | ||
|
|
83f02d0bfb | ||
|
|
d2178180e0 | ||
|
|
52fa5f20a3 | ||
|
|
63621cdc3f | ||
|
|
f462ce5615 | ||
|
|
831e92816e | ||
|
|
cef3e538ba | ||
|
|
2d70ad3562 | ||
|
|
acda4ce985 | ||
|
|
98a8acf3ce | ||
|
|
354ece2bdf | ||
|
|
1ebc3a2d10 | ||
|
|
b2c1eb1e48 | ||
|
|
bc03fb71d8 | ||
|
|
de10bb00a9 | ||
|
|
c06b212363 | ||
|
|
fdc181106d | ||
|
|
0220470306 | ||
|
|
8752b631bd | ||
|
|
8d5f1ad310 | ||
|
|
378e39f70c | ||
|
|
030a789870 | ||
|
|
043a2e7a07 | ||
|
|
f8e13d566e | ||
|
|
7e190e92ca | ||
|
|
80e3b65a15 | ||
|
|
5eb318ba06 | ||
|
|
8665813933 | ||
|
|
4a209f1afb | ||
|
|
1510745643 | ||
|
|
c0ac3c748c | ||
|
|
409bb52d35 | ||
|
|
a65d3e040a | ||
|
|
e65b4b05ec | ||
|
|
2358efe44a | ||
|
|
90d5440bb2 | ||
|
|
09d3b8f2c2 | ||
|
|
7b8d7d7594 | ||
|
|
531de77124 | ||
|
|
bc7e9e46de | ||
|
|
44981fd803 | ||
|
|
ebcd8e084e | ||
|
|
4fb5ac292b | ||
|
|
b56091e824 | ||
|
|
0e23a3d7c2 | ||
|
|
06eed71c66 | ||
|
|
76ee64ae50 | ||
|
|
ebaf145348 | ||
|
|
e1dbcccab5 | ||
|
|
00dbe21d73 | ||
|
|
fba802effd | ||
|
|
7b301c1a82 | ||
|
|
9495b56772 | ||
|
|
d8ffe9b3ab | ||
|
|
a8434b176f | ||
|
|
52492674e0 | ||
|
|
ef0004400d | ||
|
|
5b5ee6ed5b | ||
|
|
0a63049845 | ||
|
|
a05d94c929 | ||
|
|
2dcb86941f | ||
|
|
332112c91e | ||
|
|
5c6eb89cfb | ||
|
|
3e5c1b59dd | ||
|
|
5b92eeb3bf | ||
|
|
7b27daa937 | ||
|
|
3518ce083b | ||
|
|
1241a97aaf | ||
|
|
f13c54afc1 | ||
|
|
8afe9f4428 | ||
|
|
3388efe65a | ||
|
|
6218458eb7 | ||
|
|
a11384b286 | ||
|
|
0b3303f07e | ||
|
|
9dd9fb27cd | ||
|
|
fcfcf58415 | ||
|
|
0f2035149c | ||
|
|
3ba66585a9 | ||
|
|
cba364204a | ||
|
|
8aeac32286 | ||
|
|
4e17788549 | ||
|
|
f06546d080 | ||
|
|
18a6719893 | ||
|
|
eb541dccc7 | ||
|
|
687343f6ca | ||
|
|
39b3a2e02b | ||
|
|
e061538c30 | ||
|
|
ece48905f4 | ||
|
|
a6375c7530 | ||
|
|
4f1a0db7af | ||
|
|
45fa18a2e3 | ||
|
|
d5a71667d0 | ||
|
|
534cccce91 | ||
|
|
d64f844eb2 | ||
|
|
72dbcd3ad4 | ||
|
|
b64231debe | ||
|
|
5533094984 | ||
|
|
d7102fd32c | ||
|
|
e5f5a19ce1 | ||
|
|
7bd0b48a35 | ||
|
|
a5c5671549 | ||
|
|
d78f2793a0 | ||
|
|
5e13281992 | ||
|
|
ae2ecd6002 | ||
|
|
c93fb1b456 | ||
|
|
0098a2adc5 | ||
|
|
c9064a4d34 | ||
|
|
c0dd4a3f07 | ||
|
|
699d1b373a | ||
|
|
497ddb5829 | ||
|
|
18e4416c33 | ||
|
|
811ff93549 | ||
|
|
5066bd2114 | ||
|
|
96df69bcdc | ||
|
|
b2dd53e1b8 | ||
|
|
6cfa2b8b86 | ||
|
|
b84cce3096 | ||
|
|
eea1e701b7 | ||
|
|
427804fe30 | ||
|
|
455e5de74d | ||
|
|
76f7c003ca | ||
|
|
9533031891 | ||
|
|
1392d94665 | ||
|
|
80f8ea6849 | ||
|
|
c8e2daf345 | ||
|
|
50eadb00c7 | ||
|
|
6e728ab8c1 | ||
|
|
d4012bd0b2 | ||
|
|
97e36cb5d6 | ||
|
|
a902e9f9f6 | ||
|
|
a0a21b1266 | ||
|
|
da3ba573d8 | ||
|
|
9b5ead72c5 | ||
|
|
bea9048cfe | ||
|
|
1e706ff991 | ||
|
|
fc0f5ed83a | ||
|
|
4bea484458 | ||
|
|
c0588c30d7 | ||
|
|
6806d5d436 | ||
|
|
24c940c51c | ||
|
|
56e94d454f | ||
|
|
407ee08d8a | ||
|
|
2a615c8680 | ||
|
|
756585fb2a | ||
|
|
b21e83d8e7 | ||
|
|
5662784afb | ||
|
|
74170e679b | ||
|
|
3801901726 | ||
|
|
da7b65381d | ||
|
|
7d58174f1f | ||
|
|
ebdae18a7e | ||
|
|
d339f85087 | ||
|
|
4e4e7d766f | ||
|
|
b6a114f7f4 | ||
|
|
8dd9c55c1e | ||
|
|
e586ef070e | ||
|
|
4a99f7f088 | ||
|
|
71a76e9ecb | ||
|
|
2cad6c2772 | ||
|
|
1d66474022 | ||
|
|
40e1e2c3c8 | ||
|
|
3934e53476 | ||
|
|
f8f282633b | ||
|
|
0146fbfc40 | ||
|
|
ca912aa72f | ||
|
|
6ee3117755 | ||
|
|
167547f95f | ||
|
|
e2440a569e | ||
|
|
873ab4b085 | ||
|
|
7a1eee78df | ||
|
|
09568f9d65 | ||
|
|
e3c8c0705f | ||
|
|
3be37ed5b9 | ||
|
|
886d427337 | ||
|
|
c7a2e47449 | ||
|
|
d5432b4c27 | ||
|
|
bbe9b423c4 | ||
|
|
42064fe7ec | ||
|
|
c291df6383 | ||
|
|
7cee76f9a6 | ||
|
|
5cc728747a | ||
|
|
ed5b2f2997 | ||
|
|
886f7c8253 | ||
|
|
3b480de38a | ||
|
|
6a244312ed | ||
|
|
f990630ccc | ||
|
|
7cd0117b3c | ||
|
|
d33614d6a0 | ||
|
|
4603cd3fec | ||
|
|
b3866bcea0 | ||
|
|
d03bb80f9f | ||
|
|
26ec73c71b | ||
|
|
1df8a26c5b | ||
|
|
c3403c5413 | ||
|
|
f1143269bb | ||
|
|
3b6ddcae37 | ||
|
|
96e5697d23 | ||
|
|
dbdcce20a8 | ||
|
|
7f583a3508 | ||
|
|
e7ef1b2368 | ||
|
|
c0713fddb5 | ||
|
|
ce32d1c2c3 | ||
|
|
3ee134a6ec | ||
|
|
596b66f397 | ||
|
|
a6e57e7a7a | ||
|
|
d4fd43cf6f | ||
|
|
431f2b35f1 | ||
|
|
6c377f16e7 | ||
|
|
a296b1da3f | ||
|
|
349db7baec | ||
|
|
df2a908b6b | ||
|
|
1f3097da00 | ||
|
|
8444ac0579 | ||
|
|
0b4b5e6f0f | ||
|
|
80d3e7dd99 | ||
|
|
245273e6c1 | ||
|
|
97994a4aef | ||
|
|
54a0004de6 | ||
|
|
b0a448fa0e | ||
|
|
6a211f6ed6 | ||
|
|
4f83e98736 | ||
|
|
aadb44ebd6 | ||
|
|
5a1f0ea281 | ||
|
|
9b0db6ab15 | ||
|
|
2082e1e0fc | ||
|
|
5b363c347f | ||
|
|
a89aac4c67 | ||
|
|
cdea3f63d4 | ||
|
|
39ef5ddde0 | ||
|
|
40a6260f6e | ||
|
|
7e86c9af95 | ||
|
|
a5e47f4e0f | ||
|
|
e8d50fe5b9 | ||
|
|
ac7bc587cb | ||
|
|
a5f84c2977 | ||
|
|
4e11a3585a | ||
|
|
8fb559781c | ||
|
|
63d3e9f6e5 | ||
|
|
2bf5ca0c86 | ||
|
|
d115e36ed8 | ||
|
|
32b2b1060c | ||
|
|
af56b1a950 | ||
|
|
35242d198b | ||
|
|
f9999a76fe | ||
|
|
2ea485bbe0 | ||
|
|
42eb3841a1 | ||
|
|
96f078e252 | ||
|
|
fb622ccbdf | ||
|
|
ee3e62bfa4 | ||
|
|
d2dc3ddf72 | ||
|
|
076ed3c69a | ||
|
|
e8499452f8 | ||
|
|
7fcff6731d | ||
|
|
e0a6b31c03 | ||
|
|
f781598540 | ||
|
|
7c923209ad | ||
|
|
275ec18c5c | ||
|
|
bca2bd2fa1 | ||
|
|
6066201331 | ||
|
|
fa99ca2757 | ||
|
|
e41fdfe58a | ||
|
|
7073f2a272 | ||
|
|
48e643886c | ||
|
|
390e30ae7b | ||
|
|
db26a9cc5f | ||
|
|
23cf8c49e0 | ||
|
|
cb56bdbfef | ||
|
|
b17a024f6c | ||
|
|
38169d2f5e | ||
|
|
1ed21085bb | ||
|
|
28ccc3e5da | ||
|
|
56409ff269 | ||
|
|
fe2239266a | ||
|
|
0c523980ff | ||
|
|
f11a17ebd1 | ||
|
|
32873d06bc | ||
|
|
e2916fd9c5 | ||
|
|
4accaccf77 | ||
|
|
e9e6efcdde | ||
|
|
ff416aacaf | ||
|
|
6cae3e54d1 | ||
|
|
b97947e8ac | ||
|
|
fffada5666 | ||
|
|
dfcd9fb8c3 | ||
|
|
4c4b86dd3a | ||
|
|
803811568e | ||
|
|
5bf2965a2a | ||
|
|
50b0bd5c39 | ||
|
|
30717367ee | ||
|
|
2d02b2b1cf | ||
|
|
9a6de83dc5 | ||
|
|
456fbecf16 | ||
|
|
854ce0d574 | ||
|
|
668923c392 | ||
|
|
092c2919d8 | ||
|
|
c51e9cbe06 | ||
|
|
ec535f3580 | ||
|
|
60b451e6cf | ||
|
|
bf04873287 | ||
|
|
3e35390d8f | ||
|
|
7063ef8e57 | ||
|
|
f2dad289fb | ||
|
|
8d36c53e48 | ||
|
|
b4a8fa59f5 | ||
|
|
ffd7ba5ecf | ||
|
|
73de2a7d07 | ||
|
|
fdaffeb6f5 | ||
|
|
1699a7ce33 | ||
|
|
26c2b696a9 | ||
|
|
7743c6e881 | ||
|
|
2a623c4b2f | ||
|
|
9a5f69f435 | ||
|
|
1345ed2ff2 | ||
|
|
5c4211e849 | ||
|
|
29d355597f | ||
|
|
c1189e2a7b | ||
|
|
d43d3773be | ||
|
|
f18889369f | ||
|
|
17a60406fc | ||
|
|
91c7b638e8 | ||
|
|
71322d2b4c | ||
|
|
6f793a0273 | ||
|
|
14d96bb327 | ||
|
|
0f6c417c3c | ||
|
|
c706aab473 | ||
|
|
c830e9a634 | ||
|
|
473639bca4 | ||
|
|
e809623ec9 | ||
|
|
5dd419904d | ||
|
|
061276902b | ||
|
|
e22bf653a4 | ||
|
|
fa6f7d396e | ||
|
|
94ba4dc49b | ||
|
|
23666a9230 | ||
|
|
a5db391fcf | ||
|
|
17576e9f66 | ||
|
|
3d55cef5f2 | ||
|
|
90ec9c8bcb | ||
|
|
2afbe96ea0 | ||
|
|
988ac62a1b | ||
|
|
f75ade1991 | ||
|
|
3016338e34 | ||
|
|
56dca9397f | ||
|
|
bc35aca017 | ||
|
|
e947adf743 | ||
|
|
281d52a1ea | ||
|
|
15d412d9e5 | ||
|
|
b8502759b5 | ||
|
|
73ccb567a6 | ||
|
|
3f97424224 | ||
|
|
8cafca9315 | ||
|
|
6f804adf39 | ||
|
|
a1c1bdd14b | ||
|
|
36db31c55a | ||
|
|
cff837bc7b | ||
|
|
4dbbf59c82 | ||
|
|
5f6bdefddf | ||
|
|
832eb4458d | ||
|
|
9e9566b364 | ||
|
|
2cf989d306 | ||
|
|
e19aa69688 | ||
|
|
7d3ee29bd0 | ||
|
|
a6315e5313 | ||
|
|
cba0e46aba | ||
|
|
54b373a73e | ||
|
|
31f53dd168 | ||
|
|
9b8ab3e61e | ||
|
|
44b478b005 | ||
|
|
47f18e823a | ||
|
|
509754f24e | ||
|
|
2d1b824b62 | ||
|
|
f842e3f34c | ||
|
|
2105f52fb3 | ||
|
|
9f3acf497b | ||
|
|
fd0f5c50fb | ||
|
|
a7f236a8e5 | ||
|
|
3a264698e2 | ||
|
|
d9468a6fda | ||
|
|
221eeff09d | ||
|
|
7fce83332a | ||
|
|
60eb787dcf | ||
|
|
d511698f3f | ||
|
|
44cf0503df | ||
|
|
cb435ea232 | ||
|
|
1214785d12 | ||
|
|
53f7276874 | ||
|
|
6e756dedc7 | ||
|
|
3d8c74efa4 | ||
|
|
db5da47a9d | ||
|
|
b5f62b2e9c | ||
|
|
43a9016c83 | ||
|
|
4771b63da9 | ||
|
|
255068fd40 | ||
|
|
3724b53a89 | ||
|
|
098a00b025 | ||
|
|
a1658c603e | ||
|
|
dba0b5276b | ||
|
|
5f40bcabb6 | ||
|
|
78ae935468 | ||
|
|
0356fc26c9 | ||
|
|
3ea5f76470 | ||
|
|
f5913160d9 | ||
|
|
b4d294c05e | ||
|
|
dfc6fce8bb | ||
|
|
756acc77e9 | ||
|
|
e1c4e30f82 | ||
|
|
83cf5f5c6a | ||
|
|
2e9dae5ff4 | ||
|
|
e7b3a8eebe | ||
|
|
9e96ccc23e | ||
|
|
ee3a42a67e | ||
|
|
fef4496d38 | ||
|
|
50227c0f5f | ||
|
|
ccf46f62d1 | ||
|
|
234481b476 | ||
|
|
23541b235e | ||
|
|
ce1a4f05a5 | ||
|
|
70f05dcee9 | ||
|
|
84f87997bf | ||
|
|
d6b0585cf9 | ||
|
|
f46d6d7cce | ||
|
|
255d839aa9 | ||
|
|
e4359b29ca | ||
|
|
7835e6cfd1 | ||
|
|
32d76d0cd0 | ||
|
|
0d55da50cd | ||
|
|
411d0e19ce | ||
|
|
678d6c7b39 | ||
|
|
9405545311 | ||
|
|
af06ffdd7e | ||
|
|
14e58a501d | ||
|
|
7208efe294 | ||
|
|
1b2ee441c4 | ||
|
|
d7b90cfc3f | ||
|
|
324c487233 | ||
|
|
b68fd589bc | ||
|
|
12fa01a3ea | ||
|
|
c79ec0fa57 | ||
|
|
f2ae73bbb2 | ||
|
|
389f5e3911 | ||
|
|
dca0703ef8 | ||
|
|
5a479211cd | ||
|
|
a43bc2fa93 | ||
|
|
ca56ee6c43 | ||
|
|
f824386ae8 | ||
|
|
9f056a0241 | ||
|
|
5e0d0e57f2 | ||
|
|
c107dd847b | ||
|
|
93502ceb3c | ||
|
|
b196dd3138 | ||
|
|
c77dfb3b83 | ||
|
|
e8c1e4802b | ||
|
|
56572a559e | ||
|
|
771d2e71e0 | ||
|
|
db23cbd4e5 | ||
|
|
d750f7d5c4 | ||
|
|
69b51f39c3 | ||
|
|
70ea6fde44 | ||
|
|
72b37deea7 | ||
|
|
ba6819e46e | ||
|
|
b56a752547 | ||
|
|
272c2692e3 | ||
|
|
b7c20fd165 | ||
|
|
fae0d23e78 | ||
|
|
f1ad70298f | ||
|
|
aa930c370d | ||
|
|
7afbd78b09 | ||
|
|
0b08d4ce31 | ||
|
|
68fffff4fb | ||
|
|
63db823f16 | ||
|
|
89f1bd0ed6 | ||
|
|
7434b29f67 | ||
|
|
3cda63fa63 | ||
|
|
e7b86e990b | ||
|
|
bce8e1c50b | ||
|
|
523e1fd243 | ||
|
|
c0a42cc44f | ||
|
|
a1b2551a6f | ||
|
|
748e668b06 | ||
|
|
b07b30ab86 | ||
|
|
d9bcff7756 | ||
|
|
9de9796f58 | ||
|
|
cc1667f1af | ||
|
|
e2c15ef566 | ||
|
|
a7baf91fec | ||
|
|
c90b26c630 | ||
|
|
646251d081 | ||
|
|
d00c1a97df | ||
|
|
6de7964724 | ||
|
|
b551a4cfec | ||
|
|
caabaf8e80 | ||
|
|
3ca89b4f9c | ||
|
|
0610110de4 | ||
|
|
4a22325fc7 | ||
|
|
8edd4f4659 | ||
|
|
5483aa5a4a | ||
|
|
606a417395 | ||
|
|
318cf7d960 | ||
|
|
1630c5d727 | ||
|
|
d387a151a1 | ||
|
|
0042ce94f3 | ||
|
|
9915503aa3 | ||
|
|
21d2c78cdc | ||
|
|
3802f283a1 | ||
|
|
8464df9f98 | ||
|
|
5d5f899dea | ||
|
|
0ecad863c5 | ||
|
|
50fd1537df | ||
|
|
6b39dbfe48 | ||
|
|
50ac369cf5 | ||
|
|
a14c49cd03 | ||
|
|
b904d0eaab | ||
|
|
eba7eb9e76 | ||
|
|
6b694592a3 | ||
|
|
d8114de66b | ||
|
|
602180e5fd | ||
|
|
b99105507a | ||
|
|
01fd27a532 | ||
|
|
eef8802310 | ||
|
|
a504b918f5 | ||
|
|
b79bc2d350 | ||
|
|
4c9cd3303c | ||
|
|
8a7e2e46f9 | ||
|
|
b82bf16ebe | ||
|
|
3bc90eef10 | ||
|
|
81f01eddcb | ||
|
|
600dbac148 | ||
|
|
68f408c7d7 | ||
|
|
a683de96c6 | ||
|
|
695b9ad568 | ||
|
|
ec18305131 | ||
|
|
1999f13099 | ||
|
|
92b6af35d7 | ||
|
|
a36ea57a60 | ||
|
|
8531a94332 | ||
|
|
ac373b39ad | ||
|
|
73a8a35863 | ||
|
|
b06bd82c47 | ||
|
|
8dff0f30b9 | ||
|
|
b3aeb208a7 | ||
|
|
f9b2336887 | ||
|
|
15ae875478 | ||
|
|
8b9d1cc626 | ||
|
|
1410a4b977 | ||
|
|
b25ef0762f | ||
|
|
a3b1231342 | ||
|
|
20cbf59784 | ||
|
|
a8a9f7d476 | ||
|
|
00d23d275d | ||
|
|
070ad551c3 | ||
|
|
9cc94823e3 | ||
|
|
44d5411d5f | ||
|
|
c9804d8b81 | ||
|
|
0e227f4f22 | ||
|
|
9dcabfd266 | ||
|
|
dc82247c13 | ||
|
|
dbffc1982e | ||
|
|
7861e43995 | ||
|
|
3eee2a4c04 | ||
|
|
8980214050 | ||
|
|
1a687a6d63 | ||
|
|
fbfefedd1f | ||
|
|
02dd8fe927 | ||
|
|
25d261df35 | ||
|
|
c493cc521f | ||
|
|
cc924c1a60 | ||
|
|
9d524aa6a1 | ||
|
|
3e29566610 | ||
|
|
31e8545d00 | ||
|
|
078de6c0fe | ||
|
|
d0020aa219 | ||
|
|
e9e99cd7bd | ||
|
|
ecb69d41bc | ||
|
|
0c993f6f0c | ||
|
|
8513463170 | ||
|
|
725080267d | ||
|
|
2eeb79f064 | ||
|
|
4eeeb9a78a | ||
|
|
1a91743254 | ||
|
|
cd566cb2d5 | ||
|
|
43c826a485 | ||
|
|
2668c7ca96 | ||
|
|
4c181a7d8f | ||
|
|
4b303786e0 | ||
|
|
10f4309028 | ||
|
|
4de51d492f | ||
|
|
4c6348aae0 | ||
|
|
5b79a3c932 | ||
|
|
6aed49f74c | ||
|
|
1d501df44a | ||
|
|
30310741bc | ||
|
|
7263c21d2f | ||
|
|
93eaa3e8d6 | ||
|
|
a28af98856 | ||
|
|
d47b763c4f | ||
|
|
3d995cee1e | ||
|
|
410ac75f46 | ||
|
|
9ea0ddc606 | ||
|
|
3ea6560d6a | ||
|
|
d824b4d0c0 | ||
|
|
4242bb39a3 | ||
|
|
eb1080139f | ||
|
|
9ef06077f3 | ||
|
|
d5d797ace1 | ||
|
|
5c6d38308a | ||
|
|
2168c5e5a8 | ||
|
|
13a9113f01 | ||
|
|
2e325fa663 | ||
|
|
0c08ed087c | ||
|
|
a11949b743 | ||
|
|
ec66c58bd4 | ||
|
|
3e1ffd87f7 | ||
|
|
95f2093abf | ||
|
|
40a7e6da9f | ||
|
|
8dfa69971b | ||
|
|
7d2e434a55 | ||
|
|
207d7a8d1b | ||
|
|
fe9289aac2 | ||
|
|
def8ae47e7 | ||
|
|
15a833d125 | ||
|
|
6994c4d9a9 | ||
|
|
5e6330c251 | ||
|
|
b2b9773be8 | ||
|
|
4d144f3402 | ||
|
|
9acff8353b | ||
|
|
9b827aaf40 | ||
|
|
2c1d1fa06d | ||
|
|
c1782c4550 | ||
|
|
0489b2b12b | ||
|
|
a64696d3f5 | ||
|
|
b02293f2b7 | ||
|
|
13fdff655f | ||
|
|
f978632b0a | ||
|
|
8b1bb90ded | ||
|
|
a5a47644de | ||
|
|
2003922509 | ||
|
|
74745c7995 | ||
|
|
6f783e4be4 | ||
|
|
9b43f6d957 | ||
|
|
8a537a1938 | ||
|
|
d5ed823bc5 | ||
|
|
5290b82e20 | ||
|
|
d1d42e21fe | ||
|
|
847df5d005 | ||
|
|
f78d470443 | ||
|
|
c0e9171d61 | ||
|
|
687ca9b732 | ||
|
|
0e6f76981d | ||
|
|
5ec09c7eb5 | ||
|
|
bbe92562c6 | ||
|
|
032201ae15 | ||
|
|
a454ae6cc3 | ||
|
|
0f3bd657d9 | ||
|
|
e468f58d27 | ||
|
|
976cc41a04 | ||
|
|
e308e8f690 | ||
|
|
6d1e1cce68 | ||
|
|
1ed7a65a13 | ||
|
|
c1cb25bcb1 | ||
|
|
f0efa9b0ab | ||
|
|
fea3d62dc9 | ||
|
|
7db66b492f | ||
|
|
4dc07ac374 | ||
|
|
6336e7d51c | ||
|
|
1479662a03 | ||
|
|
2dc02a7658 | ||
|
|
65d0dc6f52 | ||
|
|
c7f8c32a2c | ||
|
|
1999415d2a | ||
|
|
b4e30313a1 | ||
|
|
ba9fffa170 | ||
|
|
db564008db | ||
|
|
19ec24faaf | ||
|
|
8c5d7d8ad7 | ||
|
|
a3b8d1b041 | ||
|
|
625696c082 | ||
|
|
28c8fa264f | ||
|
|
682be19830 | ||
|
|
849a320268 | ||
|
|
f463141abd | ||
|
|
ad260da271 | ||
|
|
bc04597fb1 | ||
|
|
b9748532a1 | ||
|
|
c073bd923e | ||
|
|
92ea482404 | ||
|
|
628c987c7d | ||
|
|
a67be12ba8 | ||
|
|
7bf3ceb7fb | ||
|
|
642e39a52e | ||
|
|
5feaa93e89 | ||
|
|
f3f5156024 | ||
|
|
e55a721069 | ||
|
|
ce5eec53cb | ||
|
|
e7433fe893 | ||
|
|
b7998466c2 | ||
|
|
4aa16a3805 | ||
|
|
8a644139bb | ||
|
|
014fdd51f8 | ||
|
|
6dedc0dce4 | ||
|
|
5b08a59229 | ||
|
|
cbe590c9fc | ||
|
|
f80116a37a | ||
|
|
f06799e09b | ||
|
|
d968808db3 | ||
|
|
bfe014d102 | ||
|
|
fa8bf5082f | ||
|
|
a4620c048a | ||
|
|
926c65333f | ||
|
|
60104eaf7a | ||
|
|
42854a26d5 | ||
|
|
5cf477af6f | ||
|
|
3c17e69101 | ||
|
|
c7fd8c66bb | ||
|
|
665e4fd0db | ||
|
|
41d927b3b1 | ||
|
|
9dec4c80c0 | ||
|
|
2846ff6fac | ||
|
|
45200ddefd | ||
|
|
24aa28752f | ||
|
|
d6d2ddb02a | ||
|
|
a54682d055 | ||
|
|
220d344218 | ||
|
|
be03453d8b | ||
|
|
289ac3f9d9 | ||
|
|
bd8629f046 | ||
|
|
68592914db | ||
|
|
1ba8cc52ef | ||
|
|
524483c6aa | ||
|
|
9f0790379e | ||
|
|
9fa49abf6d | ||
|
|
7c2b4e75b5 | ||
|
|
f7dd206a02 | ||
|
|
c8d8c56f87 | ||
|
|
34a0281915 | ||
|
|
4fb8fc8287 | ||
|
|
0a31a6fc2a | ||
|
|
3a8f95606e | ||
|
|
2ef36d577c | ||
|
|
e72a109c4d | ||
|
|
9be074ee58 | ||
|
|
ce1ad1498b | ||
|
|
16055b1a9a | ||
|
|
c5091d2c4a | ||
|
|
c27da9e91b | ||
|
|
430fa490e2 | ||
|
|
75609e23a5 | ||
|
|
a8c28eff35 | ||
|
|
9c82098284 | ||
|
|
2f3ce4b534 | ||
|
|
3bcf793ef9 | ||
|
|
9b2b63dbd3 | ||
|
|
bd5473d88d | ||
|
|
ed19c93c0d | ||
|
|
275c8fa470 | ||
|
|
297cc5aa29 | ||
|
|
0afadd7623 | ||
|
|
48328c153f | ||
|
|
853ff1afc7 | ||
|
|
af86dac1b0 | ||
|
|
0a338e3d35 | ||
|
|
6d26a08d6e | ||
|
|
5469848246 | ||
|
|
3b756db94b | ||
|
|
6a84618160 | ||
|
|
121928e849 | ||
|
|
123947a2ad | ||
|
|
1b169b0d1d | ||
|
|
6c44bad0fd | ||
|
|
94e89f1568 | ||
|
|
bb20856a6c | ||
|
|
5f20d6371b | ||
|
|
41d5fe8c1a | ||
|
|
d199f20f25 | ||
|
|
e694262025 | ||
|
|
cd758255df | ||
|
|
2fb554c1ae | ||
|
|
ea713c7c34 | ||
|
|
a5896c3215 | ||
|
|
109c84760f | ||
|
|
baa25731f3 | ||
|
|
ad37345884 | ||
|
|
07b24a0b2e | ||
|
|
98551b109b | ||
|
|
52827e9a90 | ||
|
|
15dc38335e | ||
|
|
482a5ebb9d | ||
|
|
3849e3a908 | ||
|
|
2d925511b6 | ||
|
|
0e15fbf6d1 | ||
|
|
2be319ea85 | ||
|
|
f6b04590b4 | ||
|
|
f613f8cc39 | ||
|
|
0dd345d168 | ||
|
|
eb365da910 | ||
|
|
1d84ae9383 | ||
|
|
85ca9718ad | ||
|
|
4634c14516 | ||
|
|
ec7120b762 | ||
|
|
d9b020826a | ||
|
|
c0e5315b68 | ||
|
|
108ccaab98 | ||
|
|
edd0677a4a | ||
|
|
4253a87717 | ||
|
|
045252ffbb | ||
|
|
f06ea8492f | ||
|
|
58d4110e32 | ||
|
|
ec4699fe0b | ||
|
|
6f340e62e7 | ||
|
|
526c3ea51e | ||
|
|
4943979e71 | ||
|
|
35d86c42e1 | ||
|
|
c95893733a | ||
|
|
838197c957 | ||
|
|
10df4bf8c0 | ||
|
|
5b6dd93859 | ||
|
|
5a61ddeb7f | ||
|
|
be36e1795b | ||
|
|
b6081cff65 | ||
|
|
a54a6b6161 | ||
|
|
142f476c83 | ||
|
|
6f845a3e0c | ||
|
|
1c13ae07f5 | ||
|
|
97378806a1 | ||
|
|
fb5a8d09d7 | ||
|
|
0a725e3982 | ||
|
|
a11648d70e | ||
|
|
0f1d4a9264 | ||
|
|
b6644f5f03 | ||
|
|
4575b75391 | ||
|
|
bf90099637 | ||
|
|
2c1e2e6454 | ||
|
|
68bd2b55c4 | ||
|
|
cfae1465d7 | ||
|
|
d9a5fcf568 | ||
|
|
b064aee4d1 | ||
|
|
2dcc6fff6d | ||
|
|
7e736818f0 | ||
|
|
1b150d4b43 | ||
|
|
8913ca7c1b | ||
|
|
1284596ad9 | ||
|
|
412d5b5ac7 | ||
|
|
4910fcd2e5 | ||
|
|
330d3eaf1c | ||
|
|
94fce0ab8a | ||
|
|
4feba5c2dd | ||
|
|
7eb6d528b5 | ||
|
|
dc41a0f6e1 | ||
|
|
f42cc84258 | ||
|
|
5f75bc8c37 | ||
|
|
2e22441a38 | ||
|
|
c643fa0e53 | ||
|
|
852dc00c49 | ||
|
|
3300a65a11 | ||
|
|
f195a6d406 | ||
|
|
b6db44c5c8 | ||
|
|
2431d7818d | ||
|
|
62824e0ab1 | ||
|
|
6f4972d0b1 | ||
|
|
9527b786ea | ||
|
|
d33ccb04ee | ||
|
|
2c0c202462 | ||
|
|
8368be4f16 | ||
|
|
8a4c09e5fe | ||
|
|
90eceea7d9 | ||
|
|
f0ab9311ff | ||
|
|
97969df4fb | ||
|
|
ab6c947b40 | ||
|
|
618e8eb55a | ||
|
|
333bf1fe61 | ||
|
|
ca772c98ab | ||
|
|
1da72e549b | ||
|
|
c9da823192 | ||
|
|
e6017d0699 | ||
|
|
292e75aa0c | ||
|
|
8bafd46fa4 | ||
|
|
6eed5c6c82 | ||
|
|
b181fbd182 | ||
|
|
961a2b0db7 | ||
|
|
c1d9ff4ce1 | ||
|
|
2b87a8050d | ||
|
|
e9b02dbd0e | ||
|
|
00b4112674 | ||
|
|
82f70d19c1 | ||
|
|
d97ea76af8 | ||
|
|
bbe2cf6cb4 | ||
|
|
d689f35902 | ||
|
|
cff8cc1abe | ||
|
|
bf49b1f435 | ||
|
|
d9ce0a9960 | ||
|
|
dcfd80cc19 | ||
|
|
42cce55115 | ||
|
|
dbfe719f2d | ||
|
|
7d6aba5ea6 | ||
|
|
0beebdadad | ||
|
|
f3fa09c3df | ||
|
|
cf9316118c | ||
|
|
57094b2323 | ||
|
|
1a5ed7e151 | ||
|
|
476c373153 | ||
|
|
2b2c68963c | ||
|
|
dfff320763 | ||
|
|
9c62d66cce | ||
|
|
b1e0497e73 | ||
|
|
e64bc1ea54 | ||
|
|
7b6d57c9b4 | ||
|
|
8e6ed75e33 | ||
|
|
aa456a008a | ||
|
|
482fd879c1 | ||
|
|
ccd23aed0f | ||
|
|
a4d717c8d9 | ||
|
|
9ffb1f57cd | ||
|
|
9a246d5950 | ||
|
|
4b5d43d4c2 | ||
|
|
f91575b98d | ||
|
|
a2f5e28b59 | ||
|
|
e4f3c83769 | ||
|
|
95b55f685c | ||
|
|
648ca171ff | ||
|
|
99efc2d191 | ||
|
|
d5d1b98ab4 | ||
|
|
08c146764e | ||
|
|
21114fea85 | ||
|
|
834cd09de0 | ||
|
|
762726d3b1 | ||
|
|
f7674643ef | ||
|
|
7f53201a17 | ||
|
|
b974c713b8 | ||
|
|
2b9897dbb8 | ||
|
|
adc424188c | ||
|
|
5feb71d8dc | ||
|
|
7778f0014d | ||
|
|
217381770c | ||
|
|
c809d20c07 | ||
|
|
1d0558f731 | ||
|
|
5b055062df | ||
|
|
e5e750429a | ||
|
|
b0bd3571c6 | ||
|
|
52c3672368 | ||
|
|
d4d4215219 | ||
|
|
ec194f6e67 | ||
|
|
6d035efb3e | ||
|
|
545a01f5e9 | ||
|
|
5881a56955 | ||
|
|
cc0d17c2ec | ||
|
|
3ab5403947 | ||
|
|
53bbce58c3 | ||
|
|
8b8c501c33 | ||
|
|
39330d2bab | ||
|
|
333a6dca6d | ||
|
|
93fd758295 | ||
|
|
76905fc7da | ||
|
|
561a96fc3f | ||
|
|
b693cbe2bc | ||
|
|
b784b934b0 | ||
|
|
7218389bc0 | ||
|
|
588a455aef | ||
|
|
8b16c1a355 | ||
|
|
f61d289c1b | ||
|
|
a528370036 | ||
|
|
700a8e85ce | ||
|
|
da07ed0942 | ||
|
|
ac331c3322 | ||
|
|
8fece96367 | ||
|
|
07e555dd48 | ||
|
|
50f2311035 | ||
|
|
6d062dc366 | ||
|
|
3a64f099ff | ||
|
|
143af89fc2 | ||
|
|
0a86f2459f | ||
|
|
3bdca84f1b | ||
|
|
859d467b7e | ||
|
|
f3618b9e5f | ||
|
|
ebc00e769e | ||
|
|
5e735ec619 | ||
|
|
33fbbd2697 | ||
|
|
61ba3e7c7a | ||
|
|
626471e41c | ||
|
|
e222f36c11 | ||
|
|
37e7269395 | ||
|
|
d9db5d6aa3 | ||
|
|
3cb0bd950d | ||
|
|
8f8796604b | ||
|
|
2e5aa83801 | ||
|
|
4287a4fd69 | ||
|
|
b492e15541 | ||
|
|
b919564a98 | ||
|
|
4a1f6c7b2a | ||
|
|
d2d65ef556 | ||
|
|
ec07038451 | ||
|
|
4999ce6354 | ||
|
|
c2c7d4382b | ||
|
|
9abd513f17 | ||
|
|
3930ef49e4 | ||
|
|
a587abb585 | ||
|
|
d8aadfbf72 | ||
|
|
548715daec | ||
|
|
3b609245f9 | ||
|
|
60d0d8b946 | ||
|
|
b246666713 | ||
|
|
3e36e4e1d3 | ||
|
|
ba385b7de4 | ||
|
|
9858ac2588 | ||
|
|
0645e0d7b4 | ||
|
|
0c300e5220 | ||
|
|
20fddad789 | ||
|
|
6a36a97c3c | ||
|
|
c789941bc5 | ||
|
|
50994105b9 | ||
|
|
c5ff662faa | ||
|
|
4686f58b24 | ||
|
|
1305f685f6 | ||
|
|
5a1cfe44f2 | ||
|
|
cf9cba9d4f | ||
|
|
f7a3fbbdcf | ||
|
|
fc7251dab9 | ||
|
|
e79ea01a40 | ||
|
|
7e6c4659fd | ||
|
|
373142bc0f | ||
|
|
77cb4c5667 | ||
|
|
52ff016565 | ||
|
|
f76bf97117 | ||
|
|
1bec993af7 | ||
|
|
835aeba26d | ||
|
|
474e2f2880 | ||
|
|
3e398a71b0 | ||
|
|
c3cac5c64e | ||
|
|
3c08ab6689 | ||
|
|
cb327ddb23 | ||
|
|
b89fae8f11 | ||
|
|
5715a1c750 | ||
|
|
a23c6c459f | ||
|
|
f2fdda19b1 | ||
|
|
8ef0a50fab | ||
|
|
e763c61086 | ||
|
|
5d9b32c010 | ||
|
|
5ae8063245 | ||
|
|
6d89273e75 | ||
|
|
49dff77477 | ||
|
|
ade2b7237c | ||
|
|
a65872c306 | ||
|
|
09ff10980c | ||
|
|
78c9be8b38 | ||
|
|
8130d9c34b | ||
|
|
68bef1e0ab | ||
|
|
f2214611a1 | ||
|
|
06ba4a9efb | ||
|
|
e929ae42c9 | ||
|
|
24534f4d72 | ||
|
|
46bd244867 | ||
|
|
779b79ae57 | ||
|
|
a8cad555ec | ||
|
|
e97028e171 | ||
|
|
865c98760f | ||
|
|
984b6502ce | ||
|
|
64ea329b5f | ||
|
|
8d09057d50 | ||
|
|
ed5d70c5f9 | ||
|
|
7876cbd324 | ||
|
|
5e27c33062 | ||
|
|
20f42cefcc | ||
|
|
e77fd74aff | ||
|
|
236f96aada | ||
|
|
caeea9d081 | ||
|
|
00a39ccd2c | ||
|
|
88985c7b59 | ||
|
|
b8ff62648f | ||
|
|
6d6186af48 | ||
|
|
d8dd5dcd61 | ||
|
|
5f3e5c3ba7 | ||
|
|
76efe2f533 | ||
|
|
11e14ad868 | ||
|
|
6c5d59f231 | ||
|
|
db904d5df4 | ||
|
|
86b3f86d42 | ||
|
|
dcc37d8327 | ||
|
|
00a13e81c2 | ||
|
|
31c93efbfc | ||
|
|
16dd9f42a9 | ||
|
|
eb2994cafa | ||
|
|
4efdff226d | ||
|
|
f93221605a | ||
|
|
6401ed415b | ||
|
|
ba1233848d | ||
|
|
31165288c7 | ||
|
|
bd0a9c5eb4 | ||
|
|
09ac196bed | ||
|
|
87ec312ba9 | ||
|
|
ce0b428e05 | ||
|
|
542b331327 | ||
|
|
8d24b0175d | ||
|
|
4e51432492 | ||
|
|
f6bf94837e | ||
|
|
b058bca486 | ||
|
|
892a854459 | ||
|
|
9fa3bf38fb | ||
|
|
8c1dc1dea8 | ||
|
|
69a7ea2205 | ||
|
|
7b61375da5 | ||
|
|
93afbb18c8 | ||
|
|
13d2895ee8 | ||
|
|
05783170f6 | ||
|
|
47d7fc0b78 | ||
|
|
4f4e7855d4 | ||
|
|
568b26af76 | ||
|
|
f087275afc | ||
|
|
35589e620c | ||
|
|
8328d55223 | ||
|
|
7af7dc8e9d | ||
|
|
2093f9bb38 | ||
|
|
9659525b9b | ||
|
|
f8eccd8906 | ||
|
|
174ec6c5bd | ||
|
|
54d871cefe | ||
|
|
db72fb62bd | ||
|
|
44c825d92b | ||
|
|
52c44d3235 | ||
|
|
2d8cc77fd3 | ||
|
|
c020672b9a | ||
|
|
f107f7cee7 | ||
|
|
8ea7f0ab45 | ||
|
|
4ed6e10359 | ||
|
|
b4e6eb83a3 | ||
|
|
a43985188b | ||
|
|
c451b23fb5 | ||
|
|
e94a1829fa | ||
|
|
acf14fd2ca | ||
|
|
6f3f822f32 | ||
|
|
9454f1fd57 | ||
|
|
25b83fd0d9 | ||
|
|
387f388bde | ||
|
|
3ff95715f6 | ||
|
|
7934f362e5 | ||
|
|
7945f564c4 | ||
|
|
5975236b94 | ||
|
|
3444828163 | ||
|
|
b67cdb80da | ||
|
|
3c569faf1e | ||
|
|
28de09812a | ||
|
|
87a522d0d9 | ||
|
|
54ede6788c | ||
|
|
635ced0fbb | ||
|
|
0c19f8308c | ||
|
|
7cdee741b3 | ||
|
|
b77d3950ed | ||
|
|
67b0405949 | ||
|
|
3e765439b2 | ||
|
|
837abfbb9a | ||
|
|
0629ded2f8 | ||
|
|
8e54cd3b07 | ||
|
|
e4dd887b3a | ||
|
|
17a12881e2 | ||
|
|
865b1cc1ca | ||
|
|
465c8ffb8f | ||
|
|
e5a704d4b7 | ||
|
|
013e29e4b6 | ||
|
|
928cccc285 | ||
|
|
7d7d49d314 | ||
|
|
1e53ed245d | ||
|
|
952a11f402 | ||
|
|
86a5d8f8d3 | ||
|
|
8c13195b9d | ||
|
|
d7b6e551e2 | ||
|
|
5518e5f7c2 | ||
|
|
04fe6c6035 | ||
|
|
78ad0ed9d8 | ||
|
|
409acf0634 | ||
|
|
3cfedd9f7e | ||
|
|
d31755a4de | ||
|
|
f4a0b628f7 | ||
|
|
72a74bded4 | ||
|
|
78c1b0ba16 | ||
|
|
e6083d8167 | ||
|
|
90bb02b9d9 | ||
|
|
58c449c50c | ||
|
|
70dfc52753 | ||
|
|
a3b7a403b7 | ||
|
|
78e913477d | ||
|
|
9542c19291 | ||
|
|
219e987d5b | ||
|
|
f66b53d4f5 | ||
|
|
c92345046d | ||
|
|
17c1a0f671 | ||
|
|
4f5283e401 | ||
|
|
75c382d36e | ||
|
|
ecd5166fb6 | ||
|
|
840e770de3 | ||
|
|
129e10b7a5 | ||
|
|
eded1f211f | ||
|
|
6f3fee3f78 | ||
|
|
1fe88318d2 | ||
|
|
a49566b2b8 | ||
|
|
7df32e3079 | ||
|
|
695e6e482b | ||
|
|
b7104b6da8 | ||
|
|
e40eb781b8 | ||
|
|
2ce3513853 | ||
|
|
149df244dc | ||
|
|
a89eeaa3f3 | ||
|
|
2f1fdea586 | ||
|
|
5a36f9cfad | ||
|
|
deec0c20e7 | ||
|
|
360d77da79 | ||
|
|
23b9d066e8 | ||
|
|
a493925068 | ||
|
|
159c6f152b | ||
|
|
898938d70c | ||
|
|
ace44738fd | ||
|
|
5717fb47eb | ||
|
|
82e876fd24 | ||
|
|
9e597de6a8 | ||
|
|
3841bacc68 | ||
|
|
18cedcb256 | ||
|
|
89ee8fa705 | ||
|
|
ba4e15a58d | ||
|
|
5d7471191a | ||
|
|
5ac514702b | ||
|
|
4f847ab87d | ||
|
|
0cbfc59b37 | ||
|
|
ca63010a33 | ||
|
|
aff1d8b0ea | ||
|
|
397bc8a736 | ||
|
|
ce8fce22a2 | ||
|
|
001f417eac | ||
|
|
177f63f768 | ||
|
|
8b8208f165 | ||
|
|
fc4908a94b | ||
|
|
e5542643f8 | ||
|
|
9bb6af5fbb | ||
|
|
2df424a532 | ||
|
|
0095c5b560 | ||
|
|
145a540872 | ||
|
|
59411282ee | ||
|
|
4cc2d3d965 | ||
|
|
b5e6d21193 | ||
|
|
fb7ca5dbf1 | ||
|
|
f9e20336e0 | ||
|
|
9da6815a95 | ||
|
|
77b6b371f4 | ||
|
|
12d51edfdb | ||
|
|
e110328ffd | ||
|
|
3dc6974a17 | ||
|
|
f8662a8d63 | ||
|
|
557ab5cc2a | ||
|
|
8b329792fb | ||
|
|
08481d4ecb | ||
|
|
f9ebe73e60 | ||
|
|
4b08787e19 | ||
|
|
a64a4ecaaf | ||
|
|
5e33782cfd | ||
|
|
50d56d3f26 | ||
|
|
3b34f63e03 | ||
|
|
a88060a0ab | ||
|
|
5ddf038f55 | ||
|
|
f9902c3f1d | ||
|
|
70f1de128f | ||
|
|
18b46a6d8c | ||
|
|
e8b5988cec | ||
|
|
9eeedf78ed | ||
|
|
60bf3714c7 | ||
|
|
e2473c1ebd | ||
|
|
e66199f5dd | ||
|
|
a828742bef | ||
|
|
d4b6766e4e | ||
|
|
17cc9cba83 | ||
|
|
7e5d4943b2 | ||
|
|
2c31aec4d7 | ||
|
|
5f144b6c4e | ||
|
|
dc4edea2a5 | ||
|
|
41c4e40856 | ||
|
|
4f0351eceb | ||
|
|
edd9a799ce | ||
|
|
9053c6aca9 | ||
|
|
3861985c9f | ||
|
|
52ba94c6ef | ||
|
|
02c32fd223 | ||
|
|
82d5b9e36d | ||
|
|
05331b2409 | ||
|
|
56d232aee0 | ||
|
|
ed07c3a64b | ||
|
|
0e1f29d790 | ||
|
|
080eb5b5dc | ||
|
|
1e0ce10ca2 | ||
|
|
0ff98ebe1a | ||
|
|
079602e912 | ||
|
|
4b0e7583fb | ||
|
|
c594156ee7 | ||
|
|
fdd2737f78 | ||
|
|
1d82ae3ce2 | ||
|
|
3890dca4c9 | ||
|
|
1968ddb0c1 | ||
|
|
a9a2fec766 | ||
|
|
57cc7225e6 | ||
|
|
84e8c3ebb5 | ||
|
|
e640b14f5b | ||
|
|
e94e768c4f | ||
|
|
79b2cf7992 | ||
|
|
2b3983a6b3 | ||
|
|
564c0e97b9 | ||
|
|
659933c742 | ||
|
|
333f0999fd | ||
|
|
d87d142798 | ||
|
|
c8b2c24d35 | ||
|
|
7791a4c7f2 | ||
|
|
e2d199f28d | ||
|
|
c18a74a006 | ||
|
|
d21b521e33 | ||
|
|
5331912622 | ||
|
|
46c0012c83 | ||
|
|
d84893af34 | ||
|
|
e35d48c076 | ||
|
|
fc0ac03d5d | ||
|
|
9e515ef8de | ||
|
|
385a561b2d | ||
|
|
59faaf8f63 | ||
|
|
4733233c0b | ||
|
|
15df7722ea | ||
|
|
b2bdd625ae | ||
|
|
718bf6ebab | ||
|
|
aab7a18146 | ||
|
|
790bf27023 | ||
|
|
cf0d7faf15 | ||
|
|
3db40a514a | ||
|
|
b15d6969ff | ||
|
|
3e6afcdcbf | ||
|
|
2500478f98 | ||
|
|
3b8d881bc5 | ||
|
|
d70d38bd69 | ||
|
|
b02410c191 | ||
|
|
5a45f92e5c | ||
|
|
79ac74285b | ||
|
|
4616ddf833 | ||
|
|
1e93a505a4 | ||
|
|
e8a46f8a24 | ||
|
|
07d4fa6ca7 | ||
|
|
2b77afc9de | ||
|
|
fa3349b737 | ||
|
|
20af7e8a28 | ||
|
|
b894afc722 | ||
|
|
2076190634 | ||
|
|
8f638d0e72 | ||
|
|
fbef2eac5d | ||
|
|
7c563c2c07 | ||
|
|
a7c5977db9 | ||
|
|
c843eda53b | ||
|
|
46576eb684 | ||
|
|
b23baa263f | ||
|
|
af6e813f78 | ||
|
|
e0638272ed | ||
|
|
8173f09018 | ||
|
|
bbbe12cc54 | ||
|
|
3627ffc27a | ||
|
|
be6138b6d1 | ||
|
|
ffb223bfe6 | ||
|
|
563059dfe5 | ||
|
|
9d316ce2eb | ||
|
|
0482ffae1f | ||
|
|
e407c3dee0 | ||
|
|
0b3bc5d31e | ||
|
|
babdd30609 | ||
|
|
cb63273a2f | ||
|
|
805698e3c8 | ||
|
|
de67cf78bc | ||
|
|
3cd442b8a9 | ||
|
|
9fbf940167 | ||
|
|
9be922b636 | ||
|
|
de7d0112d3 | ||
|
|
3734545322 | ||
|
|
00c52a3c3b | ||
|
|
694077c16c | ||
|
|
b0421621f5 | ||
|
|
799b2808df | ||
|
|
9be64e638e | ||
|
|
a3932216e1 | ||
|
|
ab626423d1 | ||
|
|
11f32efd42 | ||
|
|
c8292b1e6b | ||
|
|
9a9f298f5b | ||
|
|
adc891b901 | ||
|
|
ef2fe786eb | ||
|
|
8577818033 | ||
|
|
3a49ee9218 | ||
|
|
7281ac268d | ||
|
|
3ad91d1a2b | ||
|
|
9acfa966a5 | ||
|
|
f7a259599e | ||
|
|
7f61ce603f | ||
|
|
1acb794393 | ||
|
|
aa9611d929 | ||
|
|
b86beb0d7d | ||
|
|
cd496991ba | ||
|
|
71387e78e2 | ||
|
|
e8ed25dda6 | ||
|
|
9bfa0a8f73 | ||
|
|
93b8dcf9fe | ||
|
|
9ecea8876d | ||
|
|
d9db4e9b1c | ||
|
|
d22f7a67e4 | ||
|
|
4725cd58b5 | ||
|
|
5b36d547c0 | ||
|
|
bfeacffe3c | ||
|
|
57e3828232 | ||
|
|
d45663a022 | ||
|
|
4dd8f8fc2a | ||
|
|
ae212975ab | ||
|
|
99fbe324ed | ||
|
|
607fc9edc7 | ||
|
|
80ad636c13 | ||
|
|
bc54b92b21 | ||
|
|
9c086c9aa6 | ||
|
|
65bee80487 | ||
|
|
aefa794cdd | ||
|
|
30f4baa703 | ||
|
|
045a0c71b9 | ||
|
|
f8f6e22b9a | ||
|
|
c168aff1fa | ||
|
|
471cf98d5e | ||
|
|
cfb02504a6 | ||
|
|
bdc9a4c488 | ||
|
|
5e94eca7d1 | ||
|
|
3122cd087e | ||
|
|
8e1e4ac375 | ||
|
|
b5f04aa260 | ||
|
|
b19d05cf1b | ||
|
|
40d5b077d1 | ||
|
|
5c3da34fab | ||
|
|
d25d4e04b3 | ||
|
|
3630de940e | ||
|
|
98eb92d23b | ||
|
|
852fd3c108 | ||
|
|
3f4891d46c | ||
|
|
24ae0e23e2 | ||
|
|
1d86c86142 | ||
|
|
6b5d8ed99a | ||
|
|
f3e134b53c | ||
|
|
3e90aad287 | ||
|
|
7a729f9fc6 | ||
|
|
b248d73163 | ||
|
|
bbd1d02e66 | ||
|
|
37cfd2d9d0 | ||
|
|
161668a14e | ||
|
|
560407495b | ||
|
|
e27beef891 | ||
|
|
a1535b8ec4 | ||
|
|
294957d5ac | ||
|
|
5d33809ab7 | ||
|
|
b3c3c6a925 | ||
|
|
17de4aee1b | ||
|
|
033740f1bb | ||
|
|
d46a63b537 | ||
|
|
4c67101519 | ||
|
|
c0e2d90f9f | ||
|
|
0e0395794b | ||
|
|
2d0e4acc06 | ||
|
|
47abbf36a8 | ||
|
|
7d6c8f1d25 | ||
|
|
7cd71cc9d4 | ||
|
|
c1ebf17269 | ||
|
|
73af4cc2c3 | ||
|
|
53302e91dd | ||
|
|
eab828e44e | ||
|
|
8b053f5d8e | ||
|
|
8662ffcf07 | ||
|
|
9c929266ab | ||
|
|
c6bc130078 | ||
|
|
9d46a71766 | ||
|
|
5e8fb195b0 | ||
|
|
583fea6546 | ||
|
|
4768bc05f0 | ||
|
|
82bab63ba2 | ||
|
|
4590a7fde8 | ||
|
|
6fa7ca167b | ||
|
|
ecf288d9d4 | ||
|
|
4b58a7f824 | ||
|
|
ddf66a6cf3 | ||
|
|
9cda68b053 | ||
|
|
9d5090afdd | ||
|
|
630710ae7a | ||
|
|
46a8deaf2f | ||
|
|
91a0bc6dd4 | ||
|
|
50b86137ed | ||
|
|
964ab8578d | ||
|
|
7cad6aa32d | ||
|
|
8a6490afad | ||
|
|
a7895f254d | ||
|
|
23ef1012cb | ||
|
|
7c52796127 | ||
|
|
72e8b21c03 | ||
|
|
7ca1da09d7 | ||
|
|
9c2bd7cca2 | ||
|
|
c2e0369870 | ||
|
|
8f10ac8b00 | ||
|
|
8cc30246e2 | ||
|
|
a78736b2a1 | ||
|
|
fdde818ae7 | ||
|
|
31df89ff2b | ||
|
|
f2f9af1504 | ||
|
|
e443f62581 | ||
|
|
7d5ec2dac4 | ||
|
|
55759d9135 | ||
|
|
4f1cfe2338 | ||
|
|
1a362e094e | ||
|
|
b381e07774 | ||
|
|
e76403c2d9 | ||
|
|
fc03226a87 | ||
|
|
6734715440 | ||
|
|
5dc3e1bc7d | ||
|
|
4eb0aa43ef | ||
|
|
41b3311c44 | ||
|
|
39acddf2c3 | ||
|
|
329f0885ab | ||
|
|
a338f3a5ba | ||
|
|
cebd730cf2 | ||
|
|
a0473e8aac | ||
|
|
dc5bb1fa9d | ||
|
|
21ba99a66b | ||
|
|
8f13166475 | ||
|
|
d8a6df02ad | ||
|
|
814c77bb36 | ||
|
|
83a9636948 | ||
|
|
8cc5f9a2bf | ||
|
|
c84a35e477 | ||
|
|
e205ea6371 | ||
|
|
7ce6f68b5f | ||
|
|
5635d6a4dc | ||
|
|
bfa04897ae | ||
|
|
8d04ccf2e3 | ||
|
|
644153d61f | ||
|
|
f9adec2f5b | ||
|
|
38f4f4a801 | ||
|
|
70993942bb | ||
|
|
8ce2b7e498 | ||
|
|
81ca19e8f4 | ||
|
|
765e462195 | ||
|
|
33c48abe23 | ||
|
|
d4f9d87e9e | ||
|
|
88f47d2469 | ||
|
|
894c902609 | ||
|
|
aea87c74c2 | ||
|
|
bbe10ad8d6 | ||
|
|
0391deb657 | ||
|
|
620cabe209 | ||
|
|
0e4a2d3e65 | ||
|
|
4b450f66ec | ||
|
|
26265634c6 | ||
|
|
d9a30abee1 | ||
|
|
2f83741d38 | ||
|
|
18c224ffba | ||
|
|
6b40e5f9a8 | ||
|
|
50a367f1c5 | ||
|
|
144b95d6f2 | ||
|
|
85865d05ef | ||
|
|
2567f41fbb | ||
|
|
b4902fe36c | ||
|
|
66f1d43783 | ||
|
|
33b86ac699 | ||
|
|
9a01a0ad95 | ||
|
|
69c16d73bd | ||
|
|
38bbc15b4d | ||
|
|
a0e39c4f4d | ||
|
|
2088080571 | ||
|
|
0029a67b99 | ||
|
|
cdaf43322d | ||
|
|
9c175ce05e | ||
|
|
76d282e440 | ||
|
|
055df3488e | ||
|
|
b692617b4e | ||
|
|
9e68d725c1 | ||
|
|
4392e0d85c | ||
|
|
61c69e5ff0 | ||
|
|
82dc6f0ade | ||
|
|
90d1ec387d | ||
|
|
d77d037054 | ||
|
|
be3d139823 | ||
|
|
babe75caf9 | ||
|
|
dccf25c6f2 | ||
|
|
d07e925629 | ||
|
|
aff14b5ad0 | ||
|
|
a1181b09ca | ||
|
|
3078521250 | ||
|
|
3bdb639cae | ||
|
|
aefa861625 | ||
|
|
30bb679f6c | ||
|
|
630235e57a | ||
|
|
5983585779 | ||
|
|
c0b9a4ad49 | ||
|
|
88123bfc1f | ||
|
|
1da29ceea2 | ||
|
|
a9022f0b47 | ||
|
|
b90f71b60b | ||
|
|
effde3fe8d | ||
|
|
d68f41a968 | ||
|
|
7b5272977a | ||
|
|
d3fc5ed963 | ||
|
|
f8c6b7b36e | ||
|
|
2f862afa97 | ||
|
|
71f12565a3 | ||
|
|
f0ce34e8c9 | ||
|
|
b82dfdf7d7 | ||
|
|
96f54dd8c6 | ||
|
|
a4113864b7 | ||
|
|
1e9796bdf1 | ||
|
|
4ad7ce54f0 | ||
|
|
80db96eac8 | ||
|
|
29f7bc9fda | ||
|
|
1709045b79 | ||
|
|
f845c3f5f0 | ||
|
|
fc962e2c99 | ||
|
|
28d4784669 | ||
|
|
c70028b094 | ||
|
|
2f59760d39 | ||
|
|
b0d8af3871 | ||
|
|
65c0c298d8 | ||
|
|
2f61972d18 | ||
|
|
7d27348401 | ||
|
|
c3c93a82dd | ||
|
|
8a9e8e2b60 | ||
|
|
961faabf84 | ||
|
|
09c4ca9b99 | ||
|
|
092661970d | ||
|
|
4b2ee8b9e7 | ||
|
|
573745eb56 | ||
|
|
827a008262 | ||
|
|
c5f634355b | ||
|
|
072378acc2 | ||
|
|
61d622a6a2 | ||
|
|
100d0a32f4 | ||
|
|
4d3dde7776 | ||
|
|
53148f8a07 | ||
|
|
a63ced21f0 | ||
|
|
39e2d33bef | ||
|
|
7c825af248 | ||
|
|
6f5fa2b84d | ||
|
|
8fce0003be | ||
|
|
0ef7d902fa | ||
|
|
1a9c08292a | ||
|
|
f6dcb7b929 | ||
|
|
d9d39454a9 | ||
|
|
518b246038 | ||
|
|
4367a5d803 | ||
|
|
95c6c0c795 | ||
|
|
1b12a69120 | ||
|
|
6af7e1e6fa | ||
|
|
da537d6282 | ||
|
|
a7d33965cd | ||
|
|
2abbbcfaca | ||
|
|
19fba6f2ff | ||
|
|
9daa0ca0ae | ||
|
|
c18f1280c7 | ||
|
|
c9325e7847 | ||
|
|
6d8cf8e8a6 | ||
|
|
cb855b3d66 | ||
|
|
26b4f8bea5 | ||
|
|
ff9df30773 | ||
|
|
01eb5b723e | ||
|
|
bb90e6a193 | ||
|
|
e122c78842 | ||
|
|
2b986968f4 | ||
|
|
810487e0ed | ||
|
|
b257ad682c | ||
|
|
d897ed59a7 | ||
|
|
ec8b0c2a44 | ||
|
|
b575903468 | ||
|
|
c9732aad8b | ||
|
|
c76f16a3d9 | ||
|
|
b261a90658 | ||
|
|
a964f887ea | ||
|
|
d73b79d3af | ||
|
|
26d58849a7 | ||
|
|
7805b719b1 | ||
|
|
5d3e85274e | ||
|
|
a8a0bd7570 | ||
|
|
4fe7367ca7 | ||
|
|
761e8de937 | ||
|
|
1f82ba56bc | ||
|
|
000af3a5bd | ||
|
|
092b839176 | ||
|
|
413c4fccb6 | ||
|
|
25a55ebf52 | ||
|
|
da70aa1abf | ||
|
|
9a6072a048 | ||
|
|
51e66dd624 | ||
|
|
4f34fe636c | ||
|
|
6cb5953bec | ||
|
|
dd78c7c365 | ||
|
|
9d31daea72 | ||
|
|
14c192be58 | ||
|
|
45a59d967d | ||
|
|
c2682625e7 | ||
|
|
6b043020b2 | ||
|
|
72e1a0ed29 | ||
|
|
87fa65be89 | ||
|
|
c7300b4764 | ||
|
|
f558552f0e | ||
|
|
e852b8b190 | ||
|
|
d87c0c4ad3 | ||
|
|
d04b0a0215 | ||
|
|
65f67b0bee | ||
|
|
070106e3cc | ||
|
|
70edbb2a39 | ||
|
|
9dd19027d0 | ||
|
|
d5f928369c | ||
|
|
eafd157dcf | ||
|
|
1f70aeb6ef | ||
|
|
0ea767a809 | ||
|
|
d967847370 | ||
|
|
6f3ce3049d | ||
|
|
740fbe1647 | ||
|
|
e6e8e02a0f | ||
|
|
0815fb648b | ||
|
|
69d4d96c2a | ||
|
|
34103a54f7 | ||
|
|
25b4750c58 | ||
|
|
e53ed9c382 | ||
|
|
72489195d1 | ||
|
|
e0768450fe | ||
|
|
01ee40208d | ||
|
|
f4fda3f508 | ||
|
|
7d0f6da2c3 | ||
|
|
01865024b0 | ||
|
|
ab7478a80c | ||
|
|
5194db1b80 | ||
|
|
7dec07c64a | ||
|
|
cb31607718 | ||
|
|
7a1f1093a7 | ||
|
|
80b4b36178 | ||
|
|
79c794370e | ||
|
|
5545f8c64e | ||
|
|
c732dd75d4 | ||
|
|
9879d5941b | ||
|
|
fe64dd7ee9 | ||
|
|
ad049fc530 | ||
|
|
825c4fc58b | ||
|
|
e440ff8436 | ||
|
|
481e298df1 | ||
|
|
33906955fb | ||
|
|
733e275370 | ||
|
|
d36a663be5 | ||
|
|
66a7e5ba25 | ||
|
|
ea79f075bc | ||
|
|
cfd6270f5d | ||
|
|
571b164abb | ||
|
|
4a6269e033 | ||
|
|
de299862b0 | ||
|
|
c7d3f264c9 | ||
|
|
61b364738c | ||
|
|
771a814610 | ||
|
|
9446232146 | ||
|
|
ff0412529c | ||
|
|
72b2fdfdce | ||
|
|
e7f331d3e4 | ||
|
|
f11317fe0a | ||
|
|
bb39d5955e | ||
|
|
581fc4cd33 | ||
|
|
6efce450dd | ||
|
|
f5b00ac9de | ||
|
|
29934e62f4 | ||
|
|
d0e44b7ba6 | ||
|
|
28a04e7514 | ||
|
|
3c08184274 | ||
|
|
faabd50be8 | ||
|
|
9fb9047fdf | ||
|
|
9d647e97e5 | ||
|
|
9f268f8d43 | ||
|
|
c264d14113 | ||
|
|
421f4d012f | ||
|
|
fe3e01c499 | ||
|
|
6e7d31a989 | ||
|
|
755d187ce1 | ||
|
|
a62774c51c | ||
|
|
3c4d71ff39 | ||
|
|
1ed23a5ea3 | ||
|
|
69b61afc54 | ||
|
|
d6506a4062 | ||
|
|
4f761262ee | ||
|
|
67536d05b1 | ||
|
|
a1846d72a5 | ||
|
|
a9e9715b11 | ||
|
|
178e86fc50 | ||
|
|
a703d513a6 | ||
|
|
c348f3431b | ||
|
|
01d4d3d482 | ||
|
|
83e4c65d01 | ||
|
|
a72e18bac2 | ||
|
|
138756d638 | ||
|
|
64db6e9d64 | ||
|
|
1ccc37694b | ||
|
|
956445435e | ||
|
|
e53e408fa8 | ||
|
|
d77c26ed0d | ||
|
|
78519abb66 | ||
|
|
888dd95d44 | ||
|
|
d3d4a6e88f | ||
|
|
2b064ee395 | ||
|
|
4f772b014e | ||
|
|
db43deed77 | ||
|
|
956c70c65e | ||
|
|
90407bab12 | ||
|
|
fa9450da1e | ||
|
|
baa3c2f735 | ||
|
|
273652ae23 | ||
|
|
e290aaaf5c | ||
|
|
dd1f222840 | ||
|
|
c22d4a85c0 | ||
|
|
65df98a60d | ||
|
|
77bb8c2ae8 | ||
|
|
0c331b5fea | ||
|
|
97de31e957 | ||
|
|
9bc37de02c | ||
|
|
4f805ce45f | ||
|
|
abbff39758 | ||
|
|
457f13639a | ||
|
|
73746383cc | ||
|
|
917c4f0e91 | ||
|
|
5fe5646b6f | ||
|
|
cb523dd454 | ||
|
|
ced67719a9 | ||
|
|
421b3ba7a6 | ||
|
|
664c6b68b6 | ||
|
|
38a69dac07 | ||
|
|
56119da3e0 | ||
|
|
1c6d039e3f | ||
|
|
06cd8f8117 | ||
|
|
a008f5f117 | ||
|
|
c4a7d8d209 | ||
|
|
4ae78c2db8 | ||
|
|
78a363ba05 | ||
|
|
301512ee4b | ||
|
|
7d608c54e6 | ||
|
|
9dc003c87b | ||
|
|
0e1502ca6c | ||
|
|
077969c709 | ||
|
|
c169f1b0c7 | ||
|
|
efff61021c | ||
|
|
56e0ffeb3a | ||
|
|
4df3843d86 | ||
|
|
a5d04de985 | ||
|
|
731e7fab95 | ||
|
|
bfcf1017f0 | ||
|
|
a0d35cf3dc | ||
|
|
1e596c25b1 | ||
|
|
0bcd2df9c6 | ||
|
|
f320a584f6 | ||
|
|
4ea259a94f | ||
|
|
330826f597 | ||
|
|
b0d01c209e | ||
|
|
8584538e81 | ||
|
|
c015310ddb | ||
|
|
477a730322 | ||
|
|
b05ead5709 | ||
|
|
82cd08371a | ||
|
|
9c7910e75c | ||
|
|
273a6b6ad5 | ||
|
|
cc353e0d81 | ||
|
|
361076a5d5 | ||
|
|
8f67ed0750 | ||
|
|
9d151eb86a | ||
|
|
cd29049889 | ||
|
|
66e51c5bfb | ||
|
|
b5d4b267e2 | ||
|
|
9af746ba2f | ||
|
|
6b7e9f7949 | ||
|
|
df073989d2 | ||
|
|
d3e6be3980 | ||
|
|
c5bee2c2a2 | ||
|
|
de944ef795 | ||
|
|
a6a3038fd0 | ||
|
|
41d9c0d23a | ||
|
|
52107ffa56 | ||
|
|
d0fc15ca54 | ||
|
|
7d7acacaf5 | ||
|
|
484f0bb567 | ||
|
|
76f41e5731 | ||
|
|
5732c92943 | ||
|
|
71c7f4b35d | ||
|
|
596a34fe2c | ||
|
|
336d9485c4 | ||
|
|
a1223ce227 | ||
|
|
91cc9534d2 | ||
|
|
1b0f135d7c | ||
|
|
4eec66d21b | ||
|
|
a69eddc618 | ||
|
|
fe25c4b2dd | ||
|
|
7288d74b8d | ||
|
|
b7f61e0993 | ||
|
|
1078439201 | ||
|
|
227a6e9921 | ||
|
|
fd625f4485 | ||
|
|
10a202eb85 | ||
|
|
46ed01b4c9 | ||
|
|
192c360801 | ||
|
|
ebc3c54618 | ||
|
|
dbf12fb14d | ||
|
|
fbda05239d | ||
|
|
68f4a744df | ||
|
|
515b350328 | ||
|
|
6e41cc18f1 | ||
|
|
b6125cb585 | ||
|
|
045e6d1976 | ||
|
|
6109040c4c | ||
|
|
e18acc7db9 | ||
|
|
9ac5648eb8 | ||
|
|
e883ed3681 | ||
|
|
c2f1cb07af | ||
|
|
f6e163efd7 | ||
|
|
990a80c2d3 | ||
|
|
0686ad25fd | ||
|
|
fb03bb3edd | ||
|
|
53ce452767 | ||
|
|
a5f0041cf6 | ||
|
|
3f41b14d3b | ||
|
|
7909d58f86 | ||
|
|
dcdf6fae31 | ||
|
|
a3ce808911 | ||
|
|
27392068ae | ||
|
|
781952ab3c | ||
|
|
f3b372a7d0 | ||
|
|
2cbdc0354f | ||
|
|
bd88c48b11 | ||
|
|
467065951c | ||
|
|
cbbdd5bed5 | ||
|
|
9bfef39b32 | ||
|
|
d854a567cc | ||
|
|
7fb6788547 | ||
|
|
6522c0affb | ||
|
|
4044d41e0f | ||
|
|
1b261e843c | ||
|
|
d4dcd879ec | ||
|
|
83860510fd | ||
|
|
e9e002dc67 | ||
|
|
ae1e78b409 | ||
|
|
e0aaddfe45 | ||
|
|
dbca1fc507 | ||
|
|
90328934f3 | ||
|
|
1ef9449ca0 | ||
|
|
0e38106312 | ||
|
|
26e0c91fe3 | ||
|
|
29a9b1b84a | ||
|
|
32b1fc67f1 | ||
|
|
be04eb3bea | ||
|
|
91fd4bacbd | ||
|
|
740eb96fa8 | ||
|
|
ce02da8698 | ||
|
|
f215b21d51 | ||
|
|
c1dad92914 | ||
|
|
86bfe052ac | ||
|
|
0a84f60c32 | ||
|
|
8421a979b4 | ||
|
|
0905d87cc8 | ||
|
|
de9fe64751 | ||
|
|
cc5440aa67 | ||
|
|
aa0cd04622 | ||
|
|
e733bfb803 | ||
|
|
1a34319c95 | ||
|
|
2e675c2808 | ||
|
|
0441d2cdd7 | ||
|
|
312d89980b | ||
|
|
6d5d74e011 | ||
|
|
daca216fe4 | ||
|
|
ae40258f87 | ||
|
|
266416183e | ||
|
|
c0c91cd191 | ||
|
|
25cbcafb90 | ||
|
|
3594fd4593 | ||
|
|
c95e23d755 | ||
|
|
769521cafe | ||
|
|
6e057a3318 | ||
|
|
70842ad0ac | ||
|
|
37771a57e7 | ||
|
|
44732053d0 | ||
|
|
2d6546705a | ||
|
|
93fb7aa371 | ||
|
|
02832fb136 | ||
|
|
ed900a990e | ||
|
|
ed32fa60df | ||
|
|
a6e5654436 | ||
|
|
ae73634640 | ||
|
|
86442662ea | ||
|
|
cc17627a0b | ||
|
|
b1fa60eabc | ||
|
|
07eff298ab | ||
|
|
575dce6fb0 | ||
|
|
5c756f9000 | ||
|
|
56e63609c6 | ||
|
|
cf425de106 | ||
|
|
49f4145b23 | ||
|
|
4ecb7d2c04 | ||
|
|
ffec06e730 | ||
|
|
c7a9272113 | ||
|
|
d0c9fdcf66 | ||
|
|
15c8853f66 | ||
|
|
9fbaff4b23 | ||
|
|
2a0499d8fc | ||
|
|
fb16f5a2d6 | ||
|
|
1c50521985 | ||
|
|
770e58a79d | ||
|
|
d182ec0430 | ||
|
|
235d9ec12a | ||
|
|
e0eaae9b69 | ||
|
|
0dedbbf37a | ||
|
|
ee6f271456 | ||
|
|
81fc09d190 | ||
|
|
336bceeb97 | ||
|
|
1570c3b6f5 | ||
|
|
10531c9f9a | ||
|
|
8e8b1b974e | ||
|
|
806ec58d43 | ||
|
|
4bd6eee63e | ||
|
|
70f48ddc3f | ||
|
|
f0a53b5cae | ||
|
|
3a7a4bab12 | ||
|
|
0abf9a06c3 | ||
|
|
46744ec75b | ||
|
|
832f906700 | ||
|
|
c3053249fe | ||
|
|
b23a8dd0a5 | ||
|
|
6bac91c849 | ||
|
|
18bdfbf187 | ||
|
|
94ae7403ef | ||
|
|
3241e5e968 | ||
|
|
d52456b74e | ||
|
|
223f68b7c3 | ||
|
|
7fa1f2dcac | ||
|
|
698da23a10 | ||
|
|
fd8359df77 | ||
|
|
a56f4bda5c | ||
|
|
2bea4818b5 | ||
|
|
68e8c59225 | ||
|
|
6d8e3235ac | ||
|
|
d0f1d7f3dc | ||
|
|
fbdf3e4b38 | ||
|
|
783ff628db | ||
|
|
8009f581fe | ||
|
|
5ab60c4004 | ||
|
|
d53056360b | ||
|
|
466912ad4a | ||
|
|
c45e229ce2 | ||
|
|
cfe2a0d4f3 | ||
|
|
2d78fbb314 | ||
|
|
17ff830fed | ||
|
|
1fef7d93f2 | ||
|
|
1f3cc0ca7d | ||
|
|
15ee00c24b | ||
|
|
544fca8257 | ||
|
|
2946ee1267 | ||
|
|
585e3b325c | ||
|
|
c7c66c49ed | ||
|
|
98adef316a | ||
|
|
5905ad3278 | ||
|
|
eacf611ee9 | ||
|
|
f7fa342b31 | ||
|
|
4fce3cff24 | ||
|
|
02ef795581 | ||
|
|
392a9da692 | ||
|
|
9debfd4cc6 | ||
|
|
175f1f2ba7 | ||
|
|
27423768ac | ||
|
|
92df9ff065 | ||
|
|
7339521397 | ||
|
|
57a9928fdb | ||
|
|
cc711a141a | ||
|
|
acccd2968c | ||
|
|
9908b4ee6c | ||
|
|
6b4eeda413 | ||
|
|
daaa089b31 | ||
|
|
0c5e07b2d2 | ||
|
|
12795bc504 | ||
|
|
00f1faeea5 | ||
|
|
7686fd0ecb | ||
|
|
a257c481c3 | ||
|
|
1d9913604c | ||
|
|
1314345f28 | ||
|
|
901a41d350 | ||
|
|
e3b186733e | ||
|
|
39c6784ba7 | ||
|
|
a4ad38a0a9 | ||
|
|
3d16df288c | ||
|
|
f548511d7e | ||
|
|
90450c4d06 | ||
|
|
730599470e | ||
|
|
725b15175d | ||
|
|
3d5bd9eb1f | ||
|
|
70901c0946 | ||
|
|
ddfae8cd07 | ||
|
|
a34057753c | ||
|
|
08e03345d5 | ||
|
|
6795fe15dd | ||
|
|
cee09c6e9d | ||
|
|
e518a26dc2 | ||
|
|
4a7739393f | ||
|
|
b1ad598def | ||
|
|
a41127179d | ||
|
|
34a99b5509 | ||
|
|
3a298245a9 | ||
|
|
2cc746aafe | ||
|
|
1053bcaada | ||
|
|
1b05b56f04 | ||
|
|
4bab84be67 | ||
|
|
b383757742 | ||
|
|
b39a776785 | ||
|
|
bd914916b3 | ||
|
|
493f517d93 | ||
|
|
0cc16a7836 | ||
|
|
f121a6d723 | ||
|
|
b91ed698cd | ||
|
|
f65f3f1ba0 | ||
|
|
d921797e3c | ||
|
|
001dc5f62c | ||
|
|
63e1b53a49 | ||
|
|
a3a61c174f | ||
|
|
9107a2fe33 | ||
|
|
070d3c56ed | ||
|
|
8867768a7d | ||
|
|
3e2dddfb16 | ||
|
|
625bc649ee | ||
|
|
f9d8fa2b91 | ||
|
|
86456b9cbc | ||
|
|
b8e45853c0 | ||
|
|
dfde4e34c0 | ||
|
|
bcf0bb26a7 | ||
|
|
c33a079c88 | ||
|
|
616b599104 | ||
|
|
6af52f8bb6 | ||
|
|
13c069740f | ||
|
|
f510323dca | ||
|
|
ffedce0f5f | ||
|
|
5fc6e2c0db | ||
|
|
388b9f06e9 | ||
|
|
d8cff01c4a | ||
|
|
71d9772913 | ||
|
|
add5896378 | ||
|
|
ad01befeee | ||
|
|
0e9bd9b091 | ||
|
|
737a61be66 | ||
|
|
cfa35e5a92 |
+7
-2
@@ -1,12 +1,16 @@
|
|||||||
-s dir
|
-s dir
|
||||||
--name sing-box
|
--name sing-box-extended
|
||||||
--category net
|
--category net
|
||||||
--license GPL-3.0-or-later
|
--license GPL-3.0-or-later
|
||||||
--description "The universal proxy platform."
|
--description "The universal proxy platform (extended)."
|
||||||
--url "https://sing-box.sagernet.org/"
|
--url "https://sing-box.sagernet.org/"
|
||||||
--maintainer "nekohasekai <contact-git@sekai.icu>"
|
--maintainer "nekohasekai <contact-git@sekai.icu>"
|
||||||
--no-deb-generate-changes
|
--no-deb-generate-changes
|
||||||
|
|
||||||
|
--provides sing-box
|
||||||
|
--conflicts sing-box
|
||||||
|
--replaces sing-box
|
||||||
|
|
||||||
--config-files /etc/config/sing-box
|
--config-files /etc/config/sing-box
|
||||||
--config-files /etc/sing-box/config.json
|
--config-files /etc/sing-box/config.json
|
||||||
|
|
||||||
@@ -14,6 +18,7 @@
|
|||||||
--depends kmod-inet-diag
|
--depends kmod-inet-diag
|
||||||
--depends kmod-tun
|
--depends kmod-tun
|
||||||
--depends firewall4
|
--depends firewall4
|
||||||
|
--depends kmod-nft-queue
|
||||||
|
|
||||||
--before-remove release/config/openwrt.prerm
|
--before-remove release/config/openwrt.prerm
|
||||||
|
|
||||||
|
|||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
-s dir
|
||||||
|
--name sing-box
|
||||||
|
--category net
|
||||||
|
--license GPL-3.0-or-later
|
||||||
|
--description "The universal proxy platform."
|
||||||
|
--url "https://sing-box.sagernet.org/"
|
||||||
|
--maintainer "nekohasekai <contact-git@sekai.icu>"
|
||||||
|
--config-files etc/sing-box/config.json
|
||||||
|
--after-install release/config/sing-box.postinst
|
||||||
|
|
||||||
|
release/config/config.json=/etc/sing-box/config.json
|
||||||
|
|
||||||
|
release/config/sing-box.service=/usr/lib/systemd/system/sing-box.service
|
||||||
|
release/config/sing-box@.service=/usr/lib/systemd/system/sing-box@.service
|
||||||
|
release/config/sing-box.sysusers=/usr/lib/sysusers.d/sing-box.conf
|
||||||
|
release/config/sing-box.rules=usr/share/polkit-1/rules.d/sing-box.rules
|
||||||
|
release/config/sing-box-split-dns.xml=/usr/share/dbus-1/system.d/sing-box-split-dns.conf
|
||||||
|
|
||||||
|
release/completions/sing-box.bash=/usr/share/bash-completion/completions/sing-box.bash
|
||||||
|
release/completions/sing-box.fish=/usr/share/fish/vendor_completions.d/sing-box.fish
|
||||||
|
release/completions/sing-box.zsh=/usr/share/zsh/site-functions/_sing-box
|
||||||
|
|
||||||
|
LICENSE=/usr/share/licenses/sing-box/LICENSE
|
||||||
@@ -4,10 +4,12 @@
|
|||||||
--license GPL-3.0-or-later
|
--license GPL-3.0-or-later
|
||||||
--description "The universal proxy platform."
|
--description "The universal proxy platform."
|
||||||
--url "https://sing-box.sagernet.org/"
|
--url "https://sing-box.sagernet.org/"
|
||||||
|
--vendor SagerNet
|
||||||
--maintainer "nekohasekai <contact-git@sekai.icu>"
|
--maintainer "nekohasekai <contact-git@sekai.icu>"
|
||||||
--deb-field "Bug: https://github.com/SagerNet/sing-box/issues"
|
--deb-field "Bug: https://github.com/SagerNet/sing-box/issues"
|
||||||
--no-deb-generate-changes
|
--no-deb-generate-changes
|
||||||
--config-files /etc/sing-box/config.json
|
--config-files /etc/sing-box/config.json
|
||||||
|
--after-install release/config/sing-box.postinst
|
||||||
|
|
||||||
release/config/config.json=/etc/sing-box/config.json
|
release/config/config.json=/etc/sing-box/config.json
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
45832ab074849607406baa3e3a2c4660274602ed
|
||||||
@@ -31,6 +31,8 @@ body:
|
|||||||
- sing-box for macOS Graphical Client
|
- sing-box for macOS Graphical Client
|
||||||
- sing-box for Apple tvOS Graphical Client
|
- sing-box for Apple tvOS Graphical Client
|
||||||
- sing-box for Android Graphical Client
|
- sing-box for Android Graphical Client
|
||||||
|
- sing-box for Windows Graphical Client
|
||||||
|
- sing-box for Linux Graphical Client
|
||||||
- Third-party graphical clients that advertise themselves as using sing-box (Windows)
|
- Third-party graphical clients that advertise themselves as using sing-box (Windows)
|
||||||
- Third-party graphical clients that advertise themselves as using sing-box (Android)
|
- Third-party graphical clients that advertise themselves as using sing-box (Android)
|
||||||
- Others
|
- Others
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ body:
|
|||||||
- sing-box for macOS 图形客户端程序
|
- sing-box for macOS 图形客户端程序
|
||||||
- sing-box for Apple tvOS 图形客户端程序
|
- sing-box for Apple tvOS 图形客户端程序
|
||||||
- sing-box for Android 图形客户端程序
|
- sing-box for Android 图形客户端程序
|
||||||
|
- sing-box for Windows 图形客户端程序
|
||||||
|
- sing-box for Linux 图形客户端程序
|
||||||
- 宣传使用 sing-box 的第三方图形客户端程序 (Windows)
|
- 宣传使用 sing-box 的第三方图形客户端程序 (Windows)
|
||||||
- 宣传使用 sing-box 的第三方图形客户端程序 (Android)
|
- 宣传使用 sing-box 的第三方图形客户端程序 (Android)
|
||||||
- 其他
|
- 其他
|
||||||
|
|||||||
Executable
+94
@@ -0,0 +1,94 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e -o pipefail
|
||||||
|
|
||||||
|
prepare_apk_root() {
|
||||||
|
# apk mkpkg resolves owner/group names through --root/etc/{passwd,group}.
|
||||||
|
APK_ROOT_DIR=$(mktemp -d)
|
||||||
|
mkdir -p "$APK_ROOT_DIR/etc"
|
||||||
|
cat > "$APK_ROOT_DIR/etc/passwd" <<EOF
|
||||||
|
root:x:$(id -u):$(id -g):root:/root:/sbin/nologin
|
||||||
|
EOF
|
||||||
|
cat > "$APK_ROOT_DIR/etc/group" <<EOF
|
||||||
|
root:x:$(id -g):root
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
ARCHITECTURE="$1"
|
||||||
|
VERSION="$2"
|
||||||
|
BINARY_PATH="$3"
|
||||||
|
OUTPUT_PATH="$4"
|
||||||
|
|
||||||
|
if [ -z "$ARCHITECTURE" ] || [ -z "$VERSION" ] || [ -z "$BINARY_PATH" ] || [ -z "$OUTPUT_PATH" ]; then
|
||||||
|
echo "Usage: $0 <architecture> <version> <binary_path> <output_path>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
PROJECT=$(cd "$(dirname "$0")/.."; pwd)
|
||||||
|
|
||||||
|
# Convert version to APK format:
|
||||||
|
# 1.13.0-beta.8 -> 1.13.0_beta8-r0
|
||||||
|
# 1.13.0-rc.3 -> 1.13.0_rc3-r0
|
||||||
|
# 1.13.0 -> 1.13.0-r0
|
||||||
|
APK_VERSION=$(echo "$VERSION" | sed -E 's/-([a-z]+)\.([0-9]+)/_\1\2/')
|
||||||
|
APK_VERSION="${APK_VERSION}-r0"
|
||||||
|
|
||||||
|
ROOT_DIR=$(mktemp -d)
|
||||||
|
prepare_apk_root
|
||||||
|
trap 'rm -rf "$ROOT_DIR" "$APK_ROOT_DIR"' EXIT
|
||||||
|
|
||||||
|
# Binary
|
||||||
|
install -Dm755 "$BINARY_PATH" "$ROOT_DIR/usr/bin/sing-box"
|
||||||
|
|
||||||
|
# Config files
|
||||||
|
install -Dm644 "$PROJECT/release/config/config.json" "$ROOT_DIR/etc/sing-box/config.json"
|
||||||
|
install -Dm755 "$PROJECT/release/config/sing-box.initd" "$ROOT_DIR/etc/init.d/sing-box"
|
||||||
|
install -Dm644 "$PROJECT/release/config/sing-box.confd" "$ROOT_DIR/etc/conf.d/sing-box"
|
||||||
|
|
||||||
|
# Service files
|
||||||
|
install -Dm644 "$PROJECT/release/config/sing-box.service" "$ROOT_DIR/usr/lib/systemd/system/sing-box.service"
|
||||||
|
install -Dm644 "$PROJECT/release/config/sing-box@.service" "$ROOT_DIR/usr/lib/systemd/system/sing-box@.service"
|
||||||
|
|
||||||
|
# Completions
|
||||||
|
install -Dm644 "$PROJECT/release/completions/sing-box.bash" "$ROOT_DIR/usr/share/bash-completion/completions/sing-box.bash"
|
||||||
|
install -Dm644 "$PROJECT/release/completions/sing-box.fish" "$ROOT_DIR/usr/share/fish/vendor_completions.d/sing-box.fish"
|
||||||
|
install -Dm644 "$PROJECT/release/completions/sing-box.zsh" "$ROOT_DIR/usr/share/zsh/site-functions/_sing-box"
|
||||||
|
|
||||||
|
# License
|
||||||
|
install -Dm644 "$PROJECT/LICENSE" "$ROOT_DIR/usr/share/licenses/sing-box/LICENSE"
|
||||||
|
|
||||||
|
# APK metadata
|
||||||
|
PACKAGES_DIR="$ROOT_DIR/lib/apk/packages"
|
||||||
|
mkdir -p "$PACKAGES_DIR"
|
||||||
|
|
||||||
|
# .conffiles
|
||||||
|
cat > "$PACKAGES_DIR/.conffiles" <<'EOF'
|
||||||
|
/etc/conf.d/sing-box
|
||||||
|
/etc/init.d/sing-box
|
||||||
|
/etc/sing-box/config.json
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# .conffiles_static (sha256 checksums)
|
||||||
|
while IFS= read -r conffile; do
|
||||||
|
sha256=$(sha256sum "$ROOT_DIR$conffile" | cut -d' ' -f1)
|
||||||
|
echo "$conffile $sha256"
|
||||||
|
done < "$PACKAGES_DIR/.conffiles" > "$PACKAGES_DIR/.conffiles_static"
|
||||||
|
|
||||||
|
# .list (all files, excluding lib/apk/packages/ metadata)
|
||||||
|
(cd "$ROOT_DIR" && find . -type f -o -type l) \
|
||||||
|
| sed 's|^\./|/|' \
|
||||||
|
| grep -v '^/lib/apk/packages/' \
|
||||||
|
| sort > "$PACKAGES_DIR/.list"
|
||||||
|
|
||||||
|
# Build APK
|
||||||
|
apk --root "$APK_ROOT_DIR" mkpkg \
|
||||||
|
--info "name:sing-box" \
|
||||||
|
--info "version:${APK_VERSION}" \
|
||||||
|
--info "description:The universal proxy platform." \
|
||||||
|
--info "arch:${ARCHITECTURE}" \
|
||||||
|
--info "license:GPL-3.0-or-later with name use or association addition" \
|
||||||
|
--info "origin:sing-box" \
|
||||||
|
--info "url:https://sing-box.sagernet.org/" \
|
||||||
|
--info "maintainer:nekohasekai <contact-git@sekai.icu>" \
|
||||||
|
--files "$ROOT_DIR" \
|
||||||
|
--output "$OUTPUT_PATH"
|
||||||
Executable
+91
@@ -0,0 +1,91 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e -o pipefail
|
||||||
|
|
||||||
|
prepare_apk_root() {
|
||||||
|
# apk mkpkg resolves owner/group names through --root/etc/{passwd,group}.
|
||||||
|
APK_ROOT_DIR=$(mktemp -d)
|
||||||
|
mkdir -p "$APK_ROOT_DIR/etc"
|
||||||
|
cat > "$APK_ROOT_DIR/etc/passwd" <<EOF
|
||||||
|
root:x:$(id -u):$(id -g):root:/root:/sbin/nologin
|
||||||
|
EOF
|
||||||
|
cat > "$APK_ROOT_DIR/etc/group" <<EOF
|
||||||
|
root:x:$(id -g):root
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
ARCHITECTURE="$1"
|
||||||
|
VERSION="$2"
|
||||||
|
BINARY_PATH="$3"
|
||||||
|
OUTPUT_PATH="$4"
|
||||||
|
|
||||||
|
if [ -z "$ARCHITECTURE" ] || [ -z "$VERSION" ] || [ -z "$BINARY_PATH" ] || [ -z "$OUTPUT_PATH" ]; then
|
||||||
|
echo "Usage: $0 <architecture> <version> <binary_path> <output_path>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
PROJECT=$(cd "$(dirname "$0")/.."; pwd)
|
||||||
|
|
||||||
|
# Convert version to APK format:
|
||||||
|
APK_VERSION=$(echo "$VERSION" | sed -E 's/-([a-z]+)\.([0-9]+)/_\1\2/' | sed -E 's/-[a-z]+-/./g')
|
||||||
|
APK_VERSION="${APK_VERSION}-r0"
|
||||||
|
|
||||||
|
ROOT_DIR=$(mktemp -d)
|
||||||
|
prepare_apk_root
|
||||||
|
trap 'rm -rf "$ROOT_DIR" "$APK_ROOT_DIR"' EXIT
|
||||||
|
|
||||||
|
# Binary
|
||||||
|
install -Dm755 "$BINARY_PATH" "$ROOT_DIR/usr/bin/sing-box"
|
||||||
|
|
||||||
|
# Config files
|
||||||
|
install -Dm644 "$PROJECT/release/config/config.json" "$ROOT_DIR/etc/sing-box/config.json"
|
||||||
|
install -Dm644 "$PROJECT/release/config/openwrt.conf" "$ROOT_DIR/etc/config/sing-box"
|
||||||
|
install -Dm755 "$PROJECT/release/config/openwrt.init" "$ROOT_DIR/etc/init.d/sing-box"
|
||||||
|
install -Dm644 "$PROJECT/release/config/openwrt.keep" "$ROOT_DIR/lib/upgrade/keep.d/sing-box"
|
||||||
|
|
||||||
|
# Completions
|
||||||
|
install -Dm644 "$PROJECT/release/completions/sing-box.bash" "$ROOT_DIR/usr/share/bash-completion/completions/sing-box.bash"
|
||||||
|
install -Dm644 "$PROJECT/release/completions/sing-box.fish" "$ROOT_DIR/usr/share/fish/vendor_completions.d/sing-box.fish"
|
||||||
|
install -Dm644 "$PROJECT/release/completions/sing-box.zsh" "$ROOT_DIR/usr/share/zsh/site-functions/_sing-box"
|
||||||
|
|
||||||
|
# License
|
||||||
|
install -Dm644 "$PROJECT/LICENSE" "$ROOT_DIR/usr/share/licenses/sing-box/LICENSE"
|
||||||
|
|
||||||
|
# APK metadata
|
||||||
|
PACKAGES_DIR="$ROOT_DIR/lib/apk/packages"
|
||||||
|
mkdir -p "$PACKAGES_DIR"
|
||||||
|
|
||||||
|
# .conffiles
|
||||||
|
cat > "$PACKAGES_DIR/.conffiles" <<'EOF'
|
||||||
|
/etc/config/sing-box
|
||||||
|
/etc/sing-box/config.json
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# .conffiles_static (sha256 checksums)
|
||||||
|
while IFS= read -r conffile; do
|
||||||
|
sha256=$(sha256sum "$ROOT_DIR$conffile" | cut -d' ' -f1)
|
||||||
|
echo "$conffile $sha256"
|
||||||
|
done < "$PACKAGES_DIR/.conffiles" > "$PACKAGES_DIR/.conffiles_static"
|
||||||
|
|
||||||
|
# .list (all files, excluding lib/apk/packages/ metadata)
|
||||||
|
(cd "$ROOT_DIR" && find . -type f -o -type l) \
|
||||||
|
| sed 's|^\./|/|' \
|
||||||
|
| grep -v '^/lib/apk/packages/' \
|
||||||
|
| sort > "$PACKAGES_DIR/.list"
|
||||||
|
|
||||||
|
# Build APK
|
||||||
|
apk --root "$APK_ROOT_DIR" mkpkg \
|
||||||
|
--info "name:sing-box-extended" \
|
||||||
|
--info "version:${APK_VERSION}" \
|
||||||
|
--info "description:The universal proxy platform (extended)." \
|
||||||
|
--info "arch:${ARCHITECTURE}" \
|
||||||
|
--info "license:GPL-3.0-or-later" \
|
||||||
|
--info "origin:sing-box-extended" \
|
||||||
|
--info "url:https://sing-box.sagernet.org/" \
|
||||||
|
--info "maintainer:nekohasekai <contact-git@sekai.icu>" \
|
||||||
|
--info "depends:ca-bundle kmod-inet-diag kmod-tun firewall4 kmod-nft-queue" \
|
||||||
|
--info "provides:sing-box" \
|
||||||
|
--info "provider-priority:100" \
|
||||||
|
--script "pre-deinstall:${PROJECT}/release/config/openwrt.prerm" \
|
||||||
|
--files "$ROOT_DIR" \
|
||||||
|
--output "$OUTPUT_PATH"
|
||||||
Executable
+57
@@ -0,0 +1,57 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e -o pipefail
|
||||||
|
|
||||||
|
VERSION="$1"
|
||||||
|
TARGET="$2"
|
||||||
|
BINARY_PATH="$3"
|
||||||
|
|
||||||
|
PROJECT=$(cd "$(dirname "$0")/.."; pwd)
|
||||||
|
DIST="$PROJECT/dist"
|
||||||
|
|
||||||
|
case "$TARGET" in
|
||||||
|
linux_amd64*) ARCHITECTURES="x86_64" ;;
|
||||||
|
linux_arm64*) ARCHITECTURES="aarch64_cortex-a53 aarch64_cortex-a72 aarch64_cortex-a76 aarch64_generic" ;;
|
||||||
|
linux_386*softfloat) ARCHITECTURES="i386_pentium-mmx" ;;
|
||||||
|
linux_386*) ARCHITECTURES="i386_pentium4" ;;
|
||||||
|
linux_arm_7*) ARCHITECTURES="arm_cortex-a5_vfpv4 arm_cortex-a7_neon-vfpv4 arm_cortex-a7_vfpv4 arm_cortex-a8_vfpv3 arm_cortex-a9_neon arm_cortex-a9_vfpv3-d16 arm_cortex-a15_neon-vfpv4" ;;
|
||||||
|
linux_arm_6*) ARCHITECTURES="arm_arm1176jzf-s_vfp" ;;
|
||||||
|
linux_arm_5*) ARCHITECTURES="arm_arm926ej-s arm_cortex-a7 arm_cortex-a9 arm_fa526 arm_xscale" ;;
|
||||||
|
linux_mips64_*) ARCHITECTURES="mips64_mips64r2 mips64_octeonplus" ;;
|
||||||
|
linux_mips64le*) ARCHITECTURES="mips64el_mips64r2" ;;
|
||||||
|
linux_mipsle*hardfloat) ARCHITECTURES="mipsel_24kc_24kf" ;;
|
||||||
|
linux_mipsle*) ARCHITECTURES="mipsel_24kc mipsel_74kc mipsel_mips32" ;;
|
||||||
|
linux_mips_*) ARCHITECTURES="mips_24kc mips_4kec mips_mips32" ;;
|
||||||
|
linux_riscv64*) ARCHITECTURES="riscv64_generic" ;;
|
||||||
|
linux_loong64*) ARCHITECTURES="loongarch64_generic" ;;
|
||||||
|
*) echo "Unknown target: $TARGET"; exit 1 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
PKG_VERSION="${VERSION//-/\~}"
|
||||||
|
|
||||||
|
FPM_DIR=$(mktemp -d)
|
||||||
|
sed "s|release/|$PROJECT/release/|g;s|^LICENSE|$PROJECT/LICENSE|" "$PROJECT/.fpm_openwrt" > "$FPM_DIR/.fpm"
|
||||||
|
trap 'rm -rf "$FPM_DIR"' EXIT
|
||||||
|
|
||||||
|
for ARCH in $ARCHITECTURES; do
|
||||||
|
TMP_DEB=$(mktemp -p "$DIST" _openwrt_XXXXXX.deb)
|
||||||
|
rm -f "$TMP_DEB"
|
||||||
|
(cd "$FPM_DIR" && fpm -t deb \
|
||||||
|
-v "$PKG_VERSION" \
|
||||||
|
-p "$TMP_DEB" \
|
||||||
|
--architecture all \
|
||||||
|
"$BINARY_PATH=/usr/bin/sing-box")
|
||||||
|
|
||||||
|
bash "$PROJECT/.github/deb2ipk.sh" \
|
||||||
|
"$ARCH" \
|
||||||
|
"$TMP_DEB" \
|
||||||
|
"$DIST/sing-box-extended_${VERSION}_openwrt_${ARCH}.ipk"
|
||||||
|
rm -f "$TMP_DEB"
|
||||||
|
|
||||||
|
if command -v apk &>/dev/null; then
|
||||||
|
bash "$PROJECT/.github/build_openwrt_apk.sh" \
|
||||||
|
"$ARCH" "$VERSION" "$BINARY_PATH" \
|
||||||
|
"$DIST/sing-box-extended_${VERSION}_openwrt_${ARCH}.apk"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Built: sing-box-extended_${VERSION}_openwrt_${ARCH} (.ipk/.apk)"
|
||||||
|
done
|
||||||
Executable
+33
@@ -0,0 +1,33 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
branches=$(git branch -r --contains HEAD)
|
||||||
|
if echo "$branches" | grep -q 'origin/stable'; then
|
||||||
|
track=stable
|
||||||
|
elif echo "$branches" | grep -q 'origin/testing'; then
|
||||||
|
track=testing
|
||||||
|
elif echo "$branches" | grep -q 'origin/oldstable'; then
|
||||||
|
track=oldstable
|
||||||
|
else
|
||||||
|
echo "ERROR: HEAD is not on any known release branch (stable/testing/oldstable)" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$track" == "stable" ]]; then
|
||||||
|
tag=$(git describe --tags --exact-match HEAD 2>/dev/null || true)
|
||||||
|
if [[ -n "$tag" && "$tag" == *"-"* ]]; then
|
||||||
|
track=beta
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$track" in
|
||||||
|
stable) name=sing-box; docker_tag=latest ;;
|
||||||
|
beta) name=sing-box-beta; docker_tag=latest-beta ;;
|
||||||
|
testing) name=sing-box-testing; docker_tag=latest-testing ;;
|
||||||
|
oldstable) name=sing-box-oldstable; docker_tag=latest-oldstable ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo "track=${track} name=${name} docker_tag=${docker_tag}" >&2
|
||||||
|
echo "TRACK=${track}" >> "$GITHUB_ENV"
|
||||||
|
echo "NAME=${name}" >> "$GITHUB_ENV"
|
||||||
|
echo "DOCKER_TAG=${docker_tag}" >> "$GITHUB_ENV"
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
":disableRateLimiting"
|
":disableRateLimiting"
|
||||||
],
|
],
|
||||||
"baseBranches": [
|
"baseBranches": [
|
||||||
"dev-next"
|
"unstable"
|
||||||
],
|
],
|
||||||
"golang": {
|
"golang": {
|
||||||
"enabled": false
|
"enabled": false
|
||||||
|
|||||||
Executable
+47
@@ -0,0 +1,47 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
VERSION="1.26.7"
|
||||||
|
PATCH_COMMITS=(
|
||||||
|
"f080b0c6346eb690c0dc82497b35925f385b35ac"
|
||||||
|
"2d9c12887c342fb9051d231aa5388743cb7e9cb6"
|
||||||
|
"367663849c656612fc3c8875ef6e7f6b0c93dbd0"
|
||||||
|
)
|
||||||
|
CURL_ARGS=(
|
||||||
|
-fL
|
||||||
|
--silent
|
||||||
|
--show-error
|
||||||
|
)
|
||||||
|
|
||||||
|
if [[ -n "${GITHUB_TOKEN:-}" ]]; then
|
||||||
|
CURL_ARGS+=(-H "Authorization: Bearer ${GITHUB_TOKEN}")
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p "$HOME/go"
|
||||||
|
cd "$HOME/go"
|
||||||
|
wget "https://dl.google.com/go/go${VERSION}.darwin-arm64.tar.gz"
|
||||||
|
tar -xzf "go${VERSION}.darwin-arm64.tar.gz"
|
||||||
|
#cp -a go go_bootstrap
|
||||||
|
mv go go_osx
|
||||||
|
cd go_osx
|
||||||
|
|
||||||
|
# these patch URLs only work on golang1.26.x
|
||||||
|
# that means after golang1.27 release it must be changed
|
||||||
|
# see: https://github.com/SagerNet/go/commits/release-branch.go1.26/
|
||||||
|
# revert:
|
||||||
|
# 33d3f603c1: "cmd/link/internal/ld: use 12.0.0 OS/SDK versions for macOS linking"
|
||||||
|
# 937368f84e: "crypto/x509: change how we retrieve chains on darwin"
|
||||||
|
# d90a57ffe8: "cmd/link/internal/ld: unify OS/SDK versions for macOS linking"
|
||||||
|
|
||||||
|
for patch_commit in "${PATCH_COMMITS[@]}"; do
|
||||||
|
curl "${CURL_ARGS[@]}" "https://github.com/SagerNet/go/commit/${patch_commit}.diff" | patch --verbose -p 1
|
||||||
|
done
|
||||||
|
|
||||||
|
# Rebuild is not needed: we build with CGO_ENABLED=1, so Apple's external
|
||||||
|
# linker handles LC_BUILD_VERSION via MACOSX_DEPLOYMENT_TARGET, and the
|
||||||
|
# stdlib (crypto/x509) is compiled from patched src automatically.
|
||||||
|
#cd src
|
||||||
|
#GOROOT_BOOTSTRAP="$HOME/go/go_bootstrap" ./make.bash
|
||||||
|
#cd ../..
|
||||||
|
#rm -rf go_bootstrap "go${VERSION}.darwin-arm64.tar.gz"
|
||||||
Executable
+46
@@ -0,0 +1,46 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
VERSION="1.26.7"
|
||||||
|
PATCH_COMMITS=(
|
||||||
|
"a4ae550aa148b04c9d4890e98bee63aede5c4b53"
|
||||||
|
"95b851f661584711faa8115b3234a461044f4510"
|
||||||
|
"b0bf0a863cf218b9bb0d6c013903ab160ae0c39b"
|
||||||
|
"7c7a2a0d68920f8764d9a3aeae7ad1067a17b3fa"
|
||||||
|
"ba34356e82f3c12a7303d2231e6ea0e42bbbb3bf"
|
||||||
|
"472a88edbc2a42feb53fa31d29ab54d33840dca6"
|
||||||
|
)
|
||||||
|
CURL_ARGS=(
|
||||||
|
-fL
|
||||||
|
--silent
|
||||||
|
--show-error
|
||||||
|
)
|
||||||
|
|
||||||
|
if [[ -n "${GITHUB_TOKEN:-}" ]]; then
|
||||||
|
CURL_ARGS+=(-H "Authorization: Bearer ${GITHUB_TOKEN}")
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p "$HOME/go"
|
||||||
|
cd "$HOME/go"
|
||||||
|
wget "https://dl.google.com/go/go${VERSION}.linux-amd64.tar.gz"
|
||||||
|
tar -xzf "go${VERSION}.linux-amd64.tar.gz"
|
||||||
|
mv go go_win7
|
||||||
|
cd go_win7
|
||||||
|
|
||||||
|
# modify from https://github.com/restic/restic/issues/4636#issuecomment-1896455557
|
||||||
|
# these patch URLs only work on golang1.26.x
|
||||||
|
# that means after golang1.27 release it must be changed
|
||||||
|
# see: https://github.com/MetaCubeX/go/commits/release-branch.go1.26/
|
||||||
|
# revert:
|
||||||
|
# 693def151adff1af707d82d28f55dba81ceb08e1: "crypto/rand,runtime: switch RtlGenRandom for ProcessPrng"
|
||||||
|
# 7c1157f9544922e96945196b47b95664b1e39108: "net: remove sysSocket fallback for Windows 7"
|
||||||
|
# 48042aa09c2f878c4faa576948b07fe625c4707a: "syscall: remove Windows 7 console handle workaround"
|
||||||
|
# a17d959debdb04cd550016a3501dd09d50cd62e7: "runtime: always use LoadLibraryEx to load system libraries"
|
||||||
|
# fixes:
|
||||||
|
# bed309eff415bcb3c77dd4bc3277b682b89a388d: "Fix os.RemoveAll not working on Windows7"
|
||||||
|
# 34b899c2fb39b092db4fa67c4417e41dc046be4b: "Revert \"os: remove 5ms sleep on Windows in (*Process).Wait\""
|
||||||
|
|
||||||
|
for patch_commit in "${PATCH_COMMITS[@]}"; do
|
||||||
|
curl "${CURL_ARGS[@]}" "https://github.com/MetaCubeX/go/commit/${patch_commit}.diff" | patch --verbose -p 1
|
||||||
|
done
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
VERSION="1.23.6"
|
|
||||||
|
|
||||||
mkdir -p $HOME/go
|
|
||||||
cd $HOME/go
|
|
||||||
wget "https://dl.google.com/go/go${VERSION}.linux-amd64.tar.gz"
|
|
||||||
tar -xzf "go${VERSION}.linux-amd64.tar.gz"
|
|
||||||
mv go go_legacy
|
|
||||||
cd go_legacy
|
|
||||||
|
|
||||||
# modify from https://github.com/restic/restic/issues/4636#issuecomment-1896455557
|
|
||||||
# this patch file only works on golang1.23.x
|
|
||||||
# that means after golang1.24 release it must be changed
|
|
||||||
# see: https://github.com/MetaCubeX/go/commits/release-branch.go1.23/
|
|
||||||
# revert:
|
|
||||||
# 693def151adff1af707d82d28f55dba81ceb08e1: "crypto/rand,runtime: switch RtlGenRandom for ProcessPrng"
|
|
||||||
# 7c1157f9544922e96945196b47b95664b1e39108: "net: remove sysSocket fallback for Windows 7"
|
|
||||||
# 48042aa09c2f878c4faa576948b07fe625c4707a: "syscall: remove Windows 7 console handle workaround"
|
|
||||||
# a17d959debdb04cd550016a3501dd09d50cd62e7: "runtime: always use LoadLibraryEx to load system libraries"
|
|
||||||
|
|
||||||
curl https://github.com/MetaCubeX/go/commit/9ac42137ef6730e8b7daca016ece831297a1d75b.diff | patch --verbose -p 1
|
|
||||||
curl https://github.com/MetaCubeX/go/commit/21290de8a4c91408de7c2b5b68757b1e90af49dd.diff | patch --verbose -p 1
|
|
||||||
curl https://github.com/MetaCubeX/go/commit/6a31d3fa8e47ddabc10bd97bff10d9a85f4cfb76.diff | patch --verbose -p 1
|
|
||||||
curl https://github.com/MetaCubeX/go/commit/69e2eed6dd0f6d815ebf15797761c13f31213dd6.diff | patch --verbose -p 1
|
|
||||||
@@ -4,7 +4,7 @@ PROJECTS=$(dirname "$0")/../..
|
|||||||
|
|
||||||
function updateClient() {
|
function updateClient() {
|
||||||
pushd clients/$1
|
pushd clients/$1
|
||||||
git fetch
|
git fetch origin main
|
||||||
git reset FETCH_HEAD --hard
|
git reset FETCH_HEAD --hard
|
||||||
popd
|
popd
|
||||||
git add clients/$1
|
git add clients/$1
|
||||||
@@ -12,3 +12,4 @@ function updateClient() {
|
|||||||
|
|
||||||
updateClient "apple"
|
updateClient "apple"
|
||||||
updateClient "android"
|
updateClient "android"
|
||||||
|
updateClient "desktop"
|
||||||
|
|||||||
Executable
+13
@@ -0,0 +1,13 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e -o pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR=$(dirname "$0")
|
||||||
|
PROJECTS=$SCRIPT_DIR/../..
|
||||||
|
|
||||||
|
git -C $PROJECTS/cronet-go fetch origin main
|
||||||
|
git -C $PROJECTS/cronet-go fetch origin go
|
||||||
|
go get -x github.com/sagernet/cronet-go/all@$(git -C $PROJECTS/cronet-go rev-parse origin/go)
|
||||||
|
go get -x github.com/sagernet/cronet-go@$(git -C $PROJECTS/cronet-go rev-parse origin/go)
|
||||||
|
go mod tidy
|
||||||
|
git -C $PROJECTS/cronet-go rev-parse origin/go > "$SCRIPT_DIR/CRONET_GO_VERSION"
|
||||||
Executable
+13
@@ -0,0 +1,13 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e -o pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR=$(dirname "$0")
|
||||||
|
PROJECTS=$SCRIPT_DIR/../..
|
||||||
|
|
||||||
|
git -C $PROJECTS/cronet-go fetch origin dev
|
||||||
|
git -C $PROJECTS/cronet-go fetch origin go_dev
|
||||||
|
go get -x github.com/sagernet/cronet-go/all@$(git -C $PROJECTS/cronet-go rev-parse origin/go_dev)
|
||||||
|
go get -x github.com/sagernet/cronet-go@$(git -C $PROJECTS/cronet-go rev-parse origin/go_dev)
|
||||||
|
go mod tidy
|
||||||
|
git -C $PROJECTS/cronet-go rev-parse origin/go_dev > "$SCRIPT_DIR/CRONET_GO_VERSION"
|
||||||
+1370
-241
File diff suppressed because it is too large
Load Diff
+186
-23
@@ -1,6 +1,10 @@
|
|||||||
name: Publish Docker Images
|
name: Publish Docker Images
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
#push:
|
||||||
|
# branches:
|
||||||
|
# - stable
|
||||||
|
# - testing
|
||||||
release:
|
release:
|
||||||
types:
|
types:
|
||||||
- published
|
- published
|
||||||
@@ -13,20 +17,25 @@ env:
|
|||||||
REGISTRY_IMAGE: ghcr.io/sagernet/sing-box
|
REGISTRY_IMAGE: ghcr.io/sagernet/sing-box
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build_binary:
|
||||||
|
name: Build binary
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: true
|
fail-fast: true
|
||||||
matrix:
|
matrix:
|
||||||
platform:
|
include:
|
||||||
- linux/amd64
|
# Naive-enabled builds (musl)
|
||||||
- linux/arm/v6
|
- { arch: amd64, naive: true, docker_platform: "linux/amd64" }
|
||||||
- linux/arm/v7
|
- { arch: arm64, naive: true, docker_platform: "linux/arm64" }
|
||||||
- linux/arm64
|
- { arch: "386", naive: true, docker_platform: "linux/386" }
|
||||||
- linux/386
|
- { arch: arm, goarm: "7", naive: true, docker_platform: "linux/arm/v7" }
|
||||||
- linux/ppc64le
|
- { arch: mipsle, gomips: softfloat, naive: true, docker_platform: "linux/mipsle" }
|
||||||
- linux/riscv64
|
- { arch: riscv64, naive: true, docker_platform: "linux/riscv64" }
|
||||||
- linux/s390x
|
- { arch: loong64, naive: true, docker_platform: "linux/loong64" }
|
||||||
|
# Non-naive builds
|
||||||
|
- { arch: arm, goarm: "6", docker_platform: "linux/arm/v6" }
|
||||||
|
- { arch: ppc64le, docker_platform: "linux/ppc64le" }
|
||||||
|
- { arch: s390x, docker_platform: "linux/s390x" }
|
||||||
steps:
|
steps:
|
||||||
- name: Get commit to build
|
- name: Get commit to build
|
||||||
id: ref
|
id: ref
|
||||||
@@ -39,7 +48,147 @@ jobs:
|
|||||||
echo "ref=$ref"
|
echo "ref=$ref"
|
||||||
echo "ref=$ref" >> $GITHUB_OUTPUT
|
echo "ref=$ref" >> $GITHUB_OUTPUT
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
|
||||||
|
with:
|
||||||
|
ref: ${{ steps.ref.outputs.ref }}
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: 1.26.7
|
||||||
|
- name: Clone cronet-go
|
||||||
|
if: matrix.naive
|
||||||
|
run: |
|
||||||
|
set -xeuo pipefail
|
||||||
|
CRONET_GO_VERSION=$(cat .github/CRONET_GO_VERSION)
|
||||||
|
git init ~/cronet-go
|
||||||
|
git -C ~/cronet-go remote add origin https://github.com/sagernet/cronet-go.git
|
||||||
|
git -C ~/cronet-go sparse-checkout set --no-cone '/*' '!/lib'
|
||||||
|
git -C ~/cronet-go fetch --depth=1 --filter=blob:none origin "$CRONET_GO_VERSION"
|
||||||
|
git -C ~/cronet-go checkout FETCH_HEAD
|
||||||
|
git -C ~/cronet-go submodule update --init --recursive --depth=1
|
||||||
|
- name: Regenerate Debian keyring
|
||||||
|
if: matrix.naive
|
||||||
|
run: |
|
||||||
|
set -xeuo pipefail
|
||||||
|
rm -f ~/cronet-go/naiveproxy/src/build/linux/sysroot_scripts/keyring.gpg
|
||||||
|
cd ~/cronet-go
|
||||||
|
GPG_TTY=/dev/null ./naiveproxy/src/build/linux/sysroot_scripts/generate_keyring.sh
|
||||||
|
- name: Cache Chromium toolchain
|
||||||
|
if: matrix.naive
|
||||||
|
id: cache-chromium-toolchain
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/cronet-go/naiveproxy/src/third_party/llvm-build/
|
||||||
|
~/cronet-go/naiveproxy/src/gn/out/
|
||||||
|
~/cronet-go/naiveproxy/src/chrome/build/pgo_profiles/
|
||||||
|
~/cronet-go/naiveproxy/src/out/sysroot-build/
|
||||||
|
key: chromium-toolchain-${{ matrix.arch }}-musl-${{ hashFiles('.github/CRONET_GO_VERSION') }}
|
||||||
|
- name: Download Chromium toolchain
|
||||||
|
if: matrix.naive
|
||||||
|
run: |
|
||||||
|
set -xeuo pipefail
|
||||||
|
cd ~/cronet-go
|
||||||
|
go run ./cmd/build-naive --target=linux/${{ matrix.arch }} --libc=musl download-toolchain
|
||||||
|
- name: Set version
|
||||||
|
run: |
|
||||||
|
set -xeuo pipefail
|
||||||
|
VERSION=$(go run ./cmd/internal/read_tag)
|
||||||
|
echo "VERSION=${VERSION}" >> "${GITHUB_ENV}"
|
||||||
|
- name: Set Chromium toolchain environment
|
||||||
|
if: matrix.naive
|
||||||
|
run: |
|
||||||
|
set -xeuo pipefail
|
||||||
|
cd ~/cronet-go
|
||||||
|
go run ./cmd/build-naive --target=linux/${{ matrix.arch }} --libc=musl env >> $GITHUB_ENV
|
||||||
|
- name: Set build tags
|
||||||
|
run: |
|
||||||
|
set -xeuo pipefail
|
||||||
|
if [[ "${{ matrix.naive }}" == "true" ]]; then
|
||||||
|
TAGS="$(cat release/DEFAULT_BUILD_TAGS),with_musl"
|
||||||
|
else
|
||||||
|
TAGS=$(cat release/DEFAULT_BUILD_TAGS_OTHERS)
|
||||||
|
fi
|
||||||
|
echo "BUILD_TAGS=${TAGS}" >> "${GITHUB_ENV}"
|
||||||
|
- name: Set shared ldflags
|
||||||
|
run: |
|
||||||
|
echo "LDFLAGS_SHARED=$(cat release/LDFLAGS)" >> "${GITHUB_ENV}"
|
||||||
|
- name: Build (naive)
|
||||||
|
if: matrix.naive
|
||||||
|
run: |
|
||||||
|
set -xeuo pipefail
|
||||||
|
go build -v -trimpath -o sing-box -tags "${BUILD_TAGS}" \
|
||||||
|
-ldflags "-X 'github.com/sagernet/sing-box/constant.Version=${VERSION}' ${LDFLAGS_SHARED} -s -w -buildid=" \
|
||||||
|
./cmd/sing-box
|
||||||
|
env:
|
||||||
|
CGO_ENABLED: "1"
|
||||||
|
GOOS: linux
|
||||||
|
GOARCH: ${{ matrix.arch }}
|
||||||
|
GOARM: ${{ matrix.goarm }}
|
||||||
|
GOMIPS: ${{ matrix.gomips }}
|
||||||
|
- name: Build (non-naive)
|
||||||
|
if: ${{ ! matrix.naive }}
|
||||||
|
run: |
|
||||||
|
set -xeuo pipefail
|
||||||
|
go build -v -trimpath -o sing-box -tags "${BUILD_TAGS}" \
|
||||||
|
-ldflags "-X 'github.com/sagernet/sing-box/constant.Version=${VERSION}' ${LDFLAGS_SHARED} -s -w -buildid=" \
|
||||||
|
./cmd/sing-box
|
||||||
|
env:
|
||||||
|
CGO_ENABLED: "0"
|
||||||
|
GOOS: linux
|
||||||
|
GOARCH: ${{ matrix.arch }}
|
||||||
|
GOARM: ${{ matrix.goarm }}
|
||||||
|
- name: Prepare artifact
|
||||||
|
run: |
|
||||||
|
platform=${{ matrix.docker_platform }}
|
||||||
|
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
||||||
|
# Rename binary to include arch info for Dockerfile.binary
|
||||||
|
BINARY_NAME="sing-box-${{ matrix.arch }}"
|
||||||
|
if [[ -n "${{ matrix.goarm }}" ]]; then
|
||||||
|
BINARY_NAME="${BINARY_NAME}v${{ matrix.goarm }}"
|
||||||
|
fi
|
||||||
|
mv sing-box "${BINARY_NAME}"
|
||||||
|
echo "BINARY_NAME=${BINARY_NAME}" >> $GITHUB_ENV
|
||||||
|
- name: Upload binary
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: binary-${{ env.PLATFORM_PAIR }}
|
||||||
|
path: ${{ env.BINARY_NAME }}
|
||||||
|
if-no-files-found: error
|
||||||
|
retention-days: 1
|
||||||
|
build_docker:
|
||||||
|
name: Build Docker image
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- build_binary
|
||||||
|
strategy:
|
||||||
|
fail-fast: true
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- { platform: "linux/amd64" }
|
||||||
|
- { platform: "linux/arm/v6" }
|
||||||
|
- { platform: "linux/arm/v7" }
|
||||||
|
- { platform: "linux/arm64" }
|
||||||
|
- { platform: "linux/386" }
|
||||||
|
# mipsle: no base Docker image available for this platform
|
||||||
|
- { platform: "linux/ppc64le" }
|
||||||
|
- { platform: "linux/riscv64" }
|
||||||
|
- { platform: "linux/s390x" }
|
||||||
|
- { platform: "linux/loong64", base_image: "ghcr.io/loong64/alpine:edge" }
|
||||||
|
steps:
|
||||||
|
- name: Get commit to build
|
||||||
|
id: ref
|
||||||
|
run: |-
|
||||||
|
if [[ -z "${{ github.event.inputs.tag }}" ]]; then
|
||||||
|
ref="${{ github.ref_name }}"
|
||||||
|
else
|
||||||
|
ref="${{ github.event.inputs.tag }}"
|
||||||
|
fi
|
||||||
|
echo "ref=$ref"
|
||||||
|
echo "ref=$ref" >> $GITHUB_OUTPUT
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
|
||||||
with:
|
with:
|
||||||
ref: ${{ steps.ref.outputs.ref }}
|
ref: ${{ steps.ref.outputs.ref }}
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
@@ -47,6 +196,16 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
platform=${{ matrix.platform }}
|
platform=${{ matrix.platform }}
|
||||||
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
||||||
|
- name: Download binary
|
||||||
|
uses: actions/download-artifact@v5
|
||||||
|
with:
|
||||||
|
name: binary-${{ env.PLATFORM_PAIR }}
|
||||||
|
path: .
|
||||||
|
- name: Prepare binary
|
||||||
|
run: |
|
||||||
|
# Find and make the binary executable
|
||||||
|
chmod +x sing-box-*
|
||||||
|
ls -la sing-box-*
|
||||||
- name: Setup QEMU
|
- name: Setup QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
- name: Setup Docker Buildx
|
- name: Setup Docker Buildx
|
||||||
@@ -68,8 +227,9 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
platforms: ${{ matrix.platform }}
|
platforms: ${{ matrix.platform }}
|
||||||
context: .
|
context: .
|
||||||
|
file: Dockerfile.binary
|
||||||
build-args: |
|
build-args: |
|
||||||
BUILDKIT_CONTEXT_KEEP_GIT_DIR=1
|
BASE_IMAGE=${{ matrix.base_image || 'alpine' }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
|
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
|
||||||
- name: Export digest
|
- name: Export digest
|
||||||
@@ -85,9 +245,10 @@ jobs:
|
|||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
merge:
|
merge:
|
||||||
|
if: github.event_name != 'push'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs:
|
||||||
- build
|
- build_docker
|
||||||
steps:
|
steps:
|
||||||
- name: Get commit to build
|
- name: Get commit to build
|
||||||
id: ref
|
id: ref
|
||||||
@@ -99,15 +260,15 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
echo "ref=$ref"
|
echo "ref=$ref"
|
||||||
echo "ref=$ref" >> $GITHUB_OUTPUT
|
echo "ref=$ref" >> $GITHUB_OUTPUT
|
||||||
if [[ $ref == *"-"* ]]; then
|
- name: Checkout
|
||||||
latest=latest-beta
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
|
||||||
else
|
with:
|
||||||
latest=latest
|
ref: ${{ steps.ref.outputs.ref }}
|
||||||
fi
|
fetch-depth: 0
|
||||||
echo "latest=$latest"
|
- name: Detect track
|
||||||
echo "latest=$latest" >> $GITHUB_OUTPUT
|
run: bash .github/detect_track.sh
|
||||||
- name: Download digests
|
- name: Download digests
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v5
|
||||||
with:
|
with:
|
||||||
path: /tmp/digests
|
path: /tmp/digests
|
||||||
pattern: digests-*
|
pattern: digests-*
|
||||||
@@ -121,13 +282,15 @@ jobs:
|
|||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Create manifest list and push
|
- name: Create manifest list and push
|
||||||
|
if: github.event_name != 'push'
|
||||||
working-directory: /tmp/digests
|
working-directory: /tmp/digests
|
||||||
run: |
|
run: |
|
||||||
docker buildx imagetools create \
|
docker buildx imagetools create \
|
||||||
-t "${{ env.REGISTRY_IMAGE }}:${{ steps.ref.outputs.latest }}" \
|
-t "${{ env.REGISTRY_IMAGE }}:${{ env.DOCKER_TAG }}" \
|
||||||
-t "${{ env.REGISTRY_IMAGE }}:${{ steps.ref.outputs.ref }}" \
|
-t "${{ env.REGISTRY_IMAGE }}:${{ steps.ref.outputs.ref }}" \
|
||||||
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
|
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
|
||||||
- name: Inspect image
|
- name: Inspect image
|
||||||
|
if: github.event_name != 'push'
|
||||||
run: |
|
run: |
|
||||||
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.ref.outputs.latest }}
|
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ env.DOCKER_TAG }}
|
||||||
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.ref.outputs.ref }}
|
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.ref.outputs.ref }}
|
||||||
|
|||||||
+51
-10
@@ -3,34 +3,75 @@ name: Lint
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- stable-next
|
- oldstable
|
||||||
- main-next
|
- stable
|
||||||
- dev-next
|
- testing
|
||||||
|
- unstable
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- '**.md'
|
- '**.md'
|
||||||
- '.github/**'
|
- '.github/**'
|
||||||
- '!.github/workflows/lint.yml'
|
- '!.github/workflows/lint.yml'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- stable-next
|
- oldstable
|
||||||
- main-next
|
- stable
|
||||||
- dev-next
|
- testing
|
||||||
|
- unstable
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}-${{ inputs.build }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Lint ${{ matrix.goos }}/${{ matrix.goarch }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- goos: windows
|
||||||
|
goarch: amd64
|
||||||
|
- goos: windows
|
||||||
|
goarch: '386'
|
||||||
|
- goos: windows
|
||||||
|
goarch: arm64
|
||||||
|
- goos: linux
|
||||||
|
goarch: amd64
|
||||||
|
- goos: linux
|
||||||
|
goarch: arm64
|
||||||
|
- goos: linux
|
||||||
|
goarch: arm
|
||||||
|
- goos: linux
|
||||||
|
goarch: '386'
|
||||||
|
- goos: darwin
|
||||||
|
goarch: amd64
|
||||||
|
- goos: darwin
|
||||||
|
goarch: arm64
|
||||||
|
- goos: android
|
||||||
|
goarch: arm64
|
||||||
|
# - goos: freebsd
|
||||||
|
# goarch: amd64
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ^1.24.3
|
go-version: ^1.26
|
||||||
|
- name: Cache go module
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/go/pkg/mod
|
||||||
|
key: go-${{ hashFiles('**/go.sum') }}
|
||||||
- name: golangci-lint
|
- name: golangci-lint
|
||||||
uses: golangci/golangci-lint-action@v6
|
uses: golangci/golangci-lint-action@v8
|
||||||
|
env:
|
||||||
|
GOOS: ${{ matrix.goos }}
|
||||||
|
GOARCH: ${{ matrix.goarch }}
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
args: --timeout=30m
|
args: --timeout=30m
|
||||||
|
|||||||
+91
-32
@@ -1,6 +1,10 @@
|
|||||||
name: Build Linux Packages
|
name: Build Linux Packages
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
#push:
|
||||||
|
# branches:
|
||||||
|
# - stable
|
||||||
|
# - testing
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
version:
|
version:
|
||||||
@@ -19,13 +23,13 @@ jobs:
|
|||||||
version: ${{ steps.outputs.outputs.version }}
|
version: ${{ steps.outputs.outputs.version }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ^1.24.3
|
go-version: 1.26.7
|
||||||
- name: Check input version
|
- name: Check input version
|
||||||
if: github.event_name == 'workflow_dispatch'
|
if: github.event_name == 'workflow_dispatch'
|
||||||
run: |-
|
run: |-
|
||||||
@@ -41,38 +45,75 @@ jobs:
|
|||||||
echo "version=$version" >> "$GITHUB_OUTPUT"
|
echo "version=$version" >> "$GITHUB_OUTPUT"
|
||||||
build:
|
build:
|
||||||
name: Build binary
|
name: Build binary
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-26.04
|
||||||
needs:
|
needs:
|
||||||
- calculate_version
|
- calculate_version
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- { os: linux, arch: amd64, debian: amd64, rpm: x86_64, pacman: x86_64 }
|
# Naive-enabled builds (musl)
|
||||||
- { os: linux, arch: "386", debian: i386, rpm: i386 }
|
- { os: linux, arch: amd64, naive: true, debian: amd64, rpm: x86_64, pacman: x86_64 }
|
||||||
|
- { os: linux, arch: arm64, naive: true, debian: arm64, rpm: aarch64, pacman: aarch64 }
|
||||||
|
- { os: linux, arch: "386", naive: true, debian: i386, rpm: i386 }
|
||||||
|
- { os: linux, arch: arm, goarm: "7", naive: true, debian: armhf, rpm: armv7hl, pacman: armv7hl }
|
||||||
|
- { os: linux, arch: mipsle, gomips: softfloat, naive: true, debian: mipsel, rpm: mipsel }
|
||||||
|
- { os: linux, arch: riscv64, naive: true, debian: riscv64, rpm: riscv64 }
|
||||||
|
- { os: linux, arch: loong64, naive: true, debian: loongarch64, rpm: loongarch64 }
|
||||||
|
# Non-naive builds (unsupported architectures)
|
||||||
- { os: linux, arch: arm, goarm: "6", debian: armel, rpm: armv6hl }
|
- { os: linux, arch: arm, goarm: "6", debian: armel, rpm: armv6hl }
|
||||||
- { os: linux, arch: arm, goarm: "7", debian: armhf, rpm: armv7hl, pacman: armv7hl }
|
|
||||||
- { os: linux, arch: arm64, debian: arm64, rpm: aarch64, pacman: aarch64 }
|
|
||||||
- { os: linux, arch: mips64le, debian: mips64el, rpm: mips64el }
|
- { os: linux, arch: mips64le, debian: mips64el, rpm: mips64el }
|
||||||
- { os: linux, arch: mipsle, debian: mipsel, rpm: mipsel }
|
|
||||||
- { os: linux, arch: s390x, debian: s390x, rpm: s390x }
|
- { os: linux, arch: s390x, debian: s390x, rpm: s390x }
|
||||||
- { os: linux, arch: ppc64le, debian: ppc64el, rpm: ppc64le }
|
- { os: linux, arch: ppc64le, debian: ppc64el, rpm: ppc64le }
|
||||||
- { os: linux, arch: riscv64, debian: riscv64, rpm: riscv64 }
|
|
||||||
- { os: linux, arch: loong64, debian: loongarch64, rpm: loongarch64 }
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ^1.24.3
|
go-version: 1.26.7
|
||||||
- name: Setup Android NDK
|
- name: Clone cronet-go
|
||||||
if: matrix.os == 'android'
|
if: matrix.naive
|
||||||
uses: nttld/setup-ndk@v1
|
run: |
|
||||||
|
set -xeuo pipefail
|
||||||
|
CRONET_GO_VERSION=$(cat .github/CRONET_GO_VERSION)
|
||||||
|
git init ~/cronet-go
|
||||||
|
git -C ~/cronet-go remote add origin https://github.com/sagernet/cronet-go.git
|
||||||
|
git -C ~/cronet-go sparse-checkout set --no-cone '/*' '!/lib'
|
||||||
|
git -C ~/cronet-go fetch --depth=1 --filter=blob:none origin "$CRONET_GO_VERSION"
|
||||||
|
git -C ~/cronet-go checkout FETCH_HEAD
|
||||||
|
git -C ~/cronet-go submodule update --init --recursive --depth=1
|
||||||
|
- name: Regenerate Debian keyring
|
||||||
|
if: matrix.naive
|
||||||
|
run: |
|
||||||
|
set -xeuo pipefail
|
||||||
|
rm -f ~/cronet-go/naiveproxy/src/build/linux/sysroot_scripts/keyring.gpg
|
||||||
|
cd ~/cronet-go
|
||||||
|
GPG_TTY=/dev/null ./naiveproxy/src/build/linux/sysroot_scripts/generate_keyring.sh
|
||||||
|
- name: Cache Chromium toolchain
|
||||||
|
if: matrix.naive
|
||||||
|
id: cache-chromium-toolchain
|
||||||
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
ndk-version: r28
|
path: |
|
||||||
local-cache: true
|
~/cronet-go/naiveproxy/src/third_party/llvm-build/
|
||||||
|
~/cronet-go/naiveproxy/src/gn/out/
|
||||||
|
~/cronet-go/naiveproxy/src/chrome/build/pgo_profiles/
|
||||||
|
~/cronet-go/naiveproxy/src/out/sysroot-build/
|
||||||
|
key: chromium-toolchain-${{ matrix.arch }}-musl-${{ hashFiles('.github/CRONET_GO_VERSION') }}
|
||||||
|
- name: Download Chromium toolchain
|
||||||
|
if: matrix.naive
|
||||||
|
run: |
|
||||||
|
set -xeuo pipefail
|
||||||
|
cd ~/cronet-go
|
||||||
|
go run ./cmd/build-naive --target=linux/${{ matrix.arch }} --libc=musl download-toolchain
|
||||||
|
- name: Set Chromium toolchain environment
|
||||||
|
if: matrix.naive
|
||||||
|
run: |
|
||||||
|
set -xeuo pipefail
|
||||||
|
cd ~/cronet-go
|
||||||
|
go run ./cmd/build-naive --target=linux/${{ matrix.arch }} --libc=musl env >> $GITHUB_ENV
|
||||||
- name: Set tag
|
- name: Set tag
|
||||||
run: |-
|
run: |-
|
||||||
git ls-remote --exit-code --tags origin v${{ needs.calculate_version.outputs.version }} || echo "PUBLISHED=false" >> "$GITHUB_ENV"
|
git ls-remote --exit-code --tags origin v${{ needs.calculate_version.outputs.version }} || echo "PUBLISHED=false" >> "$GITHUB_ENV"
|
||||||
@@ -80,14 +121,38 @@ jobs:
|
|||||||
- name: Set build tags
|
- name: Set build tags
|
||||||
run: |
|
run: |
|
||||||
set -xeuo pipefail
|
set -xeuo pipefail
|
||||||
TAGS='with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api'
|
if [[ "${{ matrix.naive }}" == "true" ]]; then
|
||||||
|
TAGS="$(cat release/DEFAULT_BUILD_TAGS),with_musl"
|
||||||
|
else
|
||||||
|
TAGS=$(cat release/DEFAULT_BUILD_TAGS_OTHERS)
|
||||||
|
fi
|
||||||
echo "BUILD_TAGS=${TAGS}" >> "${GITHUB_ENV}"
|
echo "BUILD_TAGS=${TAGS}" >> "${GITHUB_ENV}"
|
||||||
- name: Build
|
- name: Set shared ldflags
|
||||||
|
run: |
|
||||||
|
echo "LDFLAGS_SHARED=$(cat release/LDFLAGS)" >> "${GITHUB_ENV}"
|
||||||
|
- name: Build (naive)
|
||||||
|
if: matrix.naive
|
||||||
run: |
|
run: |
|
||||||
set -xeuo pipefail
|
set -xeuo pipefail
|
||||||
mkdir -p dist
|
mkdir -p dist
|
||||||
go build -v -trimpath -o dist/sing-box -tags "${BUILD_TAGS}" \
|
go build -v -trimpath -o dist/sing-box -tags "${BUILD_TAGS}" \
|
||||||
-ldflags '-s -buildid= -X github.com/sagernet/sing-box/constant.Version=${{ needs.calculate_version.outputs.version }}' \
|
-ldflags "-X 'github.com/sagernet/sing-box/constant.Version=${{ needs.calculate_version.outputs.version }}' ${LDFLAGS_SHARED} -s -w -buildid=" \
|
||||||
|
./cmd/sing-box
|
||||||
|
env:
|
||||||
|
CGO_ENABLED: "1"
|
||||||
|
GOOS: linux
|
||||||
|
GOARCH: ${{ matrix.arch }}
|
||||||
|
GOARM: ${{ matrix.goarm }}
|
||||||
|
GOMIPS: ${{ matrix.gomips }}
|
||||||
|
GOMIPS64: ${{ matrix.gomips }}
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Build (non-naive)
|
||||||
|
if: ${{ ! matrix.naive }}
|
||||||
|
run: |
|
||||||
|
set -xeuo pipefail
|
||||||
|
mkdir -p dist
|
||||||
|
go build -v -trimpath -o dist/sing-box -tags "${BUILD_TAGS}" \
|
||||||
|
-ldflags "-X 'github.com/sagernet/sing-box/constant.Version=${{ needs.calculate_version.outputs.version }}' ${LDFLAGS_SHARED} -s -w -buildid=" \
|
||||||
./cmd/sing-box
|
./cmd/sing-box
|
||||||
env:
|
env:
|
||||||
CGO_ENABLED: "0"
|
CGO_ENABLED: "0"
|
||||||
@@ -98,14 +163,8 @@ jobs:
|
|||||||
- name: Set mtime
|
- name: Set mtime
|
||||||
run: |-
|
run: |-
|
||||||
TZ=UTC touch -t '197001010000' dist/sing-box
|
TZ=UTC touch -t '197001010000' dist/sing-box
|
||||||
- name: Set name
|
- name: Detect track
|
||||||
if: ${{ ! contains(needs.calculate_version.outputs.version, '-') }}
|
run: bash .github/detect_track.sh
|
||||||
run: |-
|
|
||||||
echo "NAME=sing-box" >> "$GITHUB_ENV"
|
|
||||||
- name: Set beta name
|
|
||||||
if: contains(needs.calculate_version.outputs.version, '-')
|
|
||||||
run: |-
|
|
||||||
echo "NAME=sing-box-beta" >> "$GITHUB_ENV"
|
|
||||||
- name: Set version
|
- name: Set version
|
||||||
run: |-
|
run: |-
|
||||||
PKG_VERSION="${{ needs.calculate_version.outputs.version }}"
|
PKG_VERSION="${{ needs.calculate_version.outputs.version }}"
|
||||||
@@ -124,8 +183,6 @@ jobs:
|
|||||||
-p "dist/${NAME}_${{ needs.calculate_version.outputs.version }}_linux_${{ matrix.debian }}.deb" \
|
-p "dist/${NAME}_${{ needs.calculate_version.outputs.version }}_linux_${{ matrix.debian }}.deb" \
|
||||||
--architecture ${{ matrix.debian }} \
|
--architecture ${{ matrix.debian }} \
|
||||||
dist/sing-box=/usr/bin/sing-box
|
dist/sing-box=/usr/bin/sing-box
|
||||||
curl -Lo '/tmp/debsigs.diff' 'https://gitlab.com/debsigs/debsigs/-/commit/160138f5de1ec110376d3c807b60a37388bc7c90.diff'
|
|
||||||
sudo patch /usr/bin/debsigs < '/tmp/debsigs.diff'
|
|
||||||
rm -rf $HOME/.gnupg
|
rm -rf $HOME/.gnupg
|
||||||
gpg --pinentry-mode loopback --passphrase "${{ secrets.GPG_PASSPHRASE }}" --import <<EOF
|
gpg --pinentry-mode loopback --passphrase "${{ secrets.GPG_PASSPHRASE }}" --import <<EOF
|
||||||
${{ secrets.GPG_KEY }}
|
${{ secrets.GPG_KEY }}
|
||||||
@@ -136,6 +193,7 @@ jobs:
|
|||||||
run: |-
|
run: |-
|
||||||
set -xeuo pipefail
|
set -xeuo pipefail
|
||||||
sudo gem install fpm
|
sudo gem install fpm
|
||||||
|
echo '%_rpmformat 4' > "$HOME/.rpmmacros"
|
||||||
cp .fpm_systemd .fpm
|
cp .fpm_systemd .fpm
|
||||||
fpm -t rpm \
|
fpm -t rpm \
|
||||||
--name "${NAME}" \
|
--name "${NAME}" \
|
||||||
@@ -166,7 +224,7 @@ jobs:
|
|||||||
- build
|
- build
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Set tag
|
- name: Set tag
|
||||||
@@ -175,10 +233,11 @@ jobs:
|
|||||||
git tag v${{ needs.calculate_version.outputs.version }} -f
|
git tag v${{ needs.calculate_version.outputs.version }} -f
|
||||||
echo "VERSION=${{ needs.calculate_version.outputs.version }}" >> "$GITHUB_ENV"
|
echo "VERSION=${{ needs.calculate_version.outputs.version }}" >> "$GITHUB_ENV"
|
||||||
- name: Download builds
|
- name: Download builds
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v5
|
||||||
with:
|
with:
|
||||||
path: dist
|
path: dist
|
||||||
merge-multiple: true
|
merge-multiple: true
|
||||||
- name: Publish packages
|
- name: Publish packages
|
||||||
|
if: github.event_name != 'push'
|
||||||
run: |-
|
run: |-
|
||||||
ls dist | xargs -I {} curl -F "package=@dist/{}" https://${{ secrets.FURY_TOKEN }}@push.fury.io/sagernet/
|
ls dist | xargs -I {} curl -F "package=@dist/{}" https://${{ secrets.FURY_TOKEN }}@push.fury.io/sagernet/
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
name: Test
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- oldstable
|
||||||
|
- stable
|
||||||
|
- testing
|
||||||
|
- unstable
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
- '.github/**'
|
||||||
|
- '!.github/workflows/test.yml'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- oldstable
|
||||||
|
- stable
|
||||||
|
- testing
|
||||||
|
- unstable
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}-${{ inputs.build }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
name: Test
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-latest
|
||||||
|
- windows-latest
|
||||||
|
- macos-latest
|
||||||
|
go:
|
||||||
|
- ~1.25
|
||||||
|
- ~1.26
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: ${{ matrix.go }}
|
||||||
|
- name: Set build tags and ldflags
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "BUILD_TAGS=$(cat release/DEFAULT_BUILD_TAGS_OTHERS)" >> "$GITHUB_ENV"
|
||||||
|
echo "LDFLAGS_SHARED=$(cat release/LDFLAGS)" >> "$GITHUB_ENV"
|
||||||
|
- name: Test (unix)
|
||||||
|
if: matrix.os != 'windows-latest'
|
||||||
|
run: go test -v -exec sudo -tags "$BUILD_TAGS" -ldflags "$LDFLAGS_SHARED" ./...
|
||||||
|
- name: Test (windows)
|
||||||
|
if: matrix.os == 'windows-latest'
|
||||||
|
shell: bash
|
||||||
|
run: go test -v -tags "$BUILD_TAGS" -ldflags "$LDFLAGS_SHARED" ./...
|
||||||
+15
-1
@@ -12,7 +12,21 @@
|
|||||||
/*.jar
|
/*.jar
|
||||||
/*.aar
|
/*.aar
|
||||||
/*.xcframework/
|
/*.xcframework/
|
||||||
|
/experimental/libbox/*.aar
|
||||||
|
/experimental/libbox/*.xcframework/
|
||||||
|
/experimental/libbox/*.nupkg
|
||||||
.DS_Store
|
.DS_Store
|
||||||
/config.d/
|
/config.d/
|
||||||
/venv/
|
/venv/
|
||||||
|
CLAUDE.md
|
||||||
|
AGENTS.md
|
||||||
|
/.claude/
|
||||||
|
dist
|
||||||
|
logs
|
||||||
|
/*.so
|
||||||
|
/*.log
|
||||||
|
/*.db-shm
|
||||||
|
/*.db-wal
|
||||||
|
/*.db.backup.*
|
||||||
|
/test_download.bin
|
||||||
|
/wget-log
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
[submodule "clients/apple"]
|
|
||||||
path = clients/apple
|
|
||||||
url = https://github.com/SagerNet/sing-box-for-apple.git
|
|
||||||
[submodule "clients/android"]
|
|
||||||
path = clients/android
|
|
||||||
url = https://github.com/SagerNet/sing-box-for-android.git
|
|
||||||
|
|||||||
+47
-27
@@ -1,27 +1,6 @@
|
|||||||
linters:
|
version: "2"
|
||||||
disable-all: true
|
|
||||||
enable:
|
|
||||||
- gofumpt
|
|
||||||
- govet
|
|
||||||
- gci
|
|
||||||
- staticcheck
|
|
||||||
- paralleltest
|
|
||||||
- ineffassign
|
|
||||||
|
|
||||||
linters-settings:
|
|
||||||
gci:
|
|
||||||
custom-order: true
|
|
||||||
sections:
|
|
||||||
- standard
|
|
||||||
- prefix(github.com/sagernet/)
|
|
||||||
- default
|
|
||||||
staticcheck:
|
|
||||||
checks:
|
|
||||||
- all
|
|
||||||
- -SA1003
|
|
||||||
|
|
||||||
run:
|
run:
|
||||||
go: "1.23"
|
go: "1.24"
|
||||||
build-tags:
|
build-tags:
|
||||||
- with_gvisor
|
- with_gvisor
|
||||||
- with_quic
|
- with_quic
|
||||||
@@ -30,7 +9,48 @@ run:
|
|||||||
- with_utls
|
- with_utls
|
||||||
- with_acme
|
- with_acme
|
||||||
- with_clash_api
|
- with_clash_api
|
||||||
|
- with_tailscale
|
||||||
issues:
|
- with_ccm
|
||||||
exclude-dirs:
|
- with_ocm
|
||||||
- transport/simple-obfs
|
- badlinkname
|
||||||
|
- tfogo_checklinkname0
|
||||||
|
linters:
|
||||||
|
default: none
|
||||||
|
enable:
|
||||||
|
- ineffassign
|
||||||
|
- staticcheck
|
||||||
|
- unused
|
||||||
|
- modernize
|
||||||
|
settings:
|
||||||
|
modernize:
|
||||||
|
disable:
|
||||||
|
- omitzero # nested struct omitempty -> omitzero changes JSON output semantics
|
||||||
|
staticcheck:
|
||||||
|
checks:
|
||||||
|
- all
|
||||||
|
- -QF1008 # could remove embedded field "<interface>" from selector
|
||||||
|
- -ST1003 # should not use ALL_CAPS in Go names; use CamelCase instead
|
||||||
|
- -QF1001 # could apply De Morgan's law
|
||||||
|
- -SA4023 # impossible nil comparison, false positive on platform-specific implementations
|
||||||
|
exclusions:
|
||||||
|
generated: lax
|
||||||
|
presets:
|
||||||
|
- comments
|
||||||
|
- common-false-positives
|
||||||
|
paths:
|
||||||
|
- transport/simple-obfs
|
||||||
|
- \.pb\.go$
|
||||||
|
- third_party$
|
||||||
|
- builtin$
|
||||||
|
- examples$
|
||||||
|
formatters:
|
||||||
|
enable:
|
||||||
|
- gci
|
||||||
|
- gofumpt
|
||||||
|
settings:
|
||||||
|
gci:
|
||||||
|
sections:
|
||||||
|
- standard
|
||||||
|
- prefix(github.com/sagernet/)
|
||||||
|
- default
|
||||||
|
custom-order: true
|
||||||
|
|||||||
@@ -1,103 +0,0 @@
|
|||||||
project_name: sing-box
|
|
||||||
builds:
|
|
||||||
- id: main
|
|
||||||
main: ./cmd/sing-box
|
|
||||||
flags:
|
|
||||||
- -v
|
|
||||||
- -trimpath
|
|
||||||
ldflags:
|
|
||||||
- -X github.com/sagernet/sing-box/constant.Version={{ .Version }}
|
|
||||||
- -s
|
|
||||||
- -buildid=
|
|
||||||
tags:
|
|
||||||
- with_gvisor
|
|
||||||
- with_quic
|
|
||||||
- with_dhcp
|
|
||||||
- with_wireguard
|
|
||||||
- with_utls
|
|
||||||
- with_acme
|
|
||||||
- with_clash_api
|
|
||||||
- with_tailscale
|
|
||||||
env:
|
|
||||||
- CGO_ENABLED=0
|
|
||||||
targets:
|
|
||||||
- linux_386
|
|
||||||
- linux_amd64_v1
|
|
||||||
- linux_arm64
|
|
||||||
- linux_arm_7
|
|
||||||
- linux_s390x
|
|
||||||
- linux_riscv64
|
|
||||||
- linux_mips64le
|
|
||||||
mod_timestamp: '{{ .CommitTimestamp }}'
|
|
||||||
snapshot:
|
|
||||||
name_template: "{{ .Version }}.{{ .ShortCommit }}"
|
|
||||||
nfpms:
|
|
||||||
- &template
|
|
||||||
id: package
|
|
||||||
package_name: sing-box
|
|
||||||
file_name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'
|
|
||||||
builds:
|
|
||||||
- main
|
|
||||||
homepage: https://sing-box.sagernet.org/
|
|
||||||
maintainer: nekohasekai <contact-git@sekai.icu>
|
|
||||||
description: The universal proxy platform.
|
|
||||||
license: GPLv3 or later
|
|
||||||
formats:
|
|
||||||
- deb
|
|
||||||
- rpm
|
|
||||||
priority: extra
|
|
||||||
contents:
|
|
||||||
- src: release/config/config.json
|
|
||||||
dst: /etc/sing-box/config.json
|
|
||||||
type: "config|noreplace"
|
|
||||||
|
|
||||||
- src: release/config/sing-box.service
|
|
||||||
dst: /usr/lib/systemd/system/sing-box.service
|
|
||||||
- src: release/config/sing-box@.service
|
|
||||||
dst: /usr/lib/systemd/system/sing-box@.service
|
|
||||||
- src: release/config/sing-box.sysusers
|
|
||||||
dst: /usr/lib/sysusers.d/sing-box.conf
|
|
||||||
- src: release/config/sing-box.rules
|
|
||||||
dst: /usr/share/polkit-1/rules.d/sing-box.rules
|
|
||||||
- src: release/config/sing-box-split-dns.xml
|
|
||||||
dst: /usr/share/dbus-1/system.d/sing-box-split-dns.conf
|
|
||||||
|
|
||||||
- src: release/completions/sing-box.bash
|
|
||||||
dst: /usr/share/bash-completion/completions/sing-box.bash
|
|
||||||
- src: release/completions/sing-box.fish
|
|
||||||
dst: /usr/share/fish/vendor_completions.d/sing-box.fish
|
|
||||||
- src: release/completions/sing-box.zsh
|
|
||||||
dst: /usr/share/zsh/site-functions/_sing-box
|
|
||||||
|
|
||||||
- src: LICENSE
|
|
||||||
dst: /usr/share/licenses/sing-box/LICENSE
|
|
||||||
deb:
|
|
||||||
signature:
|
|
||||||
key_file: "{{ .Env.NFPM_KEY_PATH }}"
|
|
||||||
fields:
|
|
||||||
Bugs: https://github.com/SagerNet/sing-box/issues
|
|
||||||
rpm:
|
|
||||||
signature:
|
|
||||||
key_file: "{{ .Env.NFPM_KEY_PATH }}"
|
|
||||||
conflicts:
|
|
||||||
- sing-box-beta
|
|
||||||
- id: package_beta
|
|
||||||
<<: *template
|
|
||||||
package_name: sing-box-beta
|
|
||||||
file_name_template: '{{ .ProjectName }}-beta_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'
|
|
||||||
formats:
|
|
||||||
- deb
|
|
||||||
- rpm
|
|
||||||
conflicts:
|
|
||||||
- sing-box
|
|
||||||
release:
|
|
||||||
disable: true
|
|
||||||
furies:
|
|
||||||
- account: sagernet
|
|
||||||
ids:
|
|
||||||
- package
|
|
||||||
disable: "{{ not (not .Prerelease) }}"
|
|
||||||
- account: sagernet
|
|
||||||
ids:
|
|
||||||
- package_beta
|
|
||||||
disable: "{{ not .Prerelease }}"
|
|
||||||
+435
-95
@@ -11,6 +11,7 @@ builds:
|
|||||||
- -X github.com/sagernet/sing-box/constant.Version={{ .Version }}
|
- -X github.com/sagernet/sing-box/constant.Version={{ .Version }}
|
||||||
- -s
|
- -s
|
||||||
- -buildid=
|
- -buildid=
|
||||||
|
- -checklinkname=0
|
||||||
tags:
|
tags:
|
||||||
- with_gvisor
|
- with_gvisor
|
||||||
- with_quic
|
- with_quic
|
||||||
@@ -20,6 +21,16 @@ builds:
|
|||||||
- with_acme
|
- with_acme
|
||||||
- with_clash_api
|
- with_clash_api
|
||||||
- with_tailscale
|
- with_tailscale
|
||||||
|
- with_masque
|
||||||
|
- with_mtproxy
|
||||||
|
- with_trusttunnel
|
||||||
|
- with_call
|
||||||
|
- with_sudoku
|
||||||
|
- with_manager
|
||||||
|
- with_admin_panel
|
||||||
|
- with_profiler
|
||||||
|
- badlinkname
|
||||||
|
- tfogo_checklinkname0
|
||||||
env:
|
env:
|
||||||
- CGO_ENABLED=0
|
- CGO_ENABLED=0
|
||||||
- GOTOOLCHAIN=local
|
- GOTOOLCHAIN=local
|
||||||
@@ -31,14 +42,13 @@ builds:
|
|||||||
- linux_arm_7
|
- linux_arm_7
|
||||||
- linux_s390x
|
- linux_s390x
|
||||||
- linux_riscv64
|
- linux_riscv64
|
||||||
- linux_mips64le
|
|
||||||
- windows_amd64_v1
|
- windows_amd64_v1
|
||||||
- windows_386
|
- windows_386
|
||||||
- windows_arm64
|
- windows_arm64
|
||||||
- darwin_amd64_v1
|
- darwin_amd64_v1
|
||||||
- darwin_arm64
|
- darwin_arm64
|
||||||
mod_timestamp: '{{ .CommitTimestamp }}'
|
mod_timestamp: '{{ .CommitTimestamp }}'
|
||||||
- id: legacy
|
- id: mips
|
||||||
<<: *template
|
<<: *template
|
||||||
tags:
|
tags:
|
||||||
- with_gvisor
|
- with_gvisor
|
||||||
@@ -49,13 +59,21 @@ builds:
|
|||||||
- with_acme
|
- with_acme
|
||||||
- with_clash_api
|
- with_clash_api
|
||||||
- with_tailscale
|
- with_tailscale
|
||||||
env:
|
- with_masque
|
||||||
- CGO_ENABLED=0
|
- with_mtproxy
|
||||||
- GOROOT={{ .Env.GOPATH }}/go_legacy
|
- with_trusttunnel
|
||||||
tool: "{{ .Env.GOPATH }}/go_legacy/bin/go"
|
- with_call
|
||||||
|
- with_sudoku
|
||||||
|
- with_profiler
|
||||||
|
- badlinkname
|
||||||
|
- tfogo_checklinkname0
|
||||||
targets:
|
targets:
|
||||||
- windows_amd64_v1
|
- linux_mips
|
||||||
- windows_386
|
- linux_mips_softfloat
|
||||||
|
- linux_mipsle
|
||||||
|
- linux_mipsle_softfloat
|
||||||
|
- linux_mips64
|
||||||
|
- linux_mips64le
|
||||||
- id: android
|
- id: android
|
||||||
<<: *template
|
<<: *template
|
||||||
env:
|
env:
|
||||||
@@ -89,11 +107,359 @@ builds:
|
|||||||
- android_arm64
|
- android_arm64
|
||||||
- android_386
|
- android_386
|
||||||
- android_amd64
|
- android_amd64
|
||||||
|
- id: naive-purego-linux-amd64
|
||||||
|
<<: *template
|
||||||
|
tags:
|
||||||
|
- with_gvisor
|
||||||
|
- with_quic
|
||||||
|
- with_dhcp
|
||||||
|
- with_wireguard
|
||||||
|
- with_utls
|
||||||
|
- with_acme
|
||||||
|
- with_clash_api
|
||||||
|
- with_tailscale
|
||||||
|
- with_masque
|
||||||
|
- with_mtproxy
|
||||||
|
- with_trusttunnel
|
||||||
|
- with_call
|
||||||
|
- with_sudoku
|
||||||
|
- with_manager
|
||||||
|
- with_admin_panel
|
||||||
|
- with_profiler
|
||||||
|
- badlinkname
|
||||||
|
- tfogo_checklinkname0
|
||||||
|
- with_naive_outbound
|
||||||
|
- with_purego
|
||||||
|
env:
|
||||||
|
- CGO_ENABLED=0
|
||||||
|
- GOTOOLCHAIN=local
|
||||||
|
hooks:
|
||||||
|
post:
|
||||||
|
- cmd: go run -C {{ .Env.CRONET_GO_PATH }} ./cmd/build-naive extract-lib --target {{ .Os }}/{{ .Arch }} -o {{ dir .Path }}
|
||||||
|
env:
|
||||||
|
- CGO_ENABLED=0
|
||||||
|
targets:
|
||||||
|
- linux_amd64_v1
|
||||||
|
- id: naive-purego-linux-arm64
|
||||||
|
<<: *template
|
||||||
|
tags:
|
||||||
|
- with_gvisor
|
||||||
|
- with_quic
|
||||||
|
- with_dhcp
|
||||||
|
- with_wireguard
|
||||||
|
- with_utls
|
||||||
|
- with_acme
|
||||||
|
- with_clash_api
|
||||||
|
- with_tailscale
|
||||||
|
- with_masque
|
||||||
|
- with_mtproxy
|
||||||
|
- with_trusttunnel
|
||||||
|
- with_call
|
||||||
|
- with_sudoku
|
||||||
|
- with_manager
|
||||||
|
- with_admin_panel
|
||||||
|
- with_profiler
|
||||||
|
- badlinkname
|
||||||
|
- tfogo_checklinkname0
|
||||||
|
- with_naive_outbound
|
||||||
|
- with_purego
|
||||||
|
env:
|
||||||
|
- CGO_ENABLED=0
|
||||||
|
- GOTOOLCHAIN=local
|
||||||
|
hooks:
|
||||||
|
post:
|
||||||
|
- cmd: go run -C {{ .Env.CRONET_GO_PATH }} ./cmd/build-naive extract-lib --target {{ .Os }}/{{ .Arch }} -o {{ dir .Path }}
|
||||||
|
env:
|
||||||
|
- CGO_ENABLED=0
|
||||||
|
targets:
|
||||||
|
- linux_arm64
|
||||||
|
- id: naive-purego-windows-amd64
|
||||||
|
<<: *template
|
||||||
|
tags:
|
||||||
|
- with_gvisor
|
||||||
|
- with_quic
|
||||||
|
- with_dhcp
|
||||||
|
- with_wireguard
|
||||||
|
- with_utls
|
||||||
|
- with_acme
|
||||||
|
- with_clash_api
|
||||||
|
- with_tailscale
|
||||||
|
- with_masque
|
||||||
|
- with_mtproxy
|
||||||
|
- with_trusttunnel
|
||||||
|
- with_call
|
||||||
|
- with_sudoku
|
||||||
|
- with_manager
|
||||||
|
- with_admin_panel
|
||||||
|
- with_profiler
|
||||||
|
- badlinkname
|
||||||
|
- tfogo_checklinkname0
|
||||||
|
- with_naive_outbound
|
||||||
|
- with_purego
|
||||||
|
env:
|
||||||
|
- CGO_ENABLED=0
|
||||||
|
- GOTOOLCHAIN=local
|
||||||
|
hooks:
|
||||||
|
post:
|
||||||
|
- cmd: go run -C {{ .Env.CRONET_GO_PATH }} ./cmd/build-naive extract-lib --target {{ .Os }}/{{ .Arch }} -o {{ dir .Path }}
|
||||||
|
env:
|
||||||
|
- CGO_ENABLED=0
|
||||||
|
targets:
|
||||||
|
- windows_amd64_v1
|
||||||
|
- id: naive-purego-windows-arm64
|
||||||
|
<<: *template
|
||||||
|
tags:
|
||||||
|
- with_gvisor
|
||||||
|
- with_quic
|
||||||
|
- with_dhcp
|
||||||
|
- with_wireguard
|
||||||
|
- with_utls
|
||||||
|
- with_acme
|
||||||
|
- with_clash_api
|
||||||
|
- with_tailscale
|
||||||
|
- with_masque
|
||||||
|
- with_mtproxy
|
||||||
|
- with_trusttunnel
|
||||||
|
- with_call
|
||||||
|
- with_sudoku
|
||||||
|
- with_manager
|
||||||
|
- with_admin_panel
|
||||||
|
- with_profiler
|
||||||
|
- badlinkname
|
||||||
|
- tfogo_checklinkname0
|
||||||
|
- with_naive_outbound
|
||||||
|
- with_purego
|
||||||
|
env:
|
||||||
|
- CGO_ENABLED=0
|
||||||
|
- GOTOOLCHAIN=local
|
||||||
|
hooks:
|
||||||
|
post:
|
||||||
|
- cmd: go run -C {{ .Env.CRONET_GO_PATH }} ./cmd/build-naive extract-lib --target {{ .Os }}/{{ .Arch }} -o {{ dir .Path }}
|
||||||
|
env:
|
||||||
|
- CGO_ENABLED=0
|
||||||
|
targets:
|
||||||
|
- windows_arm64
|
||||||
|
- id: naive-glibc
|
||||||
|
<<: *template
|
||||||
|
tags:
|
||||||
|
- with_gvisor
|
||||||
|
- with_quic
|
||||||
|
- with_dhcp
|
||||||
|
- with_wireguard
|
||||||
|
- with_utls
|
||||||
|
- with_acme
|
||||||
|
- with_clash_api
|
||||||
|
- with_tailscale
|
||||||
|
- with_masque
|
||||||
|
- with_mtproxy
|
||||||
|
- with_trusttunnel
|
||||||
|
- with_call
|
||||||
|
- with_sudoku
|
||||||
|
- with_manager
|
||||||
|
- with_admin_panel
|
||||||
|
- with_profiler
|
||||||
|
- badlinkname
|
||||||
|
- tfogo_checklinkname0
|
||||||
|
- with_naive_outbound
|
||||||
|
env:
|
||||||
|
- CGO_ENABLED=1
|
||||||
|
- GOTOOLCHAIN=local
|
||||||
|
- CGO_LDFLAGS=-fuse-ld=lld -Wl,-z,notext -Wl,-z,execstack
|
||||||
|
- CC_linux_amd64={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/third_party/llvm-build/Release+Asserts/bin/clang --target=x86_64-linux-gnu --sysroot={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/out/sysroot-build/bullseye/bullseye_amd64_staging
|
||||||
|
- CXX_linux_amd64={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/third_party/llvm-build/Release+Asserts/bin/clang++ --target=x86_64-linux-gnu --sysroot={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/out/sysroot-build/bullseye/bullseye_amd64_staging
|
||||||
|
- CC_linux_arm64={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/third_party/llvm-build/Release+Asserts/bin/clang --target=aarch64-linux-gnu --sysroot={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/out/sysroot-build/bullseye/bullseye_arm64_staging
|
||||||
|
- CXX_linux_arm64={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/third_party/llvm-build/Release+Asserts/bin/clang++ --target=aarch64-linux-gnu --sysroot={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/out/sysroot-build/bullseye/bullseye_arm64_staging
|
||||||
|
- CC_linux_386={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/third_party/llvm-build/Release+Asserts/bin/clang --target=i686-linux-gnu --sysroot={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/out/sysroot-build/bullseye/bullseye_i386_staging
|
||||||
|
- CXX_linux_386={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/third_party/llvm-build/Release+Asserts/bin/clang++ --target=i686-linux-gnu --sysroot={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/out/sysroot-build/bullseye/bullseye_i386_staging
|
||||||
|
- CC_linux_arm={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/third_party/llvm-build/Release+Asserts/bin/clang --target=arm-linux-gnueabihf --sysroot={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/out/sysroot-build/bullseye/bullseye_armhf_staging
|
||||||
|
- CXX_linux_arm={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/third_party/llvm-build/Release+Asserts/bin/clang++ --target=arm-linux-gnueabihf --sysroot={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/out/sysroot-build/bullseye/bullseye_armhf_staging
|
||||||
|
- CC_linux_mips64le={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/third_party/llvm-build/Release+Asserts/bin/clang --target=mips64el-linux-gnuabi64 --sysroot={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/out/sysroot-build/bullseye/bullseye_mips64el_staging
|
||||||
|
- CXX_linux_mips64le={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/third_party/llvm-build/Release+Asserts/bin/clang++ --target=mips64el-linux-gnuabi64 --sysroot={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/out/sysroot-build/bullseye/bullseye_mips64el_staging
|
||||||
|
- CC_linux_riscv64={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/third_party/llvm-build/Release+Asserts/bin/clang --target=riscv64-linux-gnu --sysroot={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/out/sysroot-build/trixie/trixie_riscv64_staging
|
||||||
|
- CXX_linux_riscv64={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/third_party/llvm-build/Release+Asserts/bin/clang++ --target=riscv64-linux-gnu --sysroot={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/out/sysroot-build/trixie/trixie_riscv64_staging
|
||||||
|
- CC_linux_loong64={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/third_party/llvm-build/Release+Asserts/bin/clang --target=loongarch64-linux-gnu --sysroot={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/out/sysroot-build/sid/sid_loong64_staging
|
||||||
|
- CXX_linux_loong64={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/third_party/llvm-build/Release+Asserts/bin/clang++ --target=loongarch64-linux-gnu --sysroot={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/out/sysroot-build/sid/sid_loong64_staging
|
||||||
|
- 'CC={{ index .Env (print "CC_" .Os "_" .Arch) }}'
|
||||||
|
- 'CXX={{ index .Env (print "CXX_" .Os "_" .Arch) }}'
|
||||||
|
targets:
|
||||||
|
- linux_amd64_v1
|
||||||
|
- linux_arm64
|
||||||
|
- linux_386
|
||||||
|
- linux_arm_7
|
||||||
|
- linux_riscv64
|
||||||
|
- linux_loong64
|
||||||
|
- id: naive-musl
|
||||||
|
<<: *template
|
||||||
|
tags:
|
||||||
|
- with_gvisor
|
||||||
|
- with_quic
|
||||||
|
- with_dhcp
|
||||||
|
- with_wireguard
|
||||||
|
- with_utls
|
||||||
|
- with_acme
|
||||||
|
- with_clash_api
|
||||||
|
- with_tailscale
|
||||||
|
- with_masque
|
||||||
|
- with_mtproxy
|
||||||
|
- with_trusttunnel
|
||||||
|
- with_call
|
||||||
|
- with_sudoku
|
||||||
|
- with_manager
|
||||||
|
- with_admin_panel
|
||||||
|
- with_profiler
|
||||||
|
- badlinkname
|
||||||
|
- tfogo_checklinkname0
|
||||||
|
- with_naive_outbound
|
||||||
|
- with_musl
|
||||||
|
env:
|
||||||
|
- CGO_ENABLED=1
|
||||||
|
- GOTOOLCHAIN=local
|
||||||
|
- CGO_LDFLAGS=-fuse-ld=lld -Wl,-z,notext -Wl,-z,execstack
|
||||||
|
- CC_linux_amd64={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/third_party/llvm-build/Release+Asserts/bin/clang --target=x86_64-openwrt-linux-musl --sysroot={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/out/sysroot-build/openwrt/23.05.5/x86_64
|
||||||
|
- CXX_linux_amd64={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/third_party/llvm-build/Release+Asserts/bin/clang++ --target=x86_64-openwrt-linux-musl --sysroot={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/out/sysroot-build/openwrt/23.05.5/x86_64
|
||||||
|
- CC_linux_arm64={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/third_party/llvm-build/Release+Asserts/bin/clang --target=aarch64-openwrt-linux-musl --sysroot={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/out/sysroot-build/openwrt/23.05.5/aarch64
|
||||||
|
- CXX_linux_arm64={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/third_party/llvm-build/Release+Asserts/bin/clang++ --target=aarch64-openwrt-linux-musl --sysroot={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/out/sysroot-build/openwrt/23.05.5/aarch64
|
||||||
|
- CC_linux_386={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/third_party/llvm-build/Release+Asserts/bin/clang --target=i486-openwrt-linux-musl --sysroot={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/out/sysroot-build/openwrt/23.05.5/i386_pentium4
|
||||||
|
- CXX_linux_386={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/third_party/llvm-build/Release+Asserts/bin/clang++ --target=i486-openwrt-linux-musl --sysroot={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/out/sysroot-build/openwrt/23.05.5/i386_pentium4
|
||||||
|
- CC_linux_arm={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/third_party/llvm-build/Release+Asserts/bin/clang --target=arm-openwrt-linux-musleabi --sysroot={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/out/sysroot-build/openwrt/23.05.5/arm_cortex-a15_neon-vfpv4
|
||||||
|
- CXX_linux_arm={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/third_party/llvm-build/Release+Asserts/bin/clang++ --target=arm-openwrt-linux-musleabi --sysroot={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/out/sysroot-build/openwrt/23.05.5/arm_cortex-a15_neon-vfpv4
|
||||||
|
- CC_linux_riscv64={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/third_party/llvm-build/Release+Asserts/bin/clang --target=riscv64-openwrt-linux-musl --sysroot={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/out/sysroot-build/openwrt/23.05.5/riscv64
|
||||||
|
- CXX_linux_riscv64={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/third_party/llvm-build/Release+Asserts/bin/clang++ --target=riscv64-openwrt-linux-musl --sysroot={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/out/sysroot-build/openwrt/23.05.5/riscv64
|
||||||
|
- CC_linux_loong64={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/third_party/llvm-build/Release+Asserts/bin/clang --target=loongarch64-openwrt-linux-musl --sysroot={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/out/sysroot-build/openwrt/24.10.5/loongarch64
|
||||||
|
- CXX_linux_loong64={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/third_party/llvm-build/Release+Asserts/bin/clang++ --target=loongarch64-openwrt-linux-musl --sysroot={{ .Env.CRONET_GO_PATH }}/naiveproxy/src/out/sysroot-build/openwrt/24.10.5/loongarch64
|
||||||
|
- 'CC={{ index .Env (print "CC_" .Os "_" .Arch) }}'
|
||||||
|
- 'CXX={{ index .Env (print "CXX_" .Os "_" .Arch) }}'
|
||||||
|
targets:
|
||||||
|
- linux_amd64_v1
|
||||||
|
- linux_arm64
|
||||||
|
- linux_386
|
||||||
|
- linux_arm_7
|
||||||
|
- linux_riscv64
|
||||||
|
- linux_loong64
|
||||||
|
- id: compressed
|
||||||
|
<<: *template
|
||||||
|
targets:
|
||||||
|
- linux_386
|
||||||
|
- linux_amd64_v1
|
||||||
|
- linux_arm64
|
||||||
|
- linux_arm_6
|
||||||
|
- linux_arm_7
|
||||||
|
- linux_riscv64
|
||||||
|
- id: compressed-mips
|
||||||
|
<<: *template
|
||||||
|
tags:
|
||||||
|
- with_gvisor
|
||||||
|
- with_quic
|
||||||
|
- with_dhcp
|
||||||
|
- with_wireguard
|
||||||
|
- with_utls
|
||||||
|
- with_acme
|
||||||
|
- with_clash_api
|
||||||
|
- with_tailscale
|
||||||
|
- with_masque
|
||||||
|
- with_mtproxy
|
||||||
|
- with_trusttunnel
|
||||||
|
- with_call
|
||||||
|
- with_sudoku
|
||||||
|
- with_profiler
|
||||||
|
- badlinkname
|
||||||
|
- tfogo_checklinkname0
|
||||||
|
targets:
|
||||||
|
- linux_mips
|
||||||
|
- linux_mips_softfloat
|
||||||
|
- linux_mipsle
|
||||||
|
- linux_mipsle_softfloat
|
||||||
|
- id: compressed-android
|
||||||
|
<<: *template
|
||||||
|
env:
|
||||||
|
- CGO_ENABLED=1
|
||||||
|
- GOTOOLCHAIN=local
|
||||||
|
overrides:
|
||||||
|
- goos: android
|
||||||
|
goarch: arm
|
||||||
|
goarm: 7
|
||||||
|
env:
|
||||||
|
- CC=armv7a-linux-androideabi21-clang
|
||||||
|
- CXX=armv7a-linux-androideabi21-clang++
|
||||||
|
- goos: android
|
||||||
|
goarch: arm64
|
||||||
|
env:
|
||||||
|
- CC=aarch64-linux-android21-clang
|
||||||
|
- CXX=aarch64-linux-android21-clang++
|
||||||
|
- goos: android
|
||||||
|
goarch: 386
|
||||||
|
env:
|
||||||
|
- CC=i686-linux-android21-clang
|
||||||
|
- CXX=i686-linux-android21-clang++
|
||||||
|
- goos: android
|
||||||
|
goarch: amd64
|
||||||
|
goamd64: v1
|
||||||
|
env:
|
||||||
|
- CC=x86_64-linux-android21-clang
|
||||||
|
- CXX=x86_64-linux-android21-clang++
|
||||||
|
targets:
|
||||||
|
- android_arm_7
|
||||||
|
- android_arm64
|
||||||
|
- android_386
|
||||||
|
- android_amd64
|
||||||
|
- id: openwrt
|
||||||
|
<<: *template
|
||||||
|
hooks:
|
||||||
|
post:
|
||||||
|
- cmd: bash .github/build_openwrt_packages.sh "{{ .Version }}" "{{ .Target }}" "{{ .Path }}"
|
||||||
|
targets:
|
||||||
|
- linux_amd64_v1
|
||||||
|
- linux_arm64
|
||||||
|
- linux_386
|
||||||
|
- linux_arm_7
|
||||||
|
- linux_arm_6
|
||||||
|
- linux_riscv64
|
||||||
|
- linux_loong64
|
||||||
|
- id: openwrt-mips
|
||||||
|
<<: *template
|
||||||
|
tags:
|
||||||
|
- with_gvisor
|
||||||
|
- with_quic
|
||||||
|
- with_dhcp
|
||||||
|
- with_wireguard
|
||||||
|
- with_utls
|
||||||
|
- with_acme
|
||||||
|
- with_clash_api
|
||||||
|
- with_tailscale
|
||||||
|
- with_masque
|
||||||
|
- with_mtproxy
|
||||||
|
- with_ccm
|
||||||
|
- with_ocm
|
||||||
|
- with_trusttunnel
|
||||||
|
- with_call
|
||||||
|
- with_sudoku
|
||||||
|
- with_profiler
|
||||||
|
- badlinkname
|
||||||
|
- tfogo_checklinkname0
|
||||||
|
hooks:
|
||||||
|
post:
|
||||||
|
- cmd: bash .github/build_openwrt_packages.sh "{{ .Version }}" "{{ .Target }}" "{{ .Path }}"
|
||||||
|
targets:
|
||||||
|
- linux_arm_5
|
||||||
|
- linux_mips_softfloat
|
||||||
|
- linux_mips64_softfloat
|
||||||
|
- linux_mipsle_softfloat
|
||||||
|
- linux_mipsle_hardfloat
|
||||||
|
- linux_mips64le
|
||||||
|
upx:
|
||||||
|
- enabled: true
|
||||||
|
ids:
|
||||||
|
- compressed
|
||||||
|
- compressed-mips
|
||||||
|
- compressed-android
|
||||||
|
compress: best
|
||||||
|
lzma: true
|
||||||
archives:
|
archives:
|
||||||
- &template
|
- &template
|
||||||
id: archive
|
id: archive
|
||||||
builds:
|
builds:
|
||||||
- main
|
- main
|
||||||
|
- mips
|
||||||
- android
|
- android
|
||||||
formats:
|
formats:
|
||||||
- tar.gz
|
- tar.gz
|
||||||
@@ -104,91 +470,60 @@ archives:
|
|||||||
wrap_in_directory: true
|
wrap_in_directory: true
|
||||||
files:
|
files:
|
||||||
- LICENSE
|
- LICENSE
|
||||||
name_template: '{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ if and .Mips (not (eq .Mips "hardfloat")) }}_{{ .Mips }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'
|
name_template: '{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ if and .Mips (not (eq .Mips "hardfloat")) }}-{{ .Mips }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'
|
||||||
- id: archive-legacy
|
- id: archive-naive-purego-linux-amd64
|
||||||
<<: *template
|
<<: *template
|
||||||
builds:
|
builds:
|
||||||
- legacy
|
- naive-purego-linux-amd64
|
||||||
name_template: '{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}-legacy'
|
files:
|
||||||
nfpms:
|
- LICENSE
|
||||||
- id: package
|
- src: dist/naive-purego-linux-amd64_*/libcronet*
|
||||||
package_name: sing-box
|
strip_parent: true
|
||||||
file_name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ if and .Mips (not (eq .Mips "hardfloat")) }}_{{ .Mips }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'
|
name_template: '{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}-purego'
|
||||||
|
- id: archive-naive-purego-linux-arm64
|
||||||
|
<<: *template
|
||||||
builds:
|
builds:
|
||||||
- main
|
- naive-purego-linux-arm64
|
||||||
homepage: https://sing-box.sagernet.org/
|
files:
|
||||||
maintainer: nekohasekai <contact-git@sekai.icu>
|
- LICENSE
|
||||||
description: The universal proxy platform.
|
- src: dist/naive-purego-linux-arm64_*/libcronet*
|
||||||
license: GPLv3 or later
|
strip_parent: true
|
||||||
formats:
|
name_template: '{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}-purego'
|
||||||
- deb
|
- id: archive-naive-purego-windows-amd64
|
||||||
- rpm
|
<<: *template
|
||||||
- archlinux
|
builds:
|
||||||
# - apk
|
- naive-purego-windows-amd64
|
||||||
# - ipk
|
files:
|
||||||
priority: extra
|
- LICENSE
|
||||||
contents:
|
- src: dist/naive-purego-windows-amd64_*/libcronet*
|
||||||
- src: release/config/config.json
|
strip_parent: true
|
||||||
dst: /etc/sing-box/config.json
|
name_template: '{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}-purego'
|
||||||
type: "config|noreplace"
|
- id: archive-naive-purego-windows-arm64
|
||||||
|
<<: *template
|
||||||
- src: release/config/sing-box.service
|
builds:
|
||||||
dst: /usr/lib/systemd/system/sing-box.service
|
- naive-purego-windows-arm64
|
||||||
- src: release/config/sing-box@.service
|
files:
|
||||||
dst: /usr/lib/systemd/system/sing-box@.service
|
- LICENSE
|
||||||
- src: release/config/sing-box.sysusers
|
- src: dist/naive-purego-windows-arm64_*/libcronet*
|
||||||
dst: /usr/lib/sysusers.d/sing-box.conf
|
strip_parent: true
|
||||||
- src: release/config/sing-box.rules
|
name_template: '{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}-purego'
|
||||||
dst: /usr/share/polkit-1/rules.d/sing-box.rules
|
- id: archive-naive-glibc
|
||||||
- src: release/config/sing-box-split-dns.xml
|
<<: *template
|
||||||
dst: /usr/share/dbus-1/system.d/sing-box-split-dns.conf
|
builds:
|
||||||
|
- naive-glibc
|
||||||
- src: release/completions/sing-box.bash
|
name_template: '{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ if and .Mips (not (eq .Mips "hardfloat")) }}-{{ .Mips }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}-glibc'
|
||||||
dst: /usr/share/bash-completion/completions/sing-box.bash
|
- id: archive-naive-musl
|
||||||
- src: release/completions/sing-box.fish
|
<<: *template
|
||||||
dst: /usr/share/fish/vendor_completions.d/sing-box.fish
|
builds:
|
||||||
- src: release/completions/sing-box.zsh
|
- naive-musl
|
||||||
dst: /usr/share/zsh/site-functions/_sing-box
|
name_template: '{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ if and .Mips (not (eq .Mips "hardfloat")) }}-{{ .Mips }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}-musl'
|
||||||
|
- id: archive-compressed
|
||||||
- src: LICENSE
|
<<: *template
|
||||||
dst: /usr/share/licenses/sing-box/LICENSE
|
builds:
|
||||||
deb:
|
- compressed
|
||||||
signature:
|
- compressed-mips
|
||||||
key_file: "{{ .Env.NFPM_KEY_PATH }}"
|
- compressed-android
|
||||||
fields:
|
name_template: '{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ if and .Mips (not (eq .Mips "hardfloat")) }}-{{ .Mips }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}-compressed'
|
||||||
Bugs: https://github.com/SagerNet/sing-box/issues
|
|
||||||
rpm:
|
|
||||||
signature:
|
|
||||||
key_file: "{{ .Env.NFPM_KEY_PATH }}"
|
|
||||||
overrides:
|
|
||||||
apk:
|
|
||||||
contents:
|
|
||||||
- src: release/config/config.json
|
|
||||||
dst: /etc/sing-box/config.json
|
|
||||||
type: config
|
|
||||||
|
|
||||||
- src: release/config/sing-box.initd
|
|
||||||
dst: /etc/init.d/sing-box
|
|
||||||
|
|
||||||
- src: release/completions/sing-box.bash
|
|
||||||
dst: /usr/share/bash-completion/completions/sing-box.bash
|
|
||||||
- src: release/completions/sing-box.fish
|
|
||||||
dst: /usr/share/fish/vendor_completions.d/sing-box.fish
|
|
||||||
- src: release/completions/sing-box.zsh
|
|
||||||
dst: /usr/share/zsh/site-functions/_sing-box
|
|
||||||
|
|
||||||
- src: LICENSE
|
|
||||||
dst: /usr/share/licenses/sing-box/LICENSE
|
|
||||||
ipk:
|
|
||||||
contents:
|
|
||||||
- src: release/config/config.json
|
|
||||||
dst: /etc/sing-box/config.json
|
|
||||||
type: config
|
|
||||||
|
|
||||||
- src: release/config/openwrt.init
|
|
||||||
dst: /etc/init.d/sing-box
|
|
||||||
- src: release/config/openwrt.conf
|
|
||||||
dst: /etc/config/sing-box
|
|
||||||
source:
|
source:
|
||||||
enabled: false
|
enabled: false
|
||||||
name_template: '{{ .ProjectName }}-{{ .Version }}.source'
|
name_template: '{{ .ProjectName }}-{{ .Version }}.source'
|
||||||
@@ -200,14 +535,19 @@ signs:
|
|||||||
- artifacts: checksum
|
- artifacts: checksum
|
||||||
release:
|
release:
|
||||||
github:
|
github:
|
||||||
owner: SagerNet
|
owner: shtorm-7
|
||||||
name: sing-box
|
name: sing-box-extended
|
||||||
draft: true
|
draft: true
|
||||||
prerelease: auto
|
prerelease: auto
|
||||||
mode: replace
|
mode: replace
|
||||||
ids:
|
ids:
|
||||||
- archive
|
- archive
|
||||||
- package
|
- archive-naive-glibc
|
||||||
|
- archive-naive-musl
|
||||||
|
- archive-naive-purego-linux-amd64
|
||||||
|
- archive-naive-purego-linux-arm64
|
||||||
|
- archive-naive-purego-windows-amd64
|
||||||
|
- archive-naive-purego-windows-arm64
|
||||||
|
- archive-compressed
|
||||||
|
- archive-openwrt
|
||||||
skip_upload: true
|
skip_upload: true
|
||||||
partial:
|
|
||||||
by: target
|
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
# Support the project
|
||||||
|
|
||||||
|
If you want to support the project, you can donate to the following addresses.
|
||||||
|
|
||||||
|
### TRX (Tron)
|
||||||
|
```
|
||||||
|
TSWU6VUZ4FcUghYDmbbhK15gRVvhvBgW3F
|
||||||
|
```
|
||||||
|
### TON
|
||||||
|
```
|
||||||
|
UQAyD2UuT5kCP6lZQlhFL0hyNibDXNE4nIo_RSLVSYAtD7N1
|
||||||
|
```
|
||||||
|
### Solana
|
||||||
|
```
|
||||||
|
CJu8ickwRCwNE71uVFjYf1UveyCkRp9Xo44rhPcQpeFL
|
||||||
|
```
|
||||||
|
### Bitcoin
|
||||||
|
```
|
||||||
|
bc1qqx97p8k4dchqkyd47s4vf74hrqdfnmhqvcja7x
|
||||||
|
```
|
||||||
|
### Ethereum
|
||||||
|
```
|
||||||
|
0xAcc5919C22F2B3fAa0ec7E8BaD142da5B375FBF6
|
||||||
|
```
|
||||||
+18
-14
@@ -1,27 +1,31 @@
|
|||||||
FROM --platform=$BUILDPLATFORM golang:1.24-alpine AS builder
|
FROM --platform=$BUILDPLATFORM golang:1.26 AS builder
|
||||||
LABEL maintainer="nekohasekai <contact-git@sekai.icu>"
|
LABEL maintainer="shtorm-7"
|
||||||
COPY . /go/src/github.com/sagernet/sing-box
|
COPY . /go/src/github.com/sagernet/sing-box
|
||||||
WORKDIR /go/src/github.com/sagernet/sing-box
|
WORKDIR /go/src/github.com/sagernet/sing-box
|
||||||
ARG TARGETOS TARGETARCH
|
ARG TARGETOS TARGETARCH
|
||||||
ARG GOPROXY=""
|
ARG GOPROXY=""
|
||||||
ENV GOPROXY ${GOPROXY}
|
ARG CRONET_GO_PATH=/go/src/github.com/sagernet/sing-box/cronet-go
|
||||||
ENV CGO_ENABLED=0
|
ENV GOPROXY=${GOPROXY}
|
||||||
|
ENV CGO_ENABLED=1
|
||||||
ENV GOOS=$TARGETOS
|
ENV GOOS=$TARGETOS
|
||||||
ENV GOARCH=$TARGETARCH
|
ENV GOARCH=$TARGETARCH
|
||||||
|
ENV CRONET_GO_PATH=${CRONET_GO_PATH}
|
||||||
RUN set -ex \
|
RUN set -ex \
|
||||||
&& apk add git build-base \
|
&& git config --global --add safe.directory /go/src/github.com/sagernet/sing-box \
|
||||||
&& export COMMIT=$(git rev-parse --short HEAD) \
|
&& export GOTOOLCHAIN=local \
|
||||||
&& export VERSION=$(go run ./cmd/internal/read_tag) \
|
&& export CGO_ENABLED=1 GOOS=$TARGETOS GOARCH=$TARGETARCH \
|
||||||
&& go build -v -trimpath -tags \
|
&& eval "$(CGO_ENABLED=0 GOOS= GOARCH= go run -C "$CRONET_GO_PATH" ./cmd/build-naive --target=$GOOS/$GOARCH --libc=musl env --export)" \
|
||||||
"with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale" \
|
&& export CGO_LDFLAGS="$CGO_LDFLAGS -Wl,-z,notext -Wl,-z,execstack" \
|
||||||
|
&& export VERSION=$(CGO_ENABLED=0 GOOS= GOARCH= go run ./cmd/internal/read_tag) \
|
||||||
|
&& export TAGS=$(cat release/DEFAULT_BUILD_TAGS_DOCKER) \
|
||||||
|
&& export LDFLAGS_SHARED=$(cat release/LDFLAGS) \
|
||||||
|
&& go build -v -trimpath -tags "$TAGS" \
|
||||||
-o /go/bin/sing-box \
|
-o /go/bin/sing-box \
|
||||||
-ldflags "-X \"github.com/sagernet/sing-box/constant.Version=$VERSION\" -s -w -buildid=" \
|
-ldflags "-X \"github.com/sagernet/sing-box/constant.Version=$VERSION\" $LDFLAGS_SHARED -s -w -buildid=" \
|
||||||
./cmd/sing-box
|
./cmd/sing-box
|
||||||
FROM --platform=$TARGETPLATFORM alpine AS dist
|
FROM --platform=$TARGETPLATFORM alpine AS dist
|
||||||
LABEL maintainer="nekohasekai <contact-git@sekai.icu>"
|
LABEL maintainer="shtorm-7"
|
||||||
RUN set -ex \
|
RUN set -ex \
|
||||||
&& apk upgrade \
|
&& apk add --no-cache --upgrade bash tzdata ca-certificates nftables
|
||||||
&& apk add bash tzdata ca-certificates nftables \
|
|
||||||
&& rm -rf /var/cache/apk/*
|
|
||||||
COPY --from=builder /go/bin/sing-box /usr/local/bin/sing-box
|
COPY --from=builder /go/bin/sing-box /usr/local/bin/sing-box
|
||||||
ENTRYPOINT ["sing-box"]
|
ENTRYPOINT ["sing-box"]
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
ARG BASE_IMAGE=alpine
|
||||||
|
FROM ${BASE_IMAGE}
|
||||||
|
ARG TARGETARCH
|
||||||
|
ARG TARGETVARIANT
|
||||||
|
LABEL maintainer="nekohasekai <contact-git@sekai.icu>"
|
||||||
|
RUN set -ex \
|
||||||
|
&& if command -v apk > /dev/null; then \
|
||||||
|
apk add --no-cache --upgrade bash tzdata ca-certificates nftables; \
|
||||||
|
else \
|
||||||
|
apt-get update && apt-get install -y --no-install-recommends bash tzdata ca-certificates nftables \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*; \
|
||||||
|
fi
|
||||||
|
COPY sing-box-${TARGETARCH}${TARGETVARIANT} /usr/local/bin/sing-box
|
||||||
|
ENTRYPOINT ["sing-box"]
|
||||||
@@ -1,22 +1,54 @@
|
|||||||
NAME = sing-box
|
NAME = sing-box
|
||||||
COMMIT = $(shell git rev-parse --short HEAD)
|
COMMIT = $(shell git rev-parse --short HEAD)
|
||||||
TAGS ?= with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale
|
TAGS ?= $(shell cat release/DEFAULT_BUILD_TAGS_OTHERS)
|
||||||
|
|
||||||
GOHOSTOS = $(shell go env GOHOSTOS)
|
GOHOSTOS = $(shell go env GOHOSTOS)
|
||||||
GOHOSTARCH = $(shell go env GOHOSTARCH)
|
GOHOSTARCH = $(shell go env GOHOSTARCH)
|
||||||
VERSION=$(shell CGO_ENABLED=0 GOOS=$(GOHOSTOS) GOARCH=$(GOHOSTARCH) go run github.com/sagernet/sing-box/cmd/internal/read_tag@latest)
|
VERSION=$(shell CGO_ENABLED=0 GOOS=$(GOHOSTOS) GOARCH=$(GOHOSTARCH) go run github.com/sagernet/sing-box/cmd/internal/read_tag@latest)
|
||||||
|
|
||||||
PARAMS = -v -trimpath -ldflags "-X 'github.com/sagernet/sing-box/constant.Version=$(VERSION)' -s -w -buildid="
|
LDFLAGS_SHARED = $(shell cat release/LDFLAGS)
|
||||||
|
PARAMS = -v -trimpath -ldflags "-X 'github.com/sagernet/sing-box/constant.Version=$(VERSION)' $(LDFLAGS_SHARED) -s -w -buildid="
|
||||||
MAIN_PARAMS = $(PARAMS) -tags "$(TAGS)"
|
MAIN_PARAMS = $(PARAMS) -tags "$(TAGS)"
|
||||||
MAIN = ./cmd/sing-box
|
MAIN = ./cmd/sing-box
|
||||||
PREFIX ?= $(shell go env GOPATH)
|
PREFIX ?= $(shell go env GOPATH)
|
||||||
|
SING_FFI ?= sing-ffi
|
||||||
|
LIBBOX_FFI_CONFIG ?= ./experimental/libbox/ffi.json
|
||||||
|
|
||||||
.PHONY: test release docs build
|
ADMIN_PANEL_DIR = service/admin_panel
|
||||||
|
ADMIN_PANEL_WEB = $(ADMIN_PANEL_DIR)/web
|
||||||
|
ADMIN_PANEL_DIST = $(ADMIN_PANEL_DIR)/dist
|
||||||
|
ADMIN_PANEL_TAGS = $(TAGS),with_admin_panel
|
||||||
|
|
||||||
|
DOCKER_IMAGE ?= shtorm7/sing-box-extended
|
||||||
|
DOCKER_PLATFORMS ?= linux/amd64,linux/arm64
|
||||||
|
|
||||||
|
CRONET_GO_PATH ?= $(shell pwd)/cronet-go
|
||||||
|
|
||||||
|
.PHONY: test release docs build schema
|
||||||
|
|
||||||
build:
|
build:
|
||||||
export GOTOOLCHAIN=local && \
|
|
||||||
go build $(MAIN_PARAMS) $(MAIN)
|
go build $(MAIN_PARAMS) $(MAIN)
|
||||||
|
|
||||||
|
build_admin_panel:
|
||||||
|
cd $(ADMIN_PANEL_WEB) && \
|
||||||
|
npm install --no-fund --no-audit && \
|
||||||
|
npm run build
|
||||||
|
go run ./cmd/internal/admin_panel_pack \
|
||||||
|
-dir $(ADMIN_PANEL_DIST)
|
||||||
|
|
||||||
|
build_naive:
|
||||||
|
cd $(CRONET_GO_PATH) && \
|
||||||
|
for arch in amd64 arm64 386 arm mipsle mips64le riscv64 loong64; do \
|
||||||
|
go run ./cmd/build-naive --target=linux/$$arch download-toolchain; \
|
||||||
|
done && \
|
||||||
|
for arch in amd64 arm64 386 arm mipsle riscv64 loong64; do \
|
||||||
|
go run ./cmd/build-naive --target=linux/$$arch --libc=musl download-toolchain; \
|
||||||
|
done
|
||||||
|
|
||||||
|
race:
|
||||||
|
export GOTOOLCHAIN=local && \
|
||||||
|
go build -race $(MAIN_PARAMS) $(MAIN)
|
||||||
|
|
||||||
ci_build:
|
ci_build:
|
||||||
export GOTOOLCHAIN=local && \
|
export GOTOOLCHAIN=local && \
|
||||||
go build $(PARAMS) $(MAIN) && \
|
go build $(PARAMS) $(MAIN) && \
|
||||||
@@ -25,32 +57,31 @@ ci_build:
|
|||||||
generate_completions:
|
generate_completions:
|
||||||
go run -v --tags "$(TAGS),generate,generate_completions" $(MAIN)
|
go run -v --tags "$(TAGS),generate,generate_completions" $(MAIN)
|
||||||
|
|
||||||
|
schema:
|
||||||
|
go run -ldflags "$(LDFLAGS_SHARED)" --tags "$(TAGS)" $(MAIN) schema -o docs/schema.json
|
||||||
|
|
||||||
install:
|
install:
|
||||||
go build -o $(PREFIX)/bin/$(NAME) $(MAIN_PARAMS) $(MAIN)
|
go build -o $(PREFIX)/bin/$(NAME) $(MAIN_PARAMS) $(MAIN)
|
||||||
|
|
||||||
fmt:
|
fmt:
|
||||||
@gofumpt -l -w .
|
@golangci-lint fmt
|
||||||
@gofmt -s -w .
|
|
||||||
@gci write --custom-order -s standard -s "prefix(github.com/sagernet/)" -s "default" .
|
|
||||||
|
|
||||||
fmt_install:
|
fmt_docs:
|
||||||
go install -v mvdan.cc/gofumpt@latest
|
go run ./cmd/internal/format_docs
|
||||||
go install -v github.com/daixiang0/gci@latest
|
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
GOOS=linux golangci-lint run ./...
|
GOOS=linux golangci-lint run ./...
|
||||||
GOOS=android golangci-lint run ./...
|
GOOS=android golangci-lint run ./...
|
||||||
GOOS=windows golangci-lint run ./...
|
GOOS=windows golangci-lint run ./...
|
||||||
GOOS=darwin golangci-lint run ./...
|
GOOS=darwin golangci-lint run ./...
|
||||||
GOOS=freebsd golangci-lint run ./...
|
# GOOS=freebsd golangci-lint run ./...
|
||||||
|
|
||||||
lint_install:
|
lint_install:
|
||||||
go install -v github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
go install -v github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
|
||||||
|
|
||||||
proto:
|
proto:
|
||||||
@go run ./cmd/internal/protogen
|
@go run ./cmd/internal/protogen
|
||||||
@gofumpt -l -w .
|
@golangci-lint fmt
|
||||||
@gofumpt -l -w .
|
|
||||||
|
|
||||||
proto_install:
|
proto_install:
|
||||||
go install -v google.golang.org/protobuf/cmd/protoc-gen-go@latest
|
go install -v google.golang.org/protobuf/cmd/protoc-gen-go@latest
|
||||||
@@ -59,17 +90,16 @@ proto_install:
|
|||||||
update_certificates:
|
update_certificates:
|
||||||
go run ./cmd/internal/update_certificates
|
go run ./cmd/internal/update_certificates
|
||||||
|
|
||||||
release:
|
release: build_admin_panel build_naive
|
||||||
go run ./cmd/internal/build goreleaser release --clean --skip publish
|
CRONET_GO_PATH=$(CRONET_GO_PATH) go run ./cmd/internal/build goreleaser release --skip=validate --clean -p 3 --skip publish
|
||||||
mkdir dist/release
|
mkdir dist/release
|
||||||
mv dist/*.tar.gz \
|
mv dist/*.tar.gz \
|
||||||
dist/*.zip \
|
dist/*.zip \
|
||||||
dist/*.deb \
|
dist/*.ipk \
|
||||||
dist/*.rpm \
|
dist/*.apk \
|
||||||
dist/*_amd64.pkg.tar.zst \
|
|
||||||
dist/*_arm64.pkg.tar.zst \
|
|
||||||
dist/release
|
dist/release
|
||||||
ghr --replace --draft --prerelease -p 5 "v${VERSION}" dist/release
|
ghr --replace --draft --prerelease -p 5 "v${VERSION}" dist/release
|
||||||
|
./codeberg-release.sh --replace --draft --prerelease -p 5 "v${VERSION}" dist/release
|
||||||
rm -r dist/release
|
rm -r dist/release
|
||||||
|
|
||||||
release_repo:
|
release_repo:
|
||||||
@@ -78,17 +108,32 @@ release_repo:
|
|||||||
release_install:
|
release_install:
|
||||||
go install -v github.com/tcnksm/ghr@latest
|
go install -v github.com/tcnksm/ghr@latest
|
||||||
|
|
||||||
|
release_docker:
|
||||||
|
sudo docker buildx build \
|
||||||
|
--platform $(DOCKER_PLATFORMS) \
|
||||||
|
-t $(DOCKER_IMAGE):latest \
|
||||||
|
-t $(DOCKER_IMAGE):$(VERSION) \
|
||||||
|
--push \
|
||||||
|
--network=host \
|
||||||
|
.
|
||||||
|
|
||||||
update_android_version:
|
update_android_version:
|
||||||
go run ./cmd/internal/update_android_version
|
go run ./cmd/internal/update_android_version
|
||||||
|
|
||||||
|
update_desktop_version:
|
||||||
|
go run ./cmd/internal/update_desktop_version
|
||||||
|
|
||||||
build_android:
|
build_android:
|
||||||
cd ../sing-box-for-android && ./gradlew :app:clean :app:assemblePlayRelease :app:assembleOtherRelease && ./gradlew --stop
|
cd ../sing-box-for-android && ./gradlew :app:clean :app:assembleOtherRelease && ./gradlew --stop
|
||||||
|
|
||||||
upload_android:
|
upload_android:
|
||||||
mkdir -p dist/release_android
|
mkdir -p dist/release_android
|
||||||
cp ../sing-box-for-android/app/build/outputs/apk/play/release/*.apk dist/release_android
|
cp ../sing-box-for-android/app/build/outputs/apk/other/release/*.apk dist/release_android
|
||||||
cp ../sing-box-for-android/app/build/outputs/apk/other/release/*-universal.apk dist/release_android
|
VERSION_CODE=$$(grep VERSION_CODE ../sing-box-for-android/version.properties | cut -d= -f2); \
|
||||||
|
VERSION_NAME=$$(grep VERSION_NAME ../sing-box-for-android/version.properties | cut -d= -f2); \
|
||||||
|
printf '{\n "version_code": %s,\n "version_name": "%s"\n}\n' "$$VERSION_CODE" "$$VERSION_NAME" > dist/release_android/SFA-version-metadata.json
|
||||||
ghr --replace --draft --prerelease -p 5 "v${VERSION}" dist/release_android
|
ghr --replace --draft --prerelease -p 5 "v${VERSION}" dist/release_android
|
||||||
|
./codeberg-release.sh --replace --draft --prerelease -p 5 "v${VERSION}" dist/release_android
|
||||||
rm -rf dist/release_android
|
rm -rf dist/release_android
|
||||||
|
|
||||||
release_android: lib_android update_android_version build_android upload_android
|
release_android: lib_android update_android_version build_android upload_android
|
||||||
@@ -96,24 +141,48 @@ release_android: lib_android update_android_version build_android upload_android
|
|||||||
publish_android:
|
publish_android:
|
||||||
cd ../sing-box-for-android && ./gradlew :app:publishPlayReleaseBundle && ./gradlew --stop
|
cd ../sing-box-for-android && ./gradlew :app:publishPlayReleaseBundle && ./gradlew --stop
|
||||||
|
|
||||||
|
build_desktop_windows:
|
||||||
|
cd ../sing-box-for-desktop && pnpm install --frozen-lockfile && pnpm run package:win
|
||||||
|
|
||||||
|
build_desktop_linux:
|
||||||
|
cd ../sing-box-for-desktop && pnpm install --frozen-lockfile && pnpm run package:linux
|
||||||
|
|
||||||
|
upload_desktop:
|
||||||
|
mkdir -p dist/release_desktop
|
||||||
|
cp ../sing-box-for-desktop/release/SFW-*.exe dist/release_desktop 2>/dev/null || true
|
||||||
|
cp ../sing-box-for-desktop/release/SFL-*.deb ../sing-box-for-desktop/release/SFL-*.rpm ../sing-box-for-desktop/release/SFL-*.pkg.tar.zst dist/release_desktop 2>/dev/null || true
|
||||||
|
ghr --replace --draft --prerelease -p 5 "v${VERSION}" dist/release_desktop
|
||||||
|
./codeberg-release.sh --replace --draft --prerelease -p 5 "v${VERSION}" dist/release_desktop
|
||||||
|
rm -rf dist/release_desktop
|
||||||
|
|
||||||
|
release_desktop: update_desktop_version build_desktop_windows build_desktop_linux upload_desktop
|
||||||
|
|
||||||
# TODO: find why and remove `-destination 'generic/platform=iOS'`
|
# TODO: find why and remove `-destination 'generic/platform=iOS'`
|
||||||
# TODO: remove xcode clean when fix control widget fixed
|
# TODO: remove xcode clean when fix control widget fixed
|
||||||
build_ios:
|
build_ios:
|
||||||
cd ../sing-box-for-apple && \
|
cd ../sing-box-for-apple && \
|
||||||
rm -rf build/SFI.xcarchive && \
|
rm -rf build/SFI.xcarchive && \
|
||||||
xcodebuild clean -scheme SFI && \
|
xcodebuild clean -scheme SFI -derivedDataPath build/SFI.dd && \
|
||||||
xcodebuild archive -scheme SFI -configuration Release -destination 'generic/platform=iOS' -archivePath build/SFI.xcarchive -allowProvisioningUpdates
|
xcodebuild archive -scheme SFI -configuration Release -destination 'generic/platform=iOS' -archivePath build/SFI.xcarchive -derivedDataPath build/SFI.dd -allowProvisioningUpdates | xcbeautify | grep -A 10 -e "Archive Succeeded" -e "ARCHIVE FAILED" -e "❌"
|
||||||
|
|
||||||
upload_ios_app_store:
|
upload_ios_app_store:
|
||||||
cd ../sing-box-for-apple && \
|
cd ../sing-box-for-apple && \
|
||||||
xcodebuild -exportArchive -archivePath build/SFI.xcarchive -exportOptionsPlist SFI/Upload.plist -allowProvisioningUpdates
|
xcodebuild -exportArchive -archivePath build/SFI.xcarchive -exportOptionsPlist SFI/Upload.plist -allowProvisioningUpdates
|
||||||
|
|
||||||
|
build_ios_deb:
|
||||||
|
$(MAKE) -C ../sing-box-for-apple build_ios_deb
|
||||||
|
|
||||||
|
upload_ios_deb:
|
||||||
|
ghr --replace --draft --prerelease "v${VERSION}" ../sing-box-for-apple/build/jailbreak/"SFI-${VERSION}-iphoneos-arm64.deb"
|
||||||
|
|
||||||
release_ios: build_ios upload_ios_app_store
|
release_ios: build_ios upload_ios_app_store
|
||||||
|
|
||||||
|
release_ios_deb: build_ios_deb upload_ios_deb
|
||||||
|
|
||||||
build_macos:
|
build_macos:
|
||||||
cd ../sing-box-for-apple && \
|
cd ../sing-box-for-apple && \
|
||||||
rm -rf build/SFM.xcarchive && \
|
rm -rf build/SFM.xcarchive && \
|
||||||
xcodebuild archive -scheme SFM -configuration Release -archivePath build/SFM.xcarchive -allowProvisioningUpdates
|
xcodebuild archive -scheme SFM -configuration Release -archivePath build/SFM.xcarchive -derivedDataPath build/SFM.dd -allowProvisioningUpdates | xcbeautify | grep -A 10 -e "Archive Succeeded" -e "ARCHIVE FAILED" -e "❌"
|
||||||
|
|
||||||
upload_macos_app_store:
|
upload_macos_app_store:
|
||||||
cd ../sing-box-for-apple && \
|
cd ../sing-box-for-apple && \
|
||||||
@@ -122,59 +191,82 @@ upload_macos_app_store:
|
|||||||
release_macos: build_macos upload_macos_app_store
|
release_macos: build_macos upload_macos_app_store
|
||||||
|
|
||||||
build_macos_standalone:
|
build_macos_standalone:
|
||||||
cd ../sing-box-for-apple && \
|
$(MAKE) -C ../sing-box-for-apple archive_macos_standalone
|
||||||
rm -rf build/SFM.System.xcarchive && \
|
|
||||||
xcodebuild archive -scheme SFM.System -configuration Release -archivePath build/SFM.System.xcarchive -allowProvisioningUpdates
|
|
||||||
|
|
||||||
build_macos_dmg:
|
build_macos_dmg:
|
||||||
rm -rf dist/SFM
|
$(MAKE) -C ../sing-box-for-apple build_macos_dmg
|
||||||
mkdir -p dist/SFM
|
|
||||||
cd ../sing-box-for-apple && \
|
build_macos_pkg:
|
||||||
rm -rf build/SFM.System && \
|
$(MAKE) -C ../sing-box-for-apple build_macos_pkg
|
||||||
rm -rf build/SFM.dmg && \
|
|
||||||
xcodebuild -exportArchive \
|
|
||||||
-archivePath "build/SFM.System.xcarchive" \
|
|
||||||
-exportOptionsPlist SFM.System/Export.plist -allowProvisioningUpdates \
|
|
||||||
-exportPath "build/SFM.System" && \
|
|
||||||
create-dmg \
|
|
||||||
--volname "sing-box" \
|
|
||||||
--volicon "build/SFM.System/SFM.app/Contents/Resources/AppIcon.icns" \
|
|
||||||
--icon "SFM.app" 0 0 \
|
|
||||||
--hide-extension "SFM.app" \
|
|
||||||
--app-drop-link 0 0 \
|
|
||||||
--skip-jenkins \
|
|
||||||
"../sing-box/dist/SFM/SFM.dmg" "build/SFM.System/SFM.app"
|
|
||||||
|
|
||||||
notarize_macos_dmg:
|
notarize_macos_dmg:
|
||||||
xcrun notarytool submit "dist/SFM/SFM.dmg" --wait \
|
$(MAKE) -C ../sing-box-for-apple notarize_macos_dmg
|
||||||
--keychain-profile "notarytool-password" \
|
|
||||||
--no-s3-acceleration
|
notarize_macos_pkg:
|
||||||
|
$(MAKE) -C ../sing-box-for-apple notarize_macos_pkg
|
||||||
|
|
||||||
upload_macos_dmg:
|
upload_macos_dmg:
|
||||||
cd dist/SFM && \
|
mkdir -p dist/SFM
|
||||||
cp SFM.dmg "SFM-${VERSION}-universal.dmg" && \
|
cp ../sing-box-for-apple/build/SFM-Apple.dmg "dist/SFM/SFM-${VERSION}-Apple.dmg"
|
||||||
ghr --replace --draft --prerelease "v${VERSION}" "SFM-${VERSION}-universal.dmg"
|
cp ../sing-box-for-apple/build/SFM-Intel.dmg "dist/SFM/SFM-${VERSION}-Intel.dmg"
|
||||||
|
cp ../sing-box-for-apple/build/SFM-Universal.dmg "dist/SFM/SFM-${VERSION}-Universal.dmg"
|
||||||
|
ghr --replace --draft --prerelease "v${VERSION}" "dist/SFM/SFM-${VERSION}-Apple.dmg"
|
||||||
|
ghr --replace --draft --prerelease "v${VERSION}" "dist/SFM/SFM-${VERSION}-Intel.dmg"
|
||||||
|
ghr --replace --draft --prerelease "v${VERSION}" "dist/SFM/SFM-${VERSION}-Universal.dmg"
|
||||||
|
|
||||||
|
upload_macos_pkg:
|
||||||
|
mkdir -p dist/SFM
|
||||||
|
cp ../sing-box-for-apple/build/SFM-Apple.pkg "dist/SFM/SFM-${VERSION}-Apple.pkg"
|
||||||
|
cp ../sing-box-for-apple/build/SFM-Intel.pkg "dist/SFM/SFM-${VERSION}-Intel.pkg"
|
||||||
|
cp ../sing-box-for-apple/build/SFM-Universal.pkg "dist/SFM/SFM-${VERSION}-Universal.pkg"
|
||||||
|
ghr --replace --draft --prerelease "v${VERSION}" "dist/SFM/SFM-${VERSION}-Apple.pkg"
|
||||||
|
ghr --replace --draft --prerelease "v${VERSION}" "dist/SFM/SFM-${VERSION}-Intel.pkg"
|
||||||
|
ghr --replace --draft --prerelease "v${VERSION}" "dist/SFM/SFM-${VERSION}-Universal.pkg"
|
||||||
|
|
||||||
|
replace_macos_pkg:
|
||||||
|
mkdir -p dist/SFM
|
||||||
|
cp ../sing-box-for-apple/build/SFM-Apple.pkg "dist/SFM/SFM-${VERSION}-Apple.pkg"
|
||||||
|
cp ../sing-box-for-apple/build/SFM-Intel.pkg "dist/SFM/SFM-${VERSION}-Intel.pkg"
|
||||||
|
cp ../sing-box-for-apple/build/SFM-Universal.pkg "dist/SFM/SFM-${VERSION}-Universal.pkg"
|
||||||
|
ghr --replace "v${VERSION}" "dist/SFM/SFM-${VERSION}-Apple.pkg"
|
||||||
|
ghr --replace "v${VERSION}" "dist/SFM/SFM-${VERSION}-Intel.pkg"
|
||||||
|
ghr --replace "v${VERSION}" "dist/SFM/SFM-${VERSION}-Universal.pkg"
|
||||||
|
|
||||||
upload_macos_dsyms:
|
upload_macos_dsyms:
|
||||||
pushd ../sing-box-for-apple/build/SFM.System.xcarchive && \
|
mkdir -p dist/SFM
|
||||||
zip -r SFM.dSYMs.zip dSYMs && \
|
cd ../sing-box-for-apple/build/SFM.System-universal.xcarchive && zip -r SFM.dSYMs.zip dSYMs
|
||||||
mv SFM.dSYMs.zip ../../../sing-box/dist/SFM && \
|
cp ../sing-box-for-apple/build/SFM.System-universal.xcarchive/SFM.dSYMs.zip "dist/SFM/SFM-${VERSION}.dSYMs.zip"
|
||||||
popd && \
|
ghr --replace --draft --prerelease "v${VERSION}" "dist/SFM/SFM-${VERSION}.dSYMs.zip"
|
||||||
cd dist/SFM && \
|
|
||||||
cp SFM.dSYMs.zip "SFM-${VERSION}-universal.dSYMs.zip" && \
|
|
||||||
ghr --replace --draft --prerelease "v${VERSION}" "SFM-${VERSION}-universal.dSYMs.zip"
|
|
||||||
|
|
||||||
release_macos_standalone: build_macos_standalone build_macos_dmg notarize_macos_dmg upload_macos_dmg upload_macos_dsyms
|
replace_macos_dsyms:
|
||||||
|
mkdir -p dist/SFM
|
||||||
|
cd ../sing-box-for-apple/build/SFM.System-universal.xcarchive && zip -r SFM.dSYMs.zip dSYMs
|
||||||
|
cp ../sing-box-for-apple/build/SFM.System-universal.xcarchive/SFM.dSYMs.zip "dist/SFM/SFM-${VERSION}.dSYMs.zip"
|
||||||
|
ghr --replace "v${VERSION}" "dist/SFM/SFM-${VERSION}.dSYMs.zip"
|
||||||
|
|
||||||
|
release_macos_standalone: build_macos_pkg notarize_macos_pkg upload_macos_pkg upload_macos_dsyms
|
||||||
|
|
||||||
|
replace_macos_standalone: build_macos_pkg notarize_macos_pkg upload_macos_pkg upload_macos_dsyms
|
||||||
|
|
||||||
build_tvos:
|
build_tvos:
|
||||||
cd ../sing-box-for-apple && \
|
cd ../sing-box-for-apple && \
|
||||||
rm -rf build/SFT.xcarchive && \
|
rm -rf build/SFT.xcarchive && \
|
||||||
xcodebuild archive -scheme SFT -configuration Release -archivePath build/SFT.xcarchive -allowProvisioningUpdates
|
xcodebuild archive -scheme SFT -configuration Release -archivePath build/SFT.xcarchive -derivedDataPath build/SFT.dd -allowProvisioningUpdates | xcbeautify | grep -A 10 -e "Archive Succeeded" -e "ARCHIVE FAILED" -e "❌"
|
||||||
|
|
||||||
upload_tvos_app_store:
|
upload_tvos_app_store:
|
||||||
cd ../sing-box-for-apple && \
|
cd ../sing-box-for-apple && \
|
||||||
xcodebuild -exportArchive -archivePath "build/SFT.xcarchive" -exportOptionsPlist SFI/Upload.plist -allowProvisioningUpdates
|
xcodebuild -exportArchive -archivePath "build/SFT.xcarchive" -exportOptionsPlist SFI/Upload.plist -allowProvisioningUpdates
|
||||||
|
|
||||||
|
export_tvos_ipa:
|
||||||
|
cd ../sing-box-for-apple && \
|
||||||
|
xcodebuild -exportArchive -archivePath "build/SFT.xcarchive" -exportOptionsPlist SFI/Export.plist -allowProvisioningUpdates -exportPath build/SFT && \
|
||||||
|
cp build/SFT/sing-box.ipa dist/SFT.ipa
|
||||||
|
|
||||||
|
upload_tvos_ipa:
|
||||||
|
cd dist && \
|
||||||
|
cp SFT.ipa "SFT-${VERSION}.ipa" && \
|
||||||
|
ghr --replace --draft --prerelease "v${VERSION}" "SFT-${VERSION}.ipa"
|
||||||
|
|
||||||
release_tvos: build_tvos upload_tvos_app_store
|
release_tvos: build_tvos upload_tvos_app_store
|
||||||
|
|
||||||
update_apple_version:
|
update_apple_version:
|
||||||
@@ -183,12 +275,12 @@ update_apple_version:
|
|||||||
update_macos_version:
|
update_macos_version:
|
||||||
MACOS_PROJECT_VERSION=$(shell go run -v ./cmd/internal/app_store_connect next_macos_project_version) go run ./cmd/internal/update_apple_version
|
MACOS_PROJECT_VERSION=$(shell go run -v ./cmd/internal/app_store_connect next_macos_project_version) go run ./cmd/internal/update_apple_version
|
||||||
|
|
||||||
release_apple: lib_ios update_apple_version release_ios release_macos release_tvos release_macos_standalone
|
release_apple: lib_apple update_apple_version release_ios release_macos release_tvos release_macos_standalone
|
||||||
|
|
||||||
release_apple_beta: update_apple_version release_ios release_macos release_tvos
|
release_apple_beta: update_apple_version release_ios release_macos release_tvos
|
||||||
|
|
||||||
publish_testflight:
|
publish_testflight:
|
||||||
go run -v ./cmd/internal/app_store_connect publish_testflight
|
go run -v ./cmd/internal/app_store_connect publish_testflight $(filter-out $@,$(MAKECMDGOALS))
|
||||||
|
|
||||||
prepare_app_store:
|
prepare_app_store:
|
||||||
go run -v ./cmd/internal/app_store_connect prepare_app_store
|
go run -v ./cmd/internal/app_store_connect prepare_app_store
|
||||||
@@ -211,22 +303,21 @@ test_stdio:
|
|||||||
lib_android:
|
lib_android:
|
||||||
go run ./cmd/internal/build_libbox -target android
|
go run ./cmd/internal/build_libbox -target android
|
||||||
|
|
||||||
lib_android_debug:
|
|
||||||
go run ./cmd/internal/build_libbox -target android -debug
|
|
||||||
|
|
||||||
lib_apple:
|
lib_apple:
|
||||||
go run ./cmd/internal/build_libbox -target apple
|
go run ./cmd/internal/build_libbox -target apple
|
||||||
|
|
||||||
lib_ios:
|
lib_windows:
|
||||||
go run ./cmd/internal/build_libbox -target apple -platform ios -debug
|
$(SING_FFI) generate --config $(LIBBOX_FFI_CONFIG) --platform-type csharp
|
||||||
|
|
||||||
lib:
|
lib_android_new:
|
||||||
go run ./cmd/internal/build_libbox -target android
|
$(SING_FFI) generate --config $(LIBBOX_FFI_CONFIG) --platform-type android
|
||||||
go run ./cmd/internal/build_libbox -target ios
|
|
||||||
|
lib_apple_new:
|
||||||
|
$(SING_FFI) generate --config $(LIBBOX_FFI_CONFIG) --platform-type apple
|
||||||
|
|
||||||
lib_install:
|
lib_install:
|
||||||
go install -v github.com/sagernet/gomobile/cmd/gomobile@v0.1.6
|
go install -v github.com/sagernet/gomobile/cmd/gomobile@v0.1.13
|
||||||
go install -v github.com/sagernet/gomobile/cmd/gobind@v0.1.6
|
go install -v github.com/sagernet/gomobile/cmd/gobind@v0.1.13
|
||||||
|
|
||||||
docs:
|
docs:
|
||||||
venv/bin/mkdocs serve
|
venv/bin/mkdocs serve
|
||||||
@@ -235,8 +326,8 @@ publish_docs:
|
|||||||
venv/bin/mkdocs gh-deploy -m "Update" --force --ignore-version --no-history
|
venv/bin/mkdocs gh-deploy -m "Update" --force --ignore-version --no-history
|
||||||
|
|
||||||
docs_install:
|
docs_install:
|
||||||
python -m venv venv
|
python3 -m venv venv
|
||||||
source ./venv/bin/activate && pip install --force-reinstall mkdocs-material=="9.*" mkdocs-static-i18n=="1.2.*"
|
source ./venv/bin/activate && pip install --force-reinstall mkdocs-material=="9.7.2" mkdocs-static-i18n=="1.2.*"
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf bin dist sing-box
|
rm -rf bin dist sing-box
|
||||||
@@ -246,3 +337,6 @@ update:
|
|||||||
git fetch
|
git fetch
|
||||||
git reset FETCH_HEAD --hard
|
git reset FETCH_HEAD --hard
|
||||||
git clean -fdx
|
git clean -fdx
|
||||||
|
|
||||||
|
%:
|
||||||
|
@:
|
||||||
|
|||||||
@@ -1,12 +1,97 @@
|
|||||||
# sing-box
|
# sing-box-extended
|
||||||
|
|
||||||
The universal proxy platform.
|
[](LICENSE)
|
||||||
|
[](go.mod)
|
||||||
|
[](https://codeberg.org/shtorm-7/sing-box-extended)
|
||||||
|
[](https://t.me/sing_box_extended)
|
||||||
|
|
||||||
[](https://repology.org/project/sing-box/versions)
|
Sing-box with extended features.
|
||||||
|
|
||||||
## Documentation
|
## 🔥 Features
|
||||||
|
|
||||||
https://sing-box.sagernet.org
|
### Protocols
|
||||||
|
- **WARP** — Cloudflare WARP integration through WireGuard
|
||||||
|
- **MASQUE** — Cloudflare MASQUE proxy over QUIC / HTTP-2
|
||||||
|
- **MTProxy** — Telegram MTProxy server with FakeTLS and domain fronting
|
||||||
|
- **Mieru** — Secure, hard to classify, hard to probe network protocol
|
||||||
|
- **TrustTunnel** — AdGuard's obfuscated VPN protocol, indistinguishable from HTTPS traffic
|
||||||
|
- **Sudoku** — Traffic obfuscation protocol based on 4×4 Sudoku puzzles with low-entropy fingerprints
|
||||||
|
- **SSH** — SSH client and server with certificate authentication and upstream fallback
|
||||||
|
- **Call** — Traffic tunneling through video-call platforms (VK, Dion, Telemost, WBStream)
|
||||||
|
- **VPN** — Routed tunnel over any sing-box protocol
|
||||||
|
- **Bond** — Link aggregation for increasing throughput
|
||||||
|
- **Fallback** — Outbound group with priority-based switching
|
||||||
|
- **Failover** — Automatic outbound switching with session recovery for high availability
|
||||||
|
|
||||||
|
### DNS
|
||||||
|
- **SDNS (DNSCrypt)** — Encrypted DNS queries for enhanced privacy
|
||||||
|
- **DNS Fallback** — Sequential / parallel queries across upstream resolvers
|
||||||
|
|
||||||
|
### Limiters
|
||||||
|
- **Bandwidth Limiter** — Upload / download / bidirectional rate limiting
|
||||||
|
- **Connection Limiter** — Concurrent connection control
|
||||||
|
- **Traffic Limiter** — Per-user traffic quotas
|
||||||
|
- **Rate Limiter** — Request rate limiting
|
||||||
|
|
||||||
|
### Encryption & Obfuscation
|
||||||
|
- **Amnezia 3.1** — WireGuard traffic obfuscation
|
||||||
|
- **VLESS encryption** — XRAY encryption for VLESS protocol
|
||||||
|
|
||||||
|
### Transports
|
||||||
|
- **mKCP** — Reliable UDP-based transport
|
||||||
|
- **XHTTP** — Modern XRAY transport
|
||||||
|
- **Rmux** — Improved smux multiplexer
|
||||||
|
|
||||||
|
### Services
|
||||||
|
- **Admin Panel** — Web-based management interface
|
||||||
|
- **Manager** — Management service for configuring users, nodes, limiters
|
||||||
|
- **Manager API (HTTP/gRPC)** — HTTP and gRPC API for the Manager
|
||||||
|
- **Node Manager API** — Service for connecting nodes to remote manager
|
||||||
|
|
||||||
|
### Miscellaneous
|
||||||
|
- **Providers** — Outbound subscriptions from local files, inline lists, or remote URLs (sing-box JSON, Clash YAML, SIP008, share links)
|
||||||
|
- **Link Parser** — Outbound configured from a share link (VLESS, VMess, Shadowsocks, Trojan, Hysteria, Hysteria2, TUIC, AnyTLS)
|
||||||
|
- **Extended WireGuard options** — Advanced configuration capabilities
|
||||||
|
- **Unified Delay** — Unified latency measurement
|
||||||
|
|
||||||
|
## 📚 Examples
|
||||||
|
|
||||||
|
Configuration examples are available here:
|
||||||
|
|
||||||
|
https://github.com/shtorm-7/sing-box-extended/tree/extended/examples
|
||||||
|
|
||||||
|
## Support the Project
|
||||||
|
|
||||||
|
If you want to support the project, you can donate to the following addresses.
|
||||||
|
|
||||||
|
#### Tribute
|
||||||
|
|
||||||
|
**[RUB Donate](https://web.tribute.tg/d/JxY)**
|
||||||
|
|
||||||
|
**[EUR Donate](https://web.tribute.tg/d/JxZ)**
|
||||||
|
|
||||||
|
**[USD Donate](https://web.tribute.tg/d/Jy1)**
|
||||||
|
|
||||||
|
#### TRX (Tron)
|
||||||
|
```
|
||||||
|
TSWU6VUZ4FcUghYDmbbhK15gRVvhvBgW3F
|
||||||
|
```
|
||||||
|
#### TON
|
||||||
|
```
|
||||||
|
UQAyD2UuT5kCP6lZQlhFL0hyNibDXNE4nIo_RSLVSYAtD7N1
|
||||||
|
```
|
||||||
|
#### Solana
|
||||||
|
```
|
||||||
|
CJu8ickwRCwNE71uVFjYf1UveyCkRp9Xo44rhPcQpeFL
|
||||||
|
```
|
||||||
|
#### Bitcoin
|
||||||
|
```
|
||||||
|
bc1qqx97p8k4dchqkyd47s4vf74hrqdfnmhqvcja7x
|
||||||
|
```
|
||||||
|
#### Ethereum
|
||||||
|
```
|
||||||
|
0xAcc5919C22F2B3fAa0ec7E8BaD142da5B375FBF6
|
||||||
|
```
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
@@ -28,4 +113,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
In addition, no derivative work may use the name or imply association
|
In addition, no derivative work may use the name or imply association
|
||||||
with this application without prior consent.
|
with this application without prior consent.
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import (
|
|||||||
type CertificateStore interface {
|
type CertificateStore interface {
|
||||||
LifecycleService
|
LifecycleService
|
||||||
Pool() *x509.CertPool
|
Pool() *x509.CertPool
|
||||||
|
ExclusiveAnchors() bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func RootPoolFromContext(ctx context.Context) *x509.CertPool {
|
func RootPoolFromContext(ctx context.Context) *x509.CertPool {
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package certificate
|
||||||
|
|
||||||
|
type Adapter struct {
|
||||||
|
providerType string
|
||||||
|
providerTag string
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewAdapter(providerType string, providerTag string) Adapter {
|
||||||
|
return Adapter{
|
||||||
|
providerType: providerType,
|
||||||
|
providerTag: providerTag,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Adapter) Type() string {
|
||||||
|
return a.providerType
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Adapter) Tag() string {
|
||||||
|
return a.providerTag
|
||||||
|
}
|
||||||
@@ -0,0 +1,158 @@
|
|||||||
|
package certificate
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"os"
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/sagernet/sing-box/adapter"
|
||||||
|
"github.com/sagernet/sing-box/common/taskmonitor"
|
||||||
|
C "github.com/sagernet/sing-box/constant"
|
||||||
|
"github.com/sagernet/sing-box/log"
|
||||||
|
"github.com/sagernet/sing/common"
|
||||||
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
|
F "github.com/sagernet/sing/common/format"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ adapter.CertificateProviderManager = (*Manager)(nil)
|
||||||
|
|
||||||
|
type Manager struct {
|
||||||
|
logger log.ContextLogger
|
||||||
|
registry adapter.CertificateProviderRegistry
|
||||||
|
access sync.Mutex
|
||||||
|
started bool
|
||||||
|
stage adapter.StartStage
|
||||||
|
providers []adapter.CertificateProviderService
|
||||||
|
providerByTag map[string]adapter.CertificateProviderService
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewManager(logger log.ContextLogger, registry adapter.CertificateProviderRegistry) *Manager {
|
||||||
|
return &Manager{
|
||||||
|
logger: logger,
|
||||||
|
registry: registry,
|
||||||
|
providerByTag: make(map[string]adapter.CertificateProviderService),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Manager) Start(stage adapter.StartStage) error {
|
||||||
|
m.access.Lock()
|
||||||
|
if m.started && m.stage >= stage {
|
||||||
|
panic("already started")
|
||||||
|
}
|
||||||
|
m.started = true
|
||||||
|
m.stage = stage
|
||||||
|
providers := m.providers
|
||||||
|
m.access.Unlock()
|
||||||
|
for _, provider := range providers {
|
||||||
|
name := "certificate-provider/" + provider.Type() + "[" + provider.Tag() + "]"
|
||||||
|
m.logger.Trace(stage, " ", name)
|
||||||
|
startTime := time.Now()
|
||||||
|
err := adapter.LegacyStart(provider, stage)
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, stage, " ", name)
|
||||||
|
}
|
||||||
|
m.logger.Trace(stage, " ", name, " completed (", F.Seconds(time.Since(startTime).Seconds()), "s)")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Manager) Close() error {
|
||||||
|
m.access.Lock()
|
||||||
|
defer m.access.Unlock()
|
||||||
|
if !m.started {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
m.started = false
|
||||||
|
providers := m.providers
|
||||||
|
m.providers = nil
|
||||||
|
monitor := taskmonitor.New(m.logger, C.StopTimeout)
|
||||||
|
var err error
|
||||||
|
for _, provider := range providers {
|
||||||
|
name := "certificate-provider/" + provider.Type() + "[" + provider.Tag() + "]"
|
||||||
|
m.logger.Trace("close ", name)
|
||||||
|
startTime := time.Now()
|
||||||
|
monitor.Start("close ", name)
|
||||||
|
err = E.Append(err, provider.Close(), func(err error) error {
|
||||||
|
return E.Cause(err, "close ", name)
|
||||||
|
})
|
||||||
|
monitor.Finish()
|
||||||
|
m.logger.Trace("close ", name, " completed (", F.Seconds(time.Since(startTime).Seconds()), "s)")
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Manager) CertificateProviders() []adapter.CertificateProviderService {
|
||||||
|
m.access.Lock()
|
||||||
|
defer m.access.Unlock()
|
||||||
|
return m.providers
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Manager) Get(tag string) (adapter.CertificateProviderService, bool) {
|
||||||
|
m.access.Lock()
|
||||||
|
provider, found := m.providerByTag[tag]
|
||||||
|
m.access.Unlock()
|
||||||
|
return provider, found
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Manager) Remove(tag string) error {
|
||||||
|
m.access.Lock()
|
||||||
|
provider, found := m.providerByTag[tag]
|
||||||
|
if !found {
|
||||||
|
m.access.Unlock()
|
||||||
|
return os.ErrInvalid
|
||||||
|
}
|
||||||
|
delete(m.providerByTag, tag)
|
||||||
|
index := common.Index(m.providers, func(it adapter.CertificateProviderService) bool {
|
||||||
|
return it == provider
|
||||||
|
})
|
||||||
|
if index == -1 {
|
||||||
|
panic("invalid certificate provider index")
|
||||||
|
}
|
||||||
|
m.providers = append(m.providers[:index], m.providers[index+1:]...)
|
||||||
|
started := m.started
|
||||||
|
m.access.Unlock()
|
||||||
|
if started {
|
||||||
|
return provider.Close()
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Manager) Create(ctx context.Context, logger log.ContextLogger, tag string, providerType string, options any) error {
|
||||||
|
provider, err := m.registry.Create(ctx, logger, tag, providerType, options)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
m.access.Lock()
|
||||||
|
defer m.access.Unlock()
|
||||||
|
if m.started {
|
||||||
|
name := "certificate-provider/" + provider.Type() + "[" + provider.Tag() + "]"
|
||||||
|
for _, stage := range adapter.ListStartStages {
|
||||||
|
m.logger.Trace(stage, " ", name)
|
||||||
|
startTime := time.Now()
|
||||||
|
err = adapter.LegacyStart(provider, stage)
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, stage, " ", name)
|
||||||
|
}
|
||||||
|
m.logger.Trace(stage, " ", name, " completed (", F.Seconds(time.Since(startTime).Seconds()), "s)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if existsProvider, loaded := m.providerByTag[tag]; loaded {
|
||||||
|
if m.started {
|
||||||
|
err = existsProvider.Close()
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, "close certificate-provider/", existsProvider.Type(), "[", existsProvider.Tag(), "]")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
existsIndex := common.Index(m.providers, func(it adapter.CertificateProviderService) bool {
|
||||||
|
return it == existsProvider
|
||||||
|
})
|
||||||
|
if existsIndex == -1 {
|
||||||
|
panic("invalid certificate provider index")
|
||||||
|
}
|
||||||
|
m.providers = append(m.providers[:existsIndex], m.providers[existsIndex+1:]...)
|
||||||
|
}
|
||||||
|
m.providers = append(m.providers, provider)
|
||||||
|
m.providerByTag[tag] = provider
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
package certificate
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"maps"
|
||||||
|
"slices"
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"github.com/sagernet/sing-box/adapter"
|
||||||
|
"github.com/sagernet/sing-box/log"
|
||||||
|
"github.com/sagernet/sing/common"
|
||||||
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ConstructorFunc[T any] func(ctx context.Context, logger log.ContextLogger, tag string, options T) (adapter.CertificateProviderService, error)
|
||||||
|
|
||||||
|
func Register[Options any](registry *Registry, providerType string, constructor ConstructorFunc[Options]) {
|
||||||
|
registry.register(providerType, func() any {
|
||||||
|
return new(Options)
|
||||||
|
}, func(ctx context.Context, logger log.ContextLogger, tag string, rawOptions any) (adapter.CertificateProviderService, error) {
|
||||||
|
var options *Options
|
||||||
|
if rawOptions != nil {
|
||||||
|
options = rawOptions.(*Options)
|
||||||
|
}
|
||||||
|
return constructor(ctx, logger, tag, common.PtrValueOrDefault(options))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ adapter.CertificateProviderRegistry = (*Registry)(nil)
|
||||||
|
|
||||||
|
type (
|
||||||
|
optionsConstructorFunc func() any
|
||||||
|
constructorFunc func(ctx context.Context, logger log.ContextLogger, tag string, options any) (adapter.CertificateProviderService, error)
|
||||||
|
)
|
||||||
|
|
||||||
|
type Registry struct {
|
||||||
|
access sync.Mutex
|
||||||
|
optionsType map[string]optionsConstructorFunc
|
||||||
|
constructor map[string]constructorFunc
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRegistry() *Registry {
|
||||||
|
return &Registry{
|
||||||
|
optionsType: make(map[string]optionsConstructorFunc),
|
||||||
|
constructor: make(map[string]constructorFunc),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Registry) OptionTypes() []string {
|
||||||
|
m.access.Lock()
|
||||||
|
defer m.access.Unlock()
|
||||||
|
return slices.Sorted(maps.Keys(m.optionsType))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Registry) CreateOptions(providerType string) (any, bool) {
|
||||||
|
m.access.Lock()
|
||||||
|
defer m.access.Unlock()
|
||||||
|
optionsConstructor, loaded := m.optionsType[providerType]
|
||||||
|
if !loaded {
|
||||||
|
return nil, false
|
||||||
|
}
|
||||||
|
return optionsConstructor(), true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Registry) Create(ctx context.Context, logger log.ContextLogger, tag string, providerType string, options any) (adapter.CertificateProviderService, error) {
|
||||||
|
m.access.Lock()
|
||||||
|
defer m.access.Unlock()
|
||||||
|
constructor, loaded := m.constructor[providerType]
|
||||||
|
if !loaded {
|
||||||
|
return nil, E.New("certificate provider type not found: " + providerType)
|
||||||
|
}
|
||||||
|
return constructor(ctx, logger, tag, options)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Registry) register(providerType string, optionsConstructor optionsConstructorFunc, constructor constructorFunc) {
|
||||||
|
m.access.Lock()
|
||||||
|
defer m.access.Unlock()
|
||||||
|
m.optionsType[providerType] = optionsConstructor
|
||||||
|
m.constructor[providerType] = constructor
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
//go:build darwin && cgo
|
||||||
|
|
||||||
|
package adapter
|
||||||
|
|
||||||
|
import "unsafe"
|
||||||
|
|
||||||
|
type AppleAnchors interface {
|
||||||
|
Retain() AppleAnchors
|
||||||
|
Release()
|
||||||
|
// Ref returns the underlying CFArrayRef, or nil if the anchor set is empty.
|
||||||
|
Ref() unsafe.Pointer
|
||||||
|
}
|
||||||
|
|
||||||
|
type AppleCertificateStore interface {
|
||||||
|
CertificateStore
|
||||||
|
AppleAnchors() AppleAnchors
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package adapter
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"crypto/tls"
|
||||||
|
|
||||||
|
"github.com/sagernet/sing-box/log"
|
||||||
|
"github.com/sagernet/sing-box/option"
|
||||||
|
)
|
||||||
|
|
||||||
|
type CertificateProvider interface {
|
||||||
|
GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type ACMECertificateProvider interface {
|
||||||
|
CertificateProvider
|
||||||
|
GetACMENextProtos() []string
|
||||||
|
}
|
||||||
|
|
||||||
|
type CertificateProviderService interface {
|
||||||
|
Lifecycle
|
||||||
|
Type() string
|
||||||
|
Tag() string
|
||||||
|
CertificateProvider
|
||||||
|
}
|
||||||
|
|
||||||
|
type CertificateProviderRegistry interface {
|
||||||
|
option.CertificateProviderOptionsRegistry
|
||||||
|
Create(ctx context.Context, logger log.ContextLogger, tag string, providerType string, options any) (CertificateProviderService, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type CertificateProviderManager interface {
|
||||||
|
Lifecycle
|
||||||
|
CertificateProviders() []CertificateProviderService
|
||||||
|
Get(tag string) (CertificateProviderService, bool)
|
||||||
|
Remove(tag string) error
|
||||||
|
Create(ctx context.Context, logger log.ContextLogger, tag string, providerType string, options any) error
|
||||||
|
}
|
||||||
@@ -9,6 +9,10 @@ import (
|
|||||||
|
|
||||||
type ConnectionManager interface {
|
type ConnectionManager interface {
|
||||||
Lifecycle
|
Lifecycle
|
||||||
|
Count() int
|
||||||
|
CloseAll()
|
||||||
|
TrackConn(conn net.Conn) net.Conn
|
||||||
|
TrackPacketConn(conn net.PacketConn) net.PacketConn
|
||||||
NewConnection(ctx context.Context, this N.Dialer, conn net.Conn, metadata InboundContext, onClose N.CloseHandlerFunc)
|
NewConnection(ctx context.Context, this N.Dialer, conn net.Conn, metadata InboundContext, onClose N.CloseHandlerFunc)
|
||||||
NewPacketConnection(ctx context.Context, this N.Dialer, conn N.PacketConn, metadata InboundContext, onClose N.CloseHandlerFunc)
|
NewPacketConnection(ctx context.Context, this N.Dialer, conn N.PacketConn, metadata InboundContext, onClose N.CloseHandlerFunc)
|
||||||
}
|
}
|
||||||
|
|||||||
+45
-23
@@ -3,6 +3,7 @@ package adapter
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
|
"time"
|
||||||
|
|
||||||
C "github.com/sagernet/sing-box/constant"
|
C "github.com/sagernet/sing-box/constant"
|
||||||
"github.com/sagernet/sing-box/log"
|
"github.com/sagernet/sing-box/log"
|
||||||
@@ -17,6 +18,7 @@ import (
|
|||||||
type DNSRouter interface {
|
type DNSRouter interface {
|
||||||
Lifecycle
|
Lifecycle
|
||||||
Exchange(ctx context.Context, message *dns.Msg, options DNSQueryOptions) (*dns.Msg, error)
|
Exchange(ctx context.Context, message *dns.Msg, options DNSQueryOptions) (*dns.Msg, error)
|
||||||
|
ExchangeAsync(ctx context.Context, message *dns.Msg, options DNSQueryOptions, callback func(response *dns.Msg, err error))
|
||||||
Lookup(ctx context.Context, domain string, options DNSQueryOptions) ([]netip.Addr, error)
|
Lookup(ctx context.Context, domain string, options DNSQueryOptions) ([]netip.Addr, error)
|
||||||
ClearCache()
|
ClearCache()
|
||||||
LookupReverseMapping(ip netip.Addr) (string, bool)
|
LookupReverseMapping(ip netip.Addr) (string, bool)
|
||||||
@@ -25,37 +27,41 @@ type DNSRouter interface {
|
|||||||
|
|
||||||
type DNSClient interface {
|
type DNSClient interface {
|
||||||
Start()
|
Start()
|
||||||
Exchange(ctx context.Context, transport DNSTransport, message *dns.Msg, options DNSQueryOptions, responseChecker func(responseAddrs []netip.Addr) bool) (*dns.Msg, error)
|
Exchange(ctx context.Context, transport DNSTransport, message *dns.Msg, options DNSQueryOptions, responseChecker func(response *dns.Msg) bool) (*dns.Msg, error)
|
||||||
Lookup(ctx context.Context, transport DNSTransport, domain string, options DNSQueryOptions, responseChecker func(responseAddrs []netip.Addr) bool) ([]netip.Addr, error)
|
ExchangeAsync(ctx context.Context, transport DNSTransport, message *dns.Msg, options DNSQueryOptions, responseChecker func(response *dns.Msg) bool, callback func(response *dns.Msg, err error))
|
||||||
LookupCache(domain string, strategy C.DomainStrategy) ([]netip.Addr, bool)
|
Lookup(ctx context.Context, transport DNSTransport, domain string, options DNSQueryOptions, responseChecker func(response *dns.Msg) bool) ([]netip.Addr, error)
|
||||||
ExchangeCache(ctx context.Context, message *dns.Msg) (*dns.Msg, bool)
|
|
||||||
ClearCache()
|
ClearCache()
|
||||||
}
|
}
|
||||||
|
|
||||||
type DNSQueryOptions struct {
|
type DNSQueryOptions struct {
|
||||||
Transport DNSTransport
|
Transport DNSTransport
|
||||||
Strategy C.DomainStrategy
|
Strategy C.DomainStrategy
|
||||||
LookupStrategy C.DomainStrategy
|
LookupStrategy C.DomainStrategy
|
||||||
DisableCache bool
|
DisableCache bool
|
||||||
RewriteTTL *uint32
|
DisableOptimisticCache bool
|
||||||
ClientSubnet netip.Prefix
|
RewriteTTL *uint32
|
||||||
|
Timeout time.Duration
|
||||||
|
ClientSubnet netip.Prefix
|
||||||
|
RemoveClientSubnet bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func DNSQueryOptionsFrom(ctx context.Context, options *option.DomainResolveOptions) (*DNSQueryOptions, error) {
|
func DNSQueryOptionsFrom(ctx context.Context, options *option.DomainResolveOptions) (DNSQueryOptions, error) {
|
||||||
if options == nil {
|
if options == nil || options.Server == "" {
|
||||||
return &DNSQueryOptions{}, nil
|
return DNSQueryOptions{}, nil
|
||||||
}
|
}
|
||||||
transportManager := service.FromContext[DNSTransportManager](ctx)
|
transportManager := service.FromContext[DNSTransportManager](ctx)
|
||||||
transport, loaded := transportManager.Transport(options.Server)
|
transport, loaded := transportManager.Transport(options.Server)
|
||||||
if !loaded {
|
if !loaded {
|
||||||
return nil, E.New("domain resolver not found: " + options.Server)
|
return DNSQueryOptions{}, E.New("domain resolver not found: " + options.Server)
|
||||||
}
|
}
|
||||||
return &DNSQueryOptions{
|
return DNSQueryOptions{
|
||||||
Transport: transport,
|
Transport: transport,
|
||||||
Strategy: C.DomainStrategy(options.Strategy),
|
Strategy: C.DomainStrategy(options.Strategy),
|
||||||
DisableCache: options.DisableCache,
|
DisableCache: options.DisableCache,
|
||||||
RewriteTTL: options.RewriteTTL,
|
DisableOptimisticCache: options.DisableOptimisticCache,
|
||||||
ClientSubnet: options.ClientSubnet.Build(netip.Prefix{}),
|
RewriteTTL: options.RewriteTTL,
|
||||||
|
Timeout: time.Duration(options.Timeout),
|
||||||
|
ClientSubnet: options.ClientSubnet.Build(netip.Prefix{}),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,17 +71,33 @@ type RDRCStore interface {
|
|||||||
SaveRDRCAsync(transportName string, qName string, qType uint16, logger logger.Logger)
|
SaveRDRCAsync(transportName string, qName string, qType uint16, logger logger.Logger)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type DNSCacheStore interface {
|
||||||
|
LoadDNSCache(transportName string, qName string, qType uint16) (rawMessage []byte, expireAt time.Time, loaded bool)
|
||||||
|
SaveDNSCache(transportName string, qName string, qType uint16, rawMessage []byte, expireAt time.Time) error
|
||||||
|
SaveDNSCacheAsync(transportName string, qName string, qType uint16, rawMessage []byte, expireAt time.Time, logger logger.Logger)
|
||||||
|
ClearDNSCache() error
|
||||||
|
}
|
||||||
|
|
||||||
type DNSTransport interface {
|
type DNSTransport interface {
|
||||||
Lifecycle
|
Lifecycle
|
||||||
Type() string
|
Type() string
|
||||||
Tag() string
|
Tag() string
|
||||||
Dependencies() []string
|
Dependencies() []string
|
||||||
|
// Reset closes the transport's existing connections so later requests use fresh connections.
|
||||||
|
// Exchanges that are currently using those connections may fail.
|
||||||
|
Reset()
|
||||||
Exchange(ctx context.Context, message *dns.Msg) (*dns.Msg, error)
|
Exchange(ctx context.Context, message *dns.Msg) (*dns.Msg, error)
|
||||||
|
ExchangeAsync(ctx context.Context, message *dns.Msg, callback func(response *dns.Msg, err error))
|
||||||
}
|
}
|
||||||
|
|
||||||
type LegacyDNSTransport interface {
|
type DNSTransportWithPreferredDomain interface {
|
||||||
LegacyStrategy() C.DomainStrategy
|
DNSTransport
|
||||||
LegacyClientSubnet() netip.Prefix
|
PreferredDomain(domain string) bool
|
||||||
|
}
|
||||||
|
|
||||||
|
type DNSTransportWithEnvironment interface {
|
||||||
|
DNSTransport
|
||||||
|
Environment() []string
|
||||||
}
|
}
|
||||||
|
|
||||||
type DNSTransportRegistry interface {
|
type DNSTransportRegistry interface {
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ func NewManager(logger log.ContextLogger, registry adapter.EndpointRegistry) *Ma
|
|||||||
|
|
||||||
func (m *Manager) Start(stage adapter.StartStage) error {
|
func (m *Manager) Start(stage adapter.StartStage) error {
|
||||||
m.access.Lock()
|
m.access.Lock()
|
||||||
defer m.access.Unlock()
|
|
||||||
if m.started && m.stage >= stage {
|
if m.started && m.stage >= stage {
|
||||||
panic("already started")
|
panic("already started")
|
||||||
}
|
}
|
||||||
@@ -43,12 +42,18 @@ func (m *Manager) Start(stage adapter.StartStage) error {
|
|||||||
m.stage = stage
|
m.stage = stage
|
||||||
if stage == adapter.StartStateStart {
|
if stage == adapter.StartStateStart {
|
||||||
// started with outbound manager
|
// started with outbound manager
|
||||||
|
m.access.Unlock()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
for _, endpoint := range m.endpoints {
|
endpoints := m.endpoints
|
||||||
|
m.access.Unlock()
|
||||||
|
for _, endpoint := range endpoints {
|
||||||
|
name := "endpoint/" + endpoint.Type() + "[" + endpoint.Tag() + "]"
|
||||||
|
done := adapter.LogElapsed(m.logger, stage, " ", name)
|
||||||
err := adapter.LegacyStart(endpoint, stage)
|
err := adapter.LegacyStart(endpoint, stage)
|
||||||
|
done()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return E.Cause(err, stage, " endpoint/", endpoint.Type(), "[", endpoint.Tag(), "]")
|
return E.Cause(err, stage, " ", name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@@ -66,11 +71,14 @@ func (m *Manager) Close() error {
|
|||||||
monitor := taskmonitor.New(m.logger, C.StopTimeout)
|
monitor := taskmonitor.New(m.logger, C.StopTimeout)
|
||||||
var err error
|
var err error
|
||||||
for _, endpoint := range endpoints {
|
for _, endpoint := range endpoints {
|
||||||
monitor.Start("close endpoint/", endpoint.Type(), "[", endpoint.Tag(), "]")
|
name := "endpoint/" + endpoint.Type() + "[" + endpoint.Tag() + "]"
|
||||||
|
done := adapter.LogElapsed(m.logger, "close ", name)
|
||||||
|
monitor.Start("close ", name)
|
||||||
err = E.Append(err, endpoint.Close(), func(err error) error {
|
err = E.Append(err, endpoint.Close(), func(err error) error {
|
||||||
return E.Cause(err, "close endpoint/", endpoint.Type(), "[", endpoint.Tag(), "]")
|
return E.Cause(err, "close ", name)
|
||||||
})
|
})
|
||||||
monitor.Finish()
|
monitor.Finish()
|
||||||
|
done()
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -119,10 +127,13 @@ func (m *Manager) Create(ctx context.Context, router adapter.Router, logger log.
|
|||||||
m.access.Lock()
|
m.access.Lock()
|
||||||
defer m.access.Unlock()
|
defer m.access.Unlock()
|
||||||
if m.started {
|
if m.started {
|
||||||
|
name := "endpoint/" + endpoint.Type() + "[" + endpoint.Tag() + "]"
|
||||||
for _, stage := range adapter.ListStartStages {
|
for _, stage := range adapter.ListStartStages {
|
||||||
|
done := adapter.LogElapsed(m.logger, stage, " ", name)
|
||||||
err = adapter.LegacyStart(endpoint, stage)
|
err = adapter.LegacyStart(endpoint, stage)
|
||||||
|
done()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return E.Cause(err, stage, " endpoint/", endpoint.Type(), "[", endpoint.Tag(), "]")
|
return E.Cause(err, stage, " ", name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package endpoint
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"maps"
|
||||||
|
"slices"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/sagernet/sing-box/adapter"
|
"github.com/sagernet/sing-box/adapter"
|
||||||
@@ -44,6 +46,12 @@ func NewRegistry() *Registry {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Registry) OptionTypes() []string {
|
||||||
|
m.access.Lock()
|
||||||
|
defer m.access.Unlock()
|
||||||
|
return slices.Sorted(maps.Keys(m.optionsType))
|
||||||
|
}
|
||||||
|
|
||||||
func (m *Registry) CreateOptions(outboundType string) (any, bool) {
|
func (m *Registry) CreateOptions(outboundType string) (any, bool) {
|
||||||
m.access.Lock()
|
m.access.Lock()
|
||||||
defer m.access.Unlock()
|
defer m.access.Unlock()
|
||||||
|
|||||||
+78
-22
@@ -4,17 +4,20 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
"io"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
|
"github.com/sagernet/sing/common/observable"
|
||||||
"github.com/sagernet/sing/common/varbin"
|
"github.com/sagernet/sing/common/varbin"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ClashServer interface {
|
type ClashServer interface {
|
||||||
LifecycleService
|
LifecycleService
|
||||||
ConnectionTracker
|
|
||||||
Mode() string
|
Mode() string
|
||||||
ModeList() []string
|
ModeList() []string
|
||||||
HistoryStorage() URLTestHistoryStorage
|
SetMode(mode string)
|
||||||
|
AddModeUpdateHook(hook *observable.Subscriber[struct{}])
|
||||||
}
|
}
|
||||||
|
|
||||||
type URLTestHistory struct {
|
type URLTestHistory struct {
|
||||||
@@ -22,14 +25,6 @@ type URLTestHistory struct {
|
|||||||
Delay uint16 `json:"delay"`
|
Delay uint16 `json:"delay"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type URLTestHistoryStorage interface {
|
|
||||||
SetHook(hook chan<- struct{})
|
|
||||||
LoadURLTestHistory(tag string) *URLTestHistory
|
|
||||||
DeleteURLTestHistory(tag string)
|
|
||||||
StoreURLTestHistory(tag string, history *URLTestHistory)
|
|
||||||
Close() error
|
|
||||||
}
|
|
||||||
|
|
||||||
type V2RayServer interface {
|
type V2RayServer interface {
|
||||||
LifecycleService
|
LifecycleService
|
||||||
StatsService() ConnectionTracker
|
StatsService() ConnectionTracker
|
||||||
@@ -38,12 +33,24 @@ type V2RayServer interface {
|
|||||||
type CacheFile interface {
|
type CacheFile interface {
|
||||||
LifecycleService
|
LifecycleService
|
||||||
|
|
||||||
|
CacheID() string
|
||||||
|
|
||||||
StoreFakeIP() bool
|
StoreFakeIP() bool
|
||||||
FakeIPStorage
|
FakeIPStorage
|
||||||
|
|
||||||
StoreRDRC() bool
|
StoreRDRC() bool
|
||||||
RDRCStore
|
RDRCStore
|
||||||
|
|
||||||
|
StoreWARPConfig() bool
|
||||||
|
StoreMASQUEConfig() bool
|
||||||
|
StoreProviders() bool
|
||||||
|
|
||||||
|
StoreDNS() bool
|
||||||
|
DNSCacheStore
|
||||||
|
|
||||||
|
SetDisableExpire(disableExpire bool)
|
||||||
|
SetOptimisticTimeout(timeout time.Duration)
|
||||||
|
|
||||||
LoadMode() string
|
LoadMode() string
|
||||||
StoreMode(mode string) error
|
StoreMode(mode string) error
|
||||||
LoadSelected(group string) string
|
LoadSelected(group string) string
|
||||||
@@ -52,21 +59,32 @@ type CacheFile interface {
|
|||||||
StoreGroupExpand(group string, expand bool) error
|
StoreGroupExpand(group string, expand bool) error
|
||||||
LoadRuleSet(tag string) *SavedBinary
|
LoadRuleSet(tag string) *SavedBinary
|
||||||
SaveRuleSet(tag string, set *SavedBinary) error
|
SaveRuleSet(tag string, set *SavedBinary) error
|
||||||
|
LoadWARPConfig(tag string) *SavedBinary
|
||||||
|
SaveWARPConfig(tag string, set *SavedBinary) error
|
||||||
|
LoadMASQUEConfig(tag string) *SavedBinary
|
||||||
|
SaveMASQUEConfig(tag string, set *SavedBinary) error
|
||||||
|
LoadSubscription(tag string) *SavedBinary
|
||||||
|
SaveSubscription(tag string, sub *SavedBinary) error
|
||||||
}
|
}
|
||||||
|
|
||||||
type SavedBinary struct {
|
type SavedBinary struct {
|
||||||
Content []byte
|
Content []byte
|
||||||
LastUpdated time.Time
|
LastUpdated time.Time
|
||||||
LastEtag string
|
LastEtag string
|
||||||
|
URLHash []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SavedBinary) MarshalBinary() ([]byte, error) {
|
func (s *SavedBinary) MarshalBinary() ([]byte, error) {
|
||||||
var buffer bytes.Buffer
|
var buffer bytes.Buffer
|
||||||
err := binary.Write(&buffer, binary.BigEndian, uint8(1))
|
err := binary.Write(&buffer, binary.BigEndian, uint8(2))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
err = varbin.Write(&buffer, binary.BigEndian, s.Content)
|
_, err = varbin.WriteUvarint(&buffer, uint64(len(s.Content)))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
_, err = buffer.Write(s.Content)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -74,7 +92,19 @@ func (s *SavedBinary) MarshalBinary() ([]byte, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
err = varbin.Write(&buffer, binary.BigEndian, s.LastEtag)
|
_, err = varbin.WriteUvarint(&buffer, uint64(len(s.LastEtag)))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
_, err = buffer.WriteString(s.LastEtag)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
_, err = varbin.WriteUvarint(&buffer, uint64(len(s.URLHash)))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
_, err = buffer.Write(s.URLHash)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -88,7 +118,15 @@ func (s *SavedBinary) UnmarshalBinary(data []byte) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = varbin.Read(reader, binary.BigEndian, &s.Content)
|
contentLength, err := binary.ReadUvarint(reader)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if contentLength > uint64(reader.Len()) {
|
||||||
|
return E.New("invalid content length: ", contentLength)
|
||||||
|
}
|
||||||
|
s.Content = make([]byte, contentLength)
|
||||||
|
_, err = io.ReadFull(reader, s.Content)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -98,7 +136,31 @@ func (s *SavedBinary) UnmarshalBinary(data []byte) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
s.LastUpdated = time.Unix(lastUpdated, 0)
|
s.LastUpdated = time.Unix(lastUpdated, 0)
|
||||||
err = varbin.Read(reader, binary.BigEndian, &s.LastEtag)
|
etagLength, err := binary.ReadUvarint(reader)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if etagLength > uint64(reader.Len()) {
|
||||||
|
return E.New("invalid etag length: ", etagLength)
|
||||||
|
}
|
||||||
|
etagBytes := make([]byte, etagLength)
|
||||||
|
_, err = io.ReadFull(reader, etagBytes)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
s.LastEtag = string(etagBytes)
|
||||||
|
if version < 2 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
urlHashLength, err := binary.ReadUvarint(reader)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if urlHashLength > uint64(reader.Len()) {
|
||||||
|
return E.New("invalid url hash length: ", urlHashLength)
|
||||||
|
}
|
||||||
|
s.URLHash = make([]byte, urlHashLength)
|
||||||
|
_, err = io.ReadFull(reader, s.URLHash)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -114,11 +176,5 @@ type OutboundGroup interface {
|
|||||||
type URLTestGroup interface {
|
type URLTestGroup interface {
|
||||||
OutboundGroup
|
OutboundGroup
|
||||||
URLTest(ctx context.Context) (map[string]uint16, error)
|
URLTest(ctx context.Context) (map[string]uint16, error)
|
||||||
}
|
PerformUpdateCheck()
|
||||||
|
|
||||||
func OutboundTag(detour Outbound) string {
|
|
||||||
if group, isGroup := detour.(OutboundGroup); isGroup {
|
|
||||||
return group.Now()
|
|
||||||
}
|
|
||||||
return detour.Tag()
|
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-32
@@ -5,57 +5,31 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
|
|
||||||
"github.com/sagernet/sing/common/buf"
|
"github.com/sagernet/sing/common/buf"
|
||||||
E "github.com/sagernet/sing/common/exceptions"
|
|
||||||
M "github.com/sagernet/sing/common/metadata"
|
M "github.com/sagernet/sing/common/metadata"
|
||||||
N "github.com/sagernet/sing/common/network"
|
N "github.com/sagernet/sing/common/network"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Deprecated
|
|
||||||
type ConnectionHandler interface {
|
type ConnectionHandler interface {
|
||||||
NewConnection(ctx context.Context, conn net.Conn, metadata InboundContext) error
|
NewConnection(ctx context.Context, conn net.Conn, metadata InboundContext, onClose N.CloseHandlerFunc)
|
||||||
}
|
}
|
||||||
|
|
||||||
type ConnectionHandlerEx interface {
|
|
||||||
NewConnectionEx(ctx context.Context, conn net.Conn, metadata InboundContext, onClose N.CloseHandlerFunc)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated: use PacketHandlerEx instead
|
|
||||||
type PacketHandler interface {
|
type PacketHandler interface {
|
||||||
NewPacket(ctx context.Context, conn N.PacketConn, buffer *buf.Buffer, metadata InboundContext) error
|
NewPacket(buffer *buf.Buffer, source M.Socksaddr)
|
||||||
}
|
}
|
||||||
|
|
||||||
type PacketHandlerEx interface {
|
type PacketBatchHandler interface {
|
||||||
NewPacketEx(buffer *buf.Buffer, source M.Socksaddr)
|
NewPacketBatch(buffers []*buf.Buffer, sources []M.Socksaddr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: use OOBPacketHandlerEx instead
|
|
||||||
type OOBPacketHandler interface {
|
type OOBPacketHandler interface {
|
||||||
NewPacket(ctx context.Context, conn N.PacketConn, buffer *buf.Buffer, oob []byte, metadata InboundContext) error
|
NewPacket(buffer *buf.Buffer, oob []byte, source M.Socksaddr)
|
||||||
}
|
}
|
||||||
|
|
||||||
type OOBPacketHandlerEx interface {
|
|
||||||
NewPacketEx(buffer *buf.Buffer, oob []byte, source M.Socksaddr)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated
|
|
||||||
type PacketConnectionHandler interface {
|
type PacketConnectionHandler interface {
|
||||||
NewPacketConnection(ctx context.Context, conn N.PacketConn, metadata InboundContext) error
|
NewPacketConnection(ctx context.Context, conn N.PacketConn, metadata InboundContext, onClose N.CloseHandlerFunc)
|
||||||
}
|
}
|
||||||
|
|
||||||
type PacketConnectionHandlerEx interface {
|
|
||||||
NewPacketConnectionEx(ctx context.Context, conn N.PacketConn, metadata InboundContext, onClose N.CloseHandlerFunc)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated: use TCPConnectionHandlerEx instead
|
|
||||||
//
|
|
||||||
//nolint:staticcheck
|
|
||||||
type UpstreamHandlerAdapter interface {
|
type UpstreamHandlerAdapter interface {
|
||||||
N.TCPConnectionHandler
|
|
||||||
N.UDPConnectionHandler
|
|
||||||
E.Handler
|
|
||||||
}
|
|
||||||
|
|
||||||
type UpstreamHandlerAdapterEx interface {
|
|
||||||
N.TCPConnectionHandlerEx
|
N.TCPConnectionHandlerEx
|
||||||
N.UDPConnectionHandlerEx
|
N.UDPConnectionHandlerEx
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package adapter
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"github.com/sagernet/sing-box/option"
|
||||||
|
"github.com/sagernet/sing/common/logger"
|
||||||
|
)
|
||||||
|
|
||||||
|
type HTTPTransport interface {
|
||||||
|
http.RoundTripper
|
||||||
|
CloseIdleConnections()
|
||||||
|
Reset()
|
||||||
|
}
|
||||||
|
|
||||||
|
type HTTPClientManager interface {
|
||||||
|
ResolveTransport(ctx context.Context, logger logger.ContextLogger, options option.HTTPClientOptions) (HTTPTransport, error)
|
||||||
|
DefaultTransport() HTTPTransport
|
||||||
|
ResetNetwork()
|
||||||
|
}
|
||||||
|
|
||||||
|
type HTTPStartContext struct {
|
||||||
|
access sync.Mutex
|
||||||
|
transports []HTTPTransport
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewHTTPStartContext() *HTTPStartContext {
|
||||||
|
return &HTTPStartContext{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *HTTPStartContext) Register(transport HTTPTransport) {
|
||||||
|
c.access.Lock()
|
||||||
|
defer c.access.Unlock()
|
||||||
|
c.transports = append(c.transports, transport)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *HTTPStartContext) Close() {
|
||||||
|
for _, transport := range c.transports {
|
||||||
|
transport.CloseIdleConnections()
|
||||||
|
}
|
||||||
|
}
|
||||||
+102
-25
@@ -2,14 +2,17 @@ package adapter
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"net"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/sagernet/sing-box/common/process"
|
"github.com/sagernet/sing-box/common/tlsspoof"
|
||||||
C "github.com/sagernet/sing-box/constant"
|
C "github.com/sagernet/sing-box/constant"
|
||||||
"github.com/sagernet/sing-box/log"
|
"github.com/sagernet/sing-box/log"
|
||||||
"github.com/sagernet/sing-box/option"
|
"github.com/sagernet/sing-box/option"
|
||||||
M "github.com/sagernet/sing/common/metadata"
|
M "github.com/sagernet/sing/common/metadata"
|
||||||
|
|
||||||
|
"github.com/miekg/dns"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Inbound interface {
|
type Inbound interface {
|
||||||
@@ -20,17 +23,18 @@ type Inbound interface {
|
|||||||
|
|
||||||
type TCPInjectableInbound interface {
|
type TCPInjectableInbound interface {
|
||||||
Inbound
|
Inbound
|
||||||
ConnectionHandlerEx
|
ConnectionHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
type UDPInjectableInbound interface {
|
type UDPInjectableInbound interface {
|
||||||
Inbound
|
Inbound
|
||||||
PacketConnectionHandlerEx
|
PacketConnectionHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
type InboundRegistry interface {
|
type InboundRegistry interface {
|
||||||
option.InboundOptionsRegistry
|
option.InboundOptionsRegistry
|
||||||
Create(ctx context.Context, router Router, logger log.ContextLogger, tag string, inboundType string, options any) (Inbound, error)
|
Create(ctx context.Context, router Router, logger log.ContextLogger, tag string, inboundType string, options any) (Inbound, error)
|
||||||
|
UnsafeCreate(ctx context.Context, router Router, logger log.ContextLogger, tag string, inboundType string, options any) (Inbound, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type InboundManager interface {
|
type InboundManager interface {
|
||||||
@@ -48,45 +52,59 @@ type InboundContext struct {
|
|||||||
Network string
|
Network string
|
||||||
Source M.Socksaddr
|
Source M.Socksaddr
|
||||||
Destination M.Socksaddr
|
Destination M.Socksaddr
|
||||||
|
Gateway *netip.Addr
|
||||||
User string
|
User string
|
||||||
Outbound string
|
Outbound string
|
||||||
|
|
||||||
|
// power report
|
||||||
|
|
||||||
|
RouteRule string
|
||||||
|
RouteOutbound string
|
||||||
|
|
||||||
// sniffer
|
// sniffer
|
||||||
|
|
||||||
Protocol string
|
Protocol string
|
||||||
Domain string
|
Domain string
|
||||||
Client string
|
Client string
|
||||||
SniffContext any
|
SniffContext any
|
||||||
PacketSniffError error
|
SnifferNames []string
|
||||||
|
SniffError error
|
||||||
|
|
||||||
// cache
|
// cache
|
||||||
|
|
||||||
// Deprecated: implement in rule action
|
// Deprecated: implement in rule action
|
||||||
InboundDetour string
|
InboundDetour string
|
||||||
LastInbound string
|
LastInbound string
|
||||||
OriginDestination M.Socksaddr
|
OriginDestination M.Socksaddr
|
||||||
RouteOriginalDestination M.Socksaddr
|
RouteOriginalDestination M.Socksaddr
|
||||||
// Deprecated: to be removed
|
|
||||||
//nolint:staticcheck
|
|
||||||
InboundOptions option.InboundOptions
|
|
||||||
UDPDisableDomainUnmapping bool
|
UDPDisableDomainUnmapping bool
|
||||||
UDPConnect bool
|
UDPConnect bool
|
||||||
UDPTimeout time.Duration
|
UDPTimeout time.Duration
|
||||||
TLSFragment bool
|
TLSFragment bool
|
||||||
TLSFragmentFallbackDelay time.Duration
|
TLSFragmentFallbackDelay time.Duration
|
||||||
TLSRecordFragment bool
|
TLSRecordFragment bool
|
||||||
|
TLSSpoof string
|
||||||
|
TLSSpoofMethod tlsspoof.Method
|
||||||
|
|
||||||
NetworkStrategy *C.NetworkStrategy
|
NetworkStrategy *C.NetworkStrategy
|
||||||
NetworkType []C.InterfaceType
|
NetworkType []C.InterfaceType
|
||||||
FallbackNetworkType []C.InterfaceType
|
FallbackNetworkType []C.InterfaceType
|
||||||
FallbackDelay time.Duration
|
FallbackDelay time.Duration
|
||||||
|
|
||||||
DestinationAddresses []netip.Addr
|
DestinationAddresses []netip.Addr
|
||||||
SourceGeoIPCode string
|
DNSResponse *dns.Msg
|
||||||
GeoIPCode string
|
NamedDNSResponses map[string]*dns.Msg
|
||||||
ProcessInfo *process.Info
|
DestinationAddressMatchFromResponse bool
|
||||||
QueryType uint16
|
SourceGeoIPCode string
|
||||||
FakeIP bool
|
GeoIPCode string
|
||||||
|
ProcessInfo *ConnectionOwner
|
||||||
|
SourceMACAddress net.HardwareAddr
|
||||||
|
SourceHostname string
|
||||||
|
QueryType uint16
|
||||||
|
QueryClientSubnet netip.Prefix
|
||||||
|
QueryDNSSEC bool
|
||||||
|
FakeIP bool
|
||||||
|
PreMatch bool
|
||||||
|
|
||||||
// rule cache
|
// rule cache
|
||||||
|
|
||||||
@@ -97,22 +115,82 @@ type InboundContext struct {
|
|||||||
SourcePortMatch bool
|
SourcePortMatch bool
|
||||||
DestinationAddressMatch bool
|
DestinationAddressMatch bool
|
||||||
DestinationPortMatch bool
|
DestinationPortMatch bool
|
||||||
DidMatch bool
|
DeferredIPCIDRMatchGroups uint8
|
||||||
IgnoreDestinationIPCIDRMatch bool
|
IgnoreDestinationIPCIDRMatch bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *InboundContext) ResetRuleCache() {
|
func (c *InboundContext) ResetRuleCache() {
|
||||||
c.IPCIDRMatchSource = false
|
c.IPCIDRMatchSource = false
|
||||||
c.IPCIDRAcceptEmpty = false
|
c.IPCIDRAcceptEmpty = false
|
||||||
|
c.ResetRuleMatchCache()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *InboundContext) ResetRuleMatchCache() {
|
||||||
c.SourceAddressMatch = false
|
c.SourceAddressMatch = false
|
||||||
c.SourcePortMatch = false
|
c.SourcePortMatch = false
|
||||||
c.DestinationAddressMatch = false
|
c.DestinationAddressMatch = false
|
||||||
c.DestinationPortMatch = false
|
c.DestinationPortMatch = false
|
||||||
c.DidMatch = false
|
c.DeferredIPCIDRMatchGroups = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *InboundContext) DNSResponseAddressesForMatch() []netip.Addr {
|
||||||
|
return DNSResponseAddresses(c.DNSResponse)
|
||||||
|
}
|
||||||
|
|
||||||
|
func DNSResponseAddresses(response *dns.Msg) []netip.Addr {
|
||||||
|
if response == nil || response.Rcode != dns.RcodeSuccess {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
addresses := make([]netip.Addr, 0, len(response.Answer))
|
||||||
|
for _, rawRecord := range response.Answer {
|
||||||
|
switch record := rawRecord.(type) {
|
||||||
|
case *dns.A:
|
||||||
|
addr := M.AddrFromIP(record.A)
|
||||||
|
if addr.IsValid() {
|
||||||
|
addresses = append(addresses, addr)
|
||||||
|
}
|
||||||
|
case *dns.AAAA:
|
||||||
|
addr := M.AddrFromIP(record.AAAA)
|
||||||
|
if addr.IsValid() {
|
||||||
|
addresses = append(addresses, addr)
|
||||||
|
}
|
||||||
|
case *dns.HTTPS:
|
||||||
|
for _, value := range record.SVCB.Value {
|
||||||
|
switch hint := value.(type) {
|
||||||
|
case *dns.SVCBIPv4Hint:
|
||||||
|
for _, ip := range hint.Hint {
|
||||||
|
addr := M.AddrFromIP(ip).Unmap()
|
||||||
|
if addr.IsValid() {
|
||||||
|
addresses = append(addresses, addr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case *dns.SVCBIPv6Hint:
|
||||||
|
for _, ip := range hint.Hint {
|
||||||
|
addr := M.AddrFromIP(ip)
|
||||||
|
if addr.IsValid() {
|
||||||
|
addresses = append(addresses, addr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return addresses
|
||||||
}
|
}
|
||||||
|
|
||||||
type inboundContextKey struct{}
|
type inboundContextKey struct{}
|
||||||
|
|
||||||
|
type dnsTransportTagKey struct{}
|
||||||
|
|
||||||
|
func ContextWithDNSTransportTag(ctx context.Context, transportTag string) context.Context {
|
||||||
|
return context.WithValue(ctx, (*dnsTransportTagKey)(nil), transportTag)
|
||||||
|
}
|
||||||
|
|
||||||
|
func DNSTransportTagFromContext(ctx context.Context) (string, bool) {
|
||||||
|
transportTag, loaded := ctx.Value((*dnsTransportTagKey)(nil)).(string)
|
||||||
|
return transportTag, loaded
|
||||||
|
}
|
||||||
|
|
||||||
func WithContext(ctx context.Context, inboundContext *InboundContext) context.Context {
|
func WithContext(ctx context.Context, inboundContext *InboundContext) context.Context {
|
||||||
return context.WithValue(ctx, (*inboundContextKey)(nil), inboundContext)
|
return context.WithValue(ctx, (*inboundContextKey)(nil), inboundContext)
|
||||||
}
|
}
|
||||||
@@ -135,8 +213,7 @@ func ExtendContext(ctx context.Context) (context.Context, *InboundContext) {
|
|||||||
|
|
||||||
func OverrideContext(ctx context.Context) context.Context {
|
func OverrideContext(ctx context.Context) context.Context {
|
||||||
if metadata := ContextFrom(ctx); metadata != nil {
|
if metadata := ContextFrom(ctx); metadata != nil {
|
||||||
var newMetadata InboundContext
|
newMetadata := *metadata
|
||||||
newMetadata = *metadata
|
|
||||||
return WithContext(ctx, &newMetadata)
|
return WithContext(ctx, &newMetadata)
|
||||||
}
|
}
|
||||||
return ctx
|
return ctx
|
||||||
|
|||||||
@@ -45,9 +45,12 @@ func (m *Manager) Start(stage adapter.StartStage) error {
|
|||||||
inbounds := m.inbounds
|
inbounds := m.inbounds
|
||||||
m.access.Unlock()
|
m.access.Unlock()
|
||||||
for _, inbound := range inbounds {
|
for _, inbound := range inbounds {
|
||||||
|
name := "inbound/" + inbound.Type() + "[" + inbound.Tag() + "]"
|
||||||
|
done := adapter.LogElapsed(m.logger, stage, " ", name)
|
||||||
err := adapter.LegacyStart(inbound, stage)
|
err := adapter.LegacyStart(inbound, stage)
|
||||||
|
done()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return E.Cause(err, stage, " inbound/", inbound.Type(), "[", inbound.Tag(), "]")
|
return E.Cause(err, stage, " ", name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@@ -65,11 +68,14 @@ func (m *Manager) Close() error {
|
|||||||
monitor := taskmonitor.New(m.logger, C.StopTimeout)
|
monitor := taskmonitor.New(m.logger, C.StopTimeout)
|
||||||
var err error
|
var err error
|
||||||
for _, inbound := range inbounds {
|
for _, inbound := range inbounds {
|
||||||
monitor.Start("close inbound/", inbound.Type(), "[", inbound.Tag(), "]")
|
name := "inbound/" + inbound.Type() + "[" + inbound.Tag() + "]"
|
||||||
|
done := adapter.LogElapsed(m.logger, "close ", name)
|
||||||
|
monitor.Start("close ", name)
|
||||||
err = E.Append(err, inbound.Close(), func(err error) error {
|
err = E.Append(err, inbound.Close(), func(err error) error {
|
||||||
return E.Cause(err, "close inbound/", inbound.Type(), "[", inbound.Tag(), "]")
|
return E.Cause(err, "close ", name)
|
||||||
})
|
})
|
||||||
monitor.Finish()
|
monitor.Finish()
|
||||||
|
done()
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -121,10 +127,13 @@ func (m *Manager) Create(ctx context.Context, router adapter.Router, logger log.
|
|||||||
m.access.Lock()
|
m.access.Lock()
|
||||||
defer m.access.Unlock()
|
defer m.access.Unlock()
|
||||||
if m.started {
|
if m.started {
|
||||||
|
name := "inbound/" + inbound.Type() + "[" + inbound.Tag() + "]"
|
||||||
for _, stage := range adapter.ListStartStages {
|
for _, stage := range adapter.ListStartStages {
|
||||||
|
done := adapter.LogElapsed(m.logger, stage, " ", name)
|
||||||
err = adapter.LegacyStart(inbound, stage)
|
err = adapter.LegacyStart(inbound, stage)
|
||||||
|
done()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return E.Cause(err, stage, " inbound/", inbound.Type(), "[", inbound.Tag(), "]")
|
return E.Cause(err, stage, " ", name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package inbound
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"maps"
|
||||||
|
"slices"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/sagernet/sing-box/adapter"
|
"github.com/sagernet/sing-box/adapter"
|
||||||
@@ -44,6 +46,12 @@ func NewRegistry() *Registry {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Registry) OptionTypes() []string {
|
||||||
|
m.access.Lock()
|
||||||
|
defer m.access.Unlock()
|
||||||
|
return slices.Sorted(maps.Keys(m.optionsType))
|
||||||
|
}
|
||||||
|
|
||||||
func (m *Registry) CreateOptions(outboundType string) (any, bool) {
|
func (m *Registry) CreateOptions(outboundType string) (any, bool) {
|
||||||
m.access.Lock()
|
m.access.Lock()
|
||||||
defer m.access.Unlock()
|
defer m.access.Unlock()
|
||||||
@@ -57,6 +65,10 @@ func (m *Registry) CreateOptions(outboundType string) (any, bool) {
|
|||||||
func (m *Registry) Create(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, outboundType string, options any) (adapter.Inbound, error) {
|
func (m *Registry) Create(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, outboundType string, options any) (adapter.Inbound, error) {
|
||||||
m.access.Lock()
|
m.access.Lock()
|
||||||
defer m.access.Unlock()
|
defer m.access.Unlock()
|
||||||
|
return m.UnsafeCreate(ctx, router, logger, tag, outboundType, options)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Registry) UnsafeCreate(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, outboundType string, options any) (adapter.Inbound, error) {
|
||||||
constructor, loaded := m.constructor[outboundType]
|
constructor, loaded := m.constructor[outboundType]
|
||||||
if !loaded {
|
if !loaded {
|
||||||
return nil, E.New("outbound type not found: " + outboundType)
|
return nil, E.New("outbound type not found: " + outboundType)
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package adapter
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net"
|
||||||
|
"net/netip"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/miekg/dns"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestDNSResponseAddressesUnmapsHTTPSIPv4Hints(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
ipv4Hint := net.ParseIP("1.1.1.1")
|
||||||
|
require.NotNil(t, ipv4Hint)
|
||||||
|
|
||||||
|
response := &dns.Msg{
|
||||||
|
MsgHdr: dns.MsgHdr{
|
||||||
|
Response: true,
|
||||||
|
Rcode: dns.RcodeSuccess,
|
||||||
|
},
|
||||||
|
Answer: []dns.RR{
|
||||||
|
&dns.HTTPS{
|
||||||
|
SVCB: dns.SVCB{
|
||||||
|
Hdr: dns.RR_Header{
|
||||||
|
Name: dns.Fqdn("example.com"),
|
||||||
|
Rrtype: dns.TypeHTTPS,
|
||||||
|
Class: dns.ClassINET,
|
||||||
|
Ttl: 60,
|
||||||
|
},
|
||||||
|
Priority: 1,
|
||||||
|
Target: ".",
|
||||||
|
Value: []dns.SVCBKeyValue{
|
||||||
|
&dns.SVCBIPv4Hint{Hint: []net.IP{ipv4Hint}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
addresses := DNSResponseAddresses(response)
|
||||||
|
require.Equal(t, []netip.Addr{netip.MustParseAddr("1.1.1.1")}, addresses)
|
||||||
|
require.True(t, addresses[0].Is4())
|
||||||
|
}
|
||||||
+59
-5
@@ -1,6 +1,15 @@
|
|||||||
package adapter
|
package adapter
|
||||||
|
|
||||||
import E "github.com/sagernet/sing/common/exceptions"
|
import (
|
||||||
|
"context"
|
||||||
|
"reflect"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/sagernet/sing-box/log"
|
||||||
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
|
F "github.com/sagernet/sing/common/format"
|
||||||
|
)
|
||||||
|
|
||||||
type SimpleLifecycle interface {
|
type SimpleLifecycle interface {
|
||||||
Start() error
|
Start() error
|
||||||
@@ -48,9 +57,34 @@ type LifecycleService interface {
|
|||||||
Lifecycle
|
Lifecycle
|
||||||
}
|
}
|
||||||
|
|
||||||
func Start(stage StartStage, services ...Lifecycle) error {
|
func getServiceName(service any) string {
|
||||||
|
if named, ok := service.(interface {
|
||||||
|
Type() string
|
||||||
|
Tag() string
|
||||||
|
}); ok {
|
||||||
|
tag := named.Tag()
|
||||||
|
if tag != "" {
|
||||||
|
return named.Type() + "[" + tag + "]"
|
||||||
|
}
|
||||||
|
return named.Type()
|
||||||
|
}
|
||||||
|
t := reflect.TypeOf(service)
|
||||||
|
if t.Kind() == reflect.Ptr {
|
||||||
|
t = t.Elem()
|
||||||
|
}
|
||||||
|
return strings.ToLower(t.Name())
|
||||||
|
}
|
||||||
|
|
||||||
|
func Start(ctx context.Context, logger log.ContextLogger, stage StartStage, services ...Lifecycle) error {
|
||||||
for _, service := range services {
|
for _, service := range services {
|
||||||
err := service.Start(stage)
|
err := ctx.Err()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
name := getServiceName(service)
|
||||||
|
done := LogElapsed(logger, stage, " ", name)
|
||||||
|
err = service.Start(stage)
|
||||||
|
done()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -58,12 +92,32 @@ func Start(stage StartStage, services ...Lifecycle) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func StartNamed(stage StartStage, services []LifecycleService) error {
|
func StartNamed(ctx context.Context, logger log.ContextLogger, stage StartStage, services []LifecycleService) error {
|
||||||
for _, service := range services {
|
for _, service := range services {
|
||||||
err := service.Start(stage)
|
err := ctx.Err()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
done := LogElapsed(logger, stage, " ", service.Name())
|
||||||
|
err = service.Start(stage)
|
||||||
|
done()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return E.Cause(err, stage.String(), " ", service.Name())
|
return E.Cause(err, stage.String(), " ", service.Name())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func LogElapsed(logger log.ContextLogger, description ...any) func() {
|
||||||
|
prefix := F.ToString(description...)
|
||||||
|
startTime := time.Now()
|
||||||
|
timer := time.AfterFunc(time.Second, func() {
|
||||||
|
logger.Trace(prefix, "...")
|
||||||
|
})
|
||||||
|
return func() {
|
||||||
|
if timer.Stop() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
logger.Trace(prefix, " completed (", F.Seconds(time.Since(startTime).Seconds()), "s)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package adapter
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net"
|
||||||
|
"net/netip"
|
||||||
|
)
|
||||||
|
|
||||||
|
type NeighborEntry struct {
|
||||||
|
Address netip.Addr
|
||||||
|
MACAddress net.HardwareAddr
|
||||||
|
Hostname string
|
||||||
|
}
|
||||||
|
|
||||||
|
type NeighborResolver interface {
|
||||||
|
LookupMAC(address netip.Addr) (net.HardwareAddr, bool)
|
||||||
|
LookupHostname(address netip.Addr) (string, bool)
|
||||||
|
LookupAddresses(hostname string) []netip.Addr
|
||||||
|
Start() error
|
||||||
|
Close() error
|
||||||
|
}
|
||||||
|
|
||||||
|
type NeighborUpdateListener interface {
|
||||||
|
UpdateNeighborTable(entries []NeighborEntry)
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package adapter
|
||||||
|
|
||||||
|
type NetworkNamespaceManager interface {
|
||||||
|
ResolvePath(nameOrPath string) string
|
||||||
|
}
|
||||||
+31
-3
@@ -1,6 +1,11 @@
|
|||||||
package adapter
|
package adapter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/hex"
|
||||||
|
"net"
|
||||||
|
"net/netip"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
C "github.com/sagernet/sing-box/constant"
|
C "github.com/sagernet/sing-box/constant"
|
||||||
@@ -10,22 +15,26 @@ import (
|
|||||||
|
|
||||||
type NetworkManager interface {
|
type NetworkManager interface {
|
||||||
Lifecycle
|
Lifecycle
|
||||||
|
Initialize(ruleSets []RuleSet)
|
||||||
InterfaceFinder() control.InterfaceFinder
|
InterfaceFinder() control.InterfaceFinder
|
||||||
UpdateInterfaces() error
|
UpdateInterfaces() error
|
||||||
DefaultNetworkInterface() *NetworkInterface
|
DefaultNetworkInterface() *NetworkInterface
|
||||||
NetworkInterfaces() []NetworkInterface
|
NetworkInterfaces() []NetworkInterface
|
||||||
|
NetworkEnvironment() uint64
|
||||||
AutoDetectInterface() bool
|
AutoDetectInterface() bool
|
||||||
AutoDetectInterfaceFunc() control.Func
|
AutoDetectInterfaceFunc() control.Func
|
||||||
ProtectFunc() control.Func
|
ProtectFunc() control.Func
|
||||||
DefaultOptions() NetworkOptions
|
DefaultOptions() NetworkOptions
|
||||||
RegisterAutoRedirectOutputMark(mark uint32) error
|
RegisterAutoRedirectOutputMark(mark uint32) error
|
||||||
AutoRedirectOutputMark() uint32
|
AutoRedirectOutputMark() uint32
|
||||||
|
AutoRedirectOutputMarkFunc() control.Func
|
||||||
NetworkMonitor() tun.NetworkUpdateMonitor
|
NetworkMonitor() tun.NetworkUpdateMonitor
|
||||||
InterfaceMonitor() tun.DefaultInterfaceMonitor
|
InterfaceMonitor() tun.DefaultInterfaceMonitor
|
||||||
PackageManager() tun.PackageManager
|
PackageManager() tun.PackageManager
|
||||||
|
NeedWIFIState() bool
|
||||||
WIFIState() WIFIState
|
WIFIState() WIFIState
|
||||||
ResetNetwork()
|
UpdateWIFIState(ctx context.Context)
|
||||||
UpdateWIFIState()
|
ResetNetwork(ctx context.Context)
|
||||||
}
|
}
|
||||||
|
|
||||||
type NetworkOptions struct {
|
type NetworkOptions struct {
|
||||||
@@ -40,7 +49,7 @@ type NetworkOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type InterfaceUpdateListener interface {
|
type InterfaceUpdateListener interface {
|
||||||
InterfaceUpdated()
|
InterfaceUpdated(ctx context.Context)
|
||||||
}
|
}
|
||||||
|
|
||||||
type WIFIState struct {
|
type WIFIState struct {
|
||||||
@@ -48,10 +57,29 @@ type WIFIState struct {
|
|||||||
BSSID string
|
BSSID string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func NormalizeWIFIBSSID(bssid string) string {
|
||||||
|
bssid = strings.TrimSpace(bssid)
|
||||||
|
if bssid == "" {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
parsed, err := net.ParseMAC(bssid)
|
||||||
|
if err == nil && len(parsed) == 6 {
|
||||||
|
return parsed.String()
|
||||||
|
}
|
||||||
|
if len(bssid) == 12 {
|
||||||
|
decoded, err := hex.DecodeString(bssid)
|
||||||
|
if err == nil {
|
||||||
|
return net.HardwareAddr(decoded).String()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bssid
|
||||||
|
}
|
||||||
|
|
||||||
type NetworkInterface struct {
|
type NetworkInterface struct {
|
||||||
control.Interface
|
control.Interface
|
||||||
Type C.InterfaceType
|
Type C.InterfaceType
|
||||||
DNSServers []string
|
DNSServers []string
|
||||||
|
Gateways []netip.Addr
|
||||||
Expensive bool
|
Expensive bool
|
||||||
Constrained bool
|
Constrained bool
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,101 @@
|
|||||||
|
package adapter
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/netip"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
OpenConnectStateConnecting = "connecting"
|
||||||
|
OpenConnectStateAuthPending = "auth-pending"
|
||||||
|
OpenConnectStateConnected = "connected"
|
||||||
|
OpenConnectStateError = "error"
|
||||||
|
)
|
||||||
|
|
||||||
|
type OpenConnectEndpoint interface {
|
||||||
|
Endpoint
|
||||||
|
OpenConnectStatus() OpenConnectStatus
|
||||||
|
StatusUpdated() <-chan struct{}
|
||||||
|
CompleteAuthChallenge(challengeID string, response OpenConnectAuthResponse) error
|
||||||
|
CancelAuthChallenge(challengeID string) error
|
||||||
|
}
|
||||||
|
|
||||||
|
type OpenConnectStatus struct {
|
||||||
|
State string
|
||||||
|
AuthChallenge *OpenConnectAuthChallenge
|
||||||
|
Error string
|
||||||
|
TunnelInfo *OpenConnectTunnelInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
type OpenConnectTunnelInfo struct {
|
||||||
|
Server string
|
||||||
|
Flavor string
|
||||||
|
Transport string
|
||||||
|
IPv4 []netip.Prefix
|
||||||
|
IPv6 []netip.Prefix
|
||||||
|
DNS []netip.Addr
|
||||||
|
MTU uint32
|
||||||
|
ConnectedSince time.Time
|
||||||
|
}
|
||||||
|
|
||||||
|
type OpenConnectAuthChallenge struct {
|
||||||
|
ID string
|
||||||
|
Banner string
|
||||||
|
Message string
|
||||||
|
Error string
|
||||||
|
Form *OpenConnectAuthForm
|
||||||
|
Browser *OpenConnectBrowserRequest
|
||||||
|
}
|
||||||
|
|
||||||
|
type OpenConnectAuthForm struct {
|
||||||
|
Fields []OpenConnectAuthFormField
|
||||||
|
}
|
||||||
|
|
||||||
|
type OpenConnectBrowserRequest struct {
|
||||||
|
URL string
|
||||||
|
FinalURL string
|
||||||
|
CookieNames []string
|
||||||
|
EarlyCookieNames []string
|
||||||
|
HeaderNames []string
|
||||||
|
CallbackURLPrefixes []string
|
||||||
|
CacheID string
|
||||||
|
}
|
||||||
|
|
||||||
|
type OpenConnectBrowserCookie struct {
|
||||||
|
Name string
|
||||||
|
Value string
|
||||||
|
}
|
||||||
|
|
||||||
|
type OpenConnectBrowserHeader struct {
|
||||||
|
Name string
|
||||||
|
Values []string
|
||||||
|
}
|
||||||
|
|
||||||
|
type OpenConnectAuthResponse struct {
|
||||||
|
Form *OpenConnectAuthFormResponse
|
||||||
|
Browser *OpenConnectBrowserResult
|
||||||
|
}
|
||||||
|
|
||||||
|
type OpenConnectAuthFormResponse struct {
|
||||||
|
Values map[string]string
|
||||||
|
}
|
||||||
|
|
||||||
|
type OpenConnectBrowserResult struct {
|
||||||
|
FinalURL string
|
||||||
|
Cookies []OpenConnectBrowserCookie
|
||||||
|
Headers []OpenConnectBrowserHeader
|
||||||
|
}
|
||||||
|
|
||||||
|
type OpenConnectAuthFormField struct {
|
||||||
|
SubmissionKey string
|
||||||
|
Name string
|
||||||
|
Label string
|
||||||
|
Kind string
|
||||||
|
Value string
|
||||||
|
Options []OpenConnectAuthFormChoice
|
||||||
|
}
|
||||||
|
|
||||||
|
type OpenConnectAuthFormChoice struct {
|
||||||
|
Value string
|
||||||
|
Label string
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package adapter
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/netip"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
OpenVPNStateConnecting = "connecting"
|
||||||
|
OpenVPNStateAuthPending = "auth-pending"
|
||||||
|
OpenVPNStateConnected = "connected"
|
||||||
|
OpenVPNStateError = "error"
|
||||||
|
)
|
||||||
|
|
||||||
|
type OpenVPNEndpoint interface {
|
||||||
|
Endpoint
|
||||||
|
OpenVPNStatus() OpenVPNStatus
|
||||||
|
StatusUpdated() <-chan struct{}
|
||||||
|
CompleteChallenge(challengeID string, response OpenVPNChallengeResponse) error
|
||||||
|
CancelChallenge(challengeID string) error
|
||||||
|
}
|
||||||
|
|
||||||
|
type OpenVPNStatus struct {
|
||||||
|
State string
|
||||||
|
Challenge *OpenVPNChallenge
|
||||||
|
Error string
|
||||||
|
TunnelInfo *OpenVPNTunnelInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
type OpenVPNTunnelInfo struct {
|
||||||
|
Server string
|
||||||
|
Network string
|
||||||
|
Cipher string
|
||||||
|
IPv4 []netip.Prefix
|
||||||
|
IPv6 []netip.Prefix
|
||||||
|
DNS []netip.Addr
|
||||||
|
MTU uint32
|
||||||
|
ConnectedSince time.Time
|
||||||
|
}
|
||||||
|
|
||||||
|
type OpenVPNChallenge struct {
|
||||||
|
ID string
|
||||||
|
Kind string
|
||||||
|
Username string
|
||||||
|
Message string
|
||||||
|
URL string
|
||||||
|
SecretMessage string
|
||||||
|
Echo bool
|
||||||
|
PreviousError string
|
||||||
|
Deadline time.Time
|
||||||
|
}
|
||||||
|
|
||||||
|
type OpenVPNChallengeResponse struct {
|
||||||
|
Username string
|
||||||
|
Password string
|
||||||
|
Secret string
|
||||||
|
}
|
||||||
@@ -2,9 +2,11 @@ package adapter
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"net/netip"
|
||||||
|
|
||||||
"github.com/sagernet/sing-box/log"
|
"github.com/sagernet/sing-box/log"
|
||||||
"github.com/sagernet/sing-box/option"
|
"github.com/sagernet/sing-box/option"
|
||||||
|
"github.com/sagernet/sing-tun"
|
||||||
N "github.com/sagernet/sing/common/network"
|
N "github.com/sagernet/sing/common/network"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -18,9 +20,27 @@ type Outbound interface {
|
|||||||
N.Dialer
|
N.Dialer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type OutboundWithPreferredRoutes interface {
|
||||||
|
Outbound
|
||||||
|
PreferredDomain(metadata *InboundContext, domain string) bool
|
||||||
|
PreferredAddress(metadata *InboundContext, address netip.Addr) bool
|
||||||
|
}
|
||||||
|
|
||||||
|
type OutboundWithMultiplex interface {
|
||||||
|
Outbound
|
||||||
|
MultiplexEnabled() bool
|
||||||
|
}
|
||||||
|
|
||||||
|
type FlowOutbound interface {
|
||||||
|
Outbound
|
||||||
|
tun.Port
|
||||||
|
PreMatchFlow(network string, destination netip.Addr) PreMatchAction
|
||||||
|
}
|
||||||
|
|
||||||
type OutboundRegistry interface {
|
type OutboundRegistry interface {
|
||||||
option.OutboundOptionsRegistry
|
option.OutboundOptionsRegistry
|
||||||
CreateOutbound(ctx context.Context, router Router, logger log.ContextLogger, tag string, outboundType string, options any) (Outbound, error)
|
CreateOutbound(ctx context.Context, router Router, logger log.ContextLogger, tag string, outboundType string, options any) (Outbound, error)
|
||||||
|
UnsafeCreateOutbound(ctx context.Context, router Router, logger log.ContextLogger, tag string, outboundType string, options any) (Outbound, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type OutboundManager interface {
|
type OutboundManager interface {
|
||||||
|
|||||||
+42
-19
@@ -30,7 +30,7 @@ type Manager struct {
|
|||||||
outboundByTag map[string]adapter.Outbound
|
outboundByTag map[string]adapter.Outbound
|
||||||
dependByTag map[string][]string
|
dependByTag map[string][]string
|
||||||
defaultOutbound adapter.Outbound
|
defaultOutbound adapter.Outbound
|
||||||
defaultOutboundFallback adapter.Outbound
|
defaultOutboundFallback func() (adapter.Outbound, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewManager(logger logger.ContextLogger, registry adapter.OutboundRegistry, endpoint adapter.EndpointManager, defaultTag string) *Manager {
|
func NewManager(logger logger.ContextLogger, registry adapter.OutboundRegistry, endpoint adapter.EndpointManager, defaultTag string) *Manager {
|
||||||
@@ -44,7 +44,7 @@ func NewManager(logger logger.ContextLogger, registry adapter.OutboundRegistry,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Manager) Initialize(defaultOutboundFallback adapter.Outbound) {
|
func (m *Manager) Initialize(defaultOutboundFallback func() (adapter.Outbound, error)) {
|
||||||
m.defaultOutboundFallback = defaultOutboundFallback
|
m.defaultOutboundFallback = defaultOutboundFallback
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,22 +55,38 @@ func (m *Manager) Start(stage adapter.StartStage) error {
|
|||||||
}
|
}
|
||||||
m.started = true
|
m.started = true
|
||||||
m.stage = stage
|
m.stage = stage
|
||||||
outbounds := m.outbounds
|
|
||||||
m.access.Unlock()
|
|
||||||
if stage == adapter.StartStateStart {
|
if stage == adapter.StartStateStart {
|
||||||
if m.defaultTag != "" && m.defaultOutbound == nil {
|
if m.defaultTag != "" && m.defaultOutbound == nil {
|
||||||
defaultEndpoint, loaded := m.endpoint.Get(m.defaultTag)
|
defaultEndpoint, loaded := m.endpoint.Get(m.defaultTag)
|
||||||
if !loaded {
|
if !loaded {
|
||||||
|
m.access.Unlock()
|
||||||
return E.New("default outbound not found: ", m.defaultTag)
|
return E.New("default outbound not found: ", m.defaultTag)
|
||||||
}
|
}
|
||||||
m.defaultOutbound = defaultEndpoint
|
m.defaultOutbound = defaultEndpoint
|
||||||
}
|
}
|
||||||
|
if m.defaultOutbound == nil {
|
||||||
|
directOutbound, err := m.defaultOutboundFallback()
|
||||||
|
if err != nil {
|
||||||
|
m.access.Unlock()
|
||||||
|
return E.Cause(err, "create direct outbound for fallback")
|
||||||
|
}
|
||||||
|
m.outbounds = append(m.outbounds, directOutbound)
|
||||||
|
m.outboundByTag[directOutbound.Tag()] = directOutbound
|
||||||
|
m.defaultOutbound = directOutbound
|
||||||
|
}
|
||||||
|
outbounds := m.outbounds
|
||||||
|
m.access.Unlock()
|
||||||
return m.startOutbounds(append(outbounds, common.Map(m.endpoint.Endpoints(), func(it adapter.Endpoint) adapter.Outbound { return it })...))
|
return m.startOutbounds(append(outbounds, common.Map(m.endpoint.Endpoints(), func(it adapter.Endpoint) adapter.Outbound { return it })...))
|
||||||
} else {
|
} else {
|
||||||
|
outbounds := m.outbounds
|
||||||
|
m.access.Unlock()
|
||||||
for _, outbound := range outbounds {
|
for _, outbound := range outbounds {
|
||||||
|
name := "outbound/" + outbound.Type() + "[" + outbound.Tag() + "]"
|
||||||
|
done := adapter.LogElapsed(m.logger, stage, " ", name)
|
||||||
err := adapter.LegacyStart(outbound, stage)
|
err := adapter.LegacyStart(outbound, stage)
|
||||||
|
done()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return E.Cause(err, stage, " outbound/", outbound.Type(), "[", outbound.Tag(), "]")
|
return E.Cause(err, stage, " ", name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -96,21 +112,26 @@ func (m *Manager) startOutbounds(outbounds []adapter.Outbound) error {
|
|||||||
}
|
}
|
||||||
started[outboundTag] = true
|
started[outboundTag] = true
|
||||||
canContinue = true
|
canContinue = true
|
||||||
|
name := "outbound/" + outboundToStart.Type() + "[" + outboundTag + "]"
|
||||||
if starter, isStarter := outboundToStart.(adapter.Lifecycle); isStarter {
|
if starter, isStarter := outboundToStart.(adapter.Lifecycle); isStarter {
|
||||||
monitor.Start("start outbound/", outboundToStart.Type(), "[", outboundTag, "]")
|
done := adapter.LogElapsed(m.logger, "start ", name)
|
||||||
|
monitor.Start("start ", name)
|
||||||
err := starter.Start(adapter.StartStateStart)
|
err := starter.Start(adapter.StartStateStart)
|
||||||
monitor.Finish()
|
monitor.Finish()
|
||||||
|
done()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return E.Cause(err, "start outbound/", outboundToStart.Type(), "[", outboundTag, "]")
|
return E.Cause(err, "start ", name)
|
||||||
}
|
}
|
||||||
} else if starter, isStarter := outboundToStart.(interface {
|
} else if starter, isStarter := outboundToStart.(interface {
|
||||||
Start() error
|
Start() error
|
||||||
}); isStarter {
|
}); isStarter {
|
||||||
monitor.Start("start outbound/", outboundToStart.Type(), "[", outboundTag, "]")
|
done := adapter.LogElapsed(m.logger, "start ", name)
|
||||||
|
monitor.Start("start ", name)
|
||||||
err := starter.Start()
|
err := starter.Start()
|
||||||
monitor.Finish()
|
monitor.Finish()
|
||||||
|
done()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return E.Cause(err, "start outbound/", outboundToStart.Type(), "[", outboundTag, "]")
|
return E.Cause(err, "start ", name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -158,11 +179,14 @@ func (m *Manager) Close() error {
|
|||||||
var err error
|
var err error
|
||||||
for _, outbound := range outbounds {
|
for _, outbound := range outbounds {
|
||||||
if closer, isCloser := outbound.(io.Closer); isCloser {
|
if closer, isCloser := outbound.(io.Closer); isCloser {
|
||||||
monitor.Start("close outbound/", outbound.Type(), "[", outbound.Tag(), "]")
|
name := "outbound/" + outbound.Type() + "[" + outbound.Tag() + "]"
|
||||||
|
done := adapter.LogElapsed(m.logger, "close ", name)
|
||||||
|
monitor.Start("close ", name)
|
||||||
err = E.Append(err, closer.Close(), func(err error) error {
|
err = E.Append(err, closer.Close(), func(err error) error {
|
||||||
return E.Cause(err, "close outbound/", outbound.Type(), "[", outbound.Tag(), "]")
|
return E.Cause(err, "close ", name)
|
||||||
})
|
})
|
||||||
monitor.Finish()
|
monitor.Finish()
|
||||||
|
done()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@@ -187,11 +211,7 @@ func (m *Manager) Outbound(tag string) (adapter.Outbound, bool) {
|
|||||||
func (m *Manager) Default() adapter.Outbound {
|
func (m *Manager) Default() adapter.Outbound {
|
||||||
m.access.RLock()
|
m.access.RLock()
|
||||||
defer m.access.RUnlock()
|
defer m.access.RUnlock()
|
||||||
if m.defaultOutbound != nil {
|
return m.defaultOutbound
|
||||||
return m.defaultOutbound
|
|
||||||
} else {
|
|
||||||
return m.defaultOutboundFallback
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Manager) Remove(tag string) error {
|
func (m *Manager) Remove(tag string) error {
|
||||||
@@ -213,7 +233,7 @@ func (m *Manager) Remove(tag string) error {
|
|||||||
if m.defaultOutbound == outbound {
|
if m.defaultOutbound == outbound {
|
||||||
if len(m.outbounds) > 0 {
|
if len(m.outbounds) > 0 {
|
||||||
m.defaultOutbound = m.outbounds[0]
|
m.defaultOutbound = m.outbounds[0]
|
||||||
m.logger.Info("updated default outbound to ", m.defaultOutbound.Tag())
|
m.logger.Notice("updated default outbound to ", m.defaultOutbound.Tag())
|
||||||
} else {
|
} else {
|
||||||
m.defaultOutbound = nil
|
m.defaultOutbound = nil
|
||||||
}
|
}
|
||||||
@@ -247,10 +267,13 @@ func (m *Manager) Create(ctx context.Context, router adapter.Router, logger log.
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if m.started {
|
if m.started {
|
||||||
|
name := "outbound/" + outbound.Type() + "[" + outbound.Tag() + "]"
|
||||||
for _, stage := range adapter.ListStartStages {
|
for _, stage := range adapter.ListStartStages {
|
||||||
|
done := adapter.LogElapsed(m.logger, stage, " ", name)
|
||||||
err = adapter.LegacyStart(outbound, stage)
|
err = adapter.LegacyStart(outbound, stage)
|
||||||
|
done()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return E.Cause(err, stage, " outbound/", outbound.Type(), "[", outbound.Tag(), "]")
|
return E.Cause(err, stage, " ", name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -280,7 +303,7 @@ func (m *Manager) Create(ctx context.Context, router adapter.Router, logger log.
|
|||||||
if tag == m.defaultTag || (m.defaultTag == "" && m.defaultOutbound == nil) {
|
if tag == m.defaultTag || (m.defaultTag == "" && m.defaultOutbound == nil) {
|
||||||
m.defaultOutbound = outbound
|
m.defaultOutbound = outbound
|
||||||
if m.started {
|
if m.started {
|
||||||
m.logger.Info("updated default outbound to ", outbound.Tag())
|
m.logger.Notice("updated default outbound to ", outbound.Tag())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package outbound
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"maps"
|
||||||
|
"slices"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/sagernet/sing-box/adapter"
|
"github.com/sagernet/sing-box/adapter"
|
||||||
@@ -44,6 +46,12 @@ func NewRegistry() *Registry {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *Registry) OptionTypes() []string {
|
||||||
|
r.access.Lock()
|
||||||
|
defer r.access.Unlock()
|
||||||
|
return slices.Sorted(maps.Keys(r.optionsType))
|
||||||
|
}
|
||||||
|
|
||||||
func (r *Registry) CreateOptions(outboundType string) (any, bool) {
|
func (r *Registry) CreateOptions(outboundType string) (any, bool) {
|
||||||
r.access.Lock()
|
r.access.Lock()
|
||||||
defer r.access.Unlock()
|
defer r.access.Unlock()
|
||||||
@@ -57,6 +65,10 @@ func (r *Registry) CreateOptions(outboundType string) (any, bool) {
|
|||||||
func (r *Registry) CreateOutbound(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, outboundType string, options any) (adapter.Outbound, error) {
|
func (r *Registry) CreateOutbound(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, outboundType string, options any) (adapter.Outbound, error) {
|
||||||
r.access.Lock()
|
r.access.Lock()
|
||||||
defer r.access.Unlock()
|
defer r.access.Unlock()
|
||||||
|
return r.UnsafeCreateOutbound(ctx, router, logger, tag, outboundType, options)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *Registry) UnsafeCreateOutbound(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, outboundType string, options any) (adapter.Outbound, error) {
|
||||||
constructor, loaded := r.constructors[outboundType]
|
constructor, loaded := r.constructors[outboundType]
|
||||||
if !loaded {
|
if !loaded {
|
||||||
return nil, E.New("outbound type not found: " + outboundType)
|
return nil, E.New("outbound type not found: " + outboundType)
|
||||||
|
|||||||
@@ -0,0 +1,119 @@
|
|||||||
|
package adapter
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/netip"
|
||||||
|
|
||||||
|
"github.com/sagernet/sing-box/option"
|
||||||
|
"github.com/sagernet/sing-tun"
|
||||||
|
"github.com/sagernet/sing/common/logger"
|
||||||
|
)
|
||||||
|
|
||||||
|
type PlatformInterface interface {
|
||||||
|
Initialize(networkManager NetworkManager) error
|
||||||
|
|
||||||
|
UsePlatformAutoDetectInterfaceControl() bool
|
||||||
|
AutoDetectInterfaceControl(fd int) error
|
||||||
|
BindInterfaceControl(fd int, interfaceName string) error
|
||||||
|
|
||||||
|
UsePlatformInterface() bool
|
||||||
|
OpenInterface(options *tun.Options, platformOptions option.TunPlatformOptions) (tun.Tun, error)
|
||||||
|
ProcessPlatformOptions(options option.TunPlatformOptions) error
|
||||||
|
|
||||||
|
UsePlatformDefaultInterfaceMonitor() bool
|
||||||
|
CreateDefaultInterfaceMonitor(logger logger.Logger) tun.DefaultInterfaceMonitor
|
||||||
|
|
||||||
|
UsePlatformNetworkInterfaces() bool
|
||||||
|
NetworkInterfaces() ([]NetworkInterface, error)
|
||||||
|
|
||||||
|
UnderNetworkExtension() bool
|
||||||
|
NetworkExtensionIncludeAllNetworks() bool
|
||||||
|
|
||||||
|
ClearDNSCache()
|
||||||
|
RequestPermissionForWIFIState() error
|
||||||
|
ReadWIFIState(ctx context.Context) WIFIState
|
||||||
|
|
||||||
|
UsePlatformConnectionOwnerFinder() bool
|
||||||
|
FindConnectionOwner(request *FindConnectionOwnerRequest) (*ConnectionOwner, error)
|
||||||
|
|
||||||
|
UsePlatformWIFIMonitor() bool
|
||||||
|
|
||||||
|
UsePlatformNotification() bool
|
||||||
|
SendNotification(notification *Notification) error
|
||||||
|
CancelNotification(identifier string, typeID int32) error
|
||||||
|
|
||||||
|
MyInterfaceAddress() []netip.Addr
|
||||||
|
|
||||||
|
UsePlatformNeighborResolver() bool
|
||||||
|
StartNeighborMonitor(listener NeighborUpdateListener) error
|
||||||
|
CloseNeighborMonitor(listener NeighborUpdateListener) error
|
||||||
|
|
||||||
|
UsePlatformShell() bool
|
||||||
|
CheckPlatformShell() error
|
||||||
|
OpenShellSession(user *PlatformUser, command string, env []string, term string, rows int32, cols int32) (ShellSession, error)
|
||||||
|
LookupUser(username string) (*PlatformUser, error)
|
||||||
|
LookupSFTPServer() (string, error)
|
||||||
|
ReadSystemSSHHostKey() ([]byte, error)
|
||||||
|
TailscaleHostname() string
|
||||||
|
|
||||||
|
UsePlatformBridge() bool
|
||||||
|
CreateBridge(options BridgeOptions) (BridgeSession, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type BridgeOptions struct {
|
||||||
|
BridgeName string
|
||||||
|
MTU uint32
|
||||||
|
Inet4Port netip.Addr
|
||||||
|
Inet6Port netip.Addr
|
||||||
|
Interface string
|
||||||
|
RuleIndex int
|
||||||
|
RouteTable int
|
||||||
|
}
|
||||||
|
|
||||||
|
type BridgeSession interface {
|
||||||
|
FileDescriptor() int
|
||||||
|
Name() string
|
||||||
|
Inet6Active() bool
|
||||||
|
SetEgress(interfaceName string) error
|
||||||
|
Close() error
|
||||||
|
}
|
||||||
|
|
||||||
|
type PlatformUser struct {
|
||||||
|
Username string
|
||||||
|
Uid int
|
||||||
|
Gid int
|
||||||
|
HomeDir string
|
||||||
|
Shell string
|
||||||
|
Groups []int
|
||||||
|
}
|
||||||
|
|
||||||
|
type FindConnectionOwnerRequest struct {
|
||||||
|
IpProtocol int32
|
||||||
|
SourceAddress string
|
||||||
|
SourcePort int32
|
||||||
|
DestinationAddress string
|
||||||
|
DestinationPort int32
|
||||||
|
}
|
||||||
|
|
||||||
|
type ConnectionOwner struct {
|
||||||
|
ProcessID uint32
|
||||||
|
UserId int32
|
||||||
|
UserName string
|
||||||
|
ProcessPath string
|
||||||
|
AndroidPackageNames []string
|
||||||
|
}
|
||||||
|
|
||||||
|
type Notification struct {
|
||||||
|
Identifier string
|
||||||
|
TypeName string
|
||||||
|
TypeID int32
|
||||||
|
Title string
|
||||||
|
Subtitle string
|
||||||
|
Body string
|
||||||
|
OpenURL string
|
||||||
|
}
|
||||||
|
|
||||||
|
type SystemProxyStatus struct {
|
||||||
|
Available bool
|
||||||
|
Enabled bool
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package adapter
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/sagernet/sing-box/log"
|
||||||
|
"github.com/sagernet/sing-box/option"
|
||||||
|
"github.com/sagernet/sing/common/x/list"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Provider interface {
|
||||||
|
Type() string
|
||||||
|
Tag() string
|
||||||
|
Outbounds() []Outbound
|
||||||
|
Outbound(tag string) (Outbound, bool)
|
||||||
|
UpdatedAt() time.Time
|
||||||
|
HealthCheck(ctx context.Context) (map[string]uint16, error)
|
||||||
|
RegisterCallback(callback ProviderUpdateCallback) *list.Element[ProviderUpdateCallback]
|
||||||
|
UnregisterCallback(element *list.Element[ProviderUpdateCallback])
|
||||||
|
}
|
||||||
|
|
||||||
|
type ProviderUpdater interface {
|
||||||
|
Update() error
|
||||||
|
}
|
||||||
|
|
||||||
|
type ProviderSubscriptionInfo interface {
|
||||||
|
SubscriptionInfo() SubscriptionInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
type ProviderRegistry interface {
|
||||||
|
option.ProviderOptionsRegistry
|
||||||
|
CreateProvider(ctx context.Context, router Router, logFactory log.Factory, tag string, providerType string, options any) (Provider, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type ProviderManager interface {
|
||||||
|
Lifecycle
|
||||||
|
Providers() []Provider
|
||||||
|
Get(tag string) (Provider, bool)
|
||||||
|
Remove(tag string) error
|
||||||
|
Create(ctx context.Context, router Router, logFactory log.Factory, tag string, providerType string, options any) error
|
||||||
|
}
|
||||||
|
|
||||||
|
type SubscriptionInfo struct {
|
||||||
|
Upload int64
|
||||||
|
Download int64
|
||||||
|
Total int64
|
||||||
|
Expire int64
|
||||||
|
}
|
||||||
|
|
||||||
|
type ProviderUpdateCallback = func(tag string) error
|
||||||
@@ -0,0 +1,305 @@
|
|||||||
|
package provider
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"reflect"
|
||||||
|
"regexp"
|
||||||
|
"strings"
|
||||||
|
"sync"
|
||||||
|
"sync/atomic"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/sagernet/sing-box/adapter"
|
||||||
|
"github.com/sagernet/sing-box/common/urltest"
|
||||||
|
"github.com/sagernet/sing-box/log"
|
||||||
|
"github.com/sagernet/sing-box/option"
|
||||||
|
"github.com/sagernet/sing/common/batch"
|
||||||
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
|
F "github.com/sagernet/sing/common/format"
|
||||||
|
"github.com/sagernet/sing/common/x/list"
|
||||||
|
"github.com/sagernet/sing/service"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Adapter struct {
|
||||||
|
ctx context.Context
|
||||||
|
outbound adapter.OutboundManager
|
||||||
|
router adapter.Router
|
||||||
|
logFactory log.Factory
|
||||||
|
logger log.ContextLogger
|
||||||
|
providerType string
|
||||||
|
providerTag string
|
||||||
|
outbounds []adapter.Outbound
|
||||||
|
outboundsByTag map[string]adapter.Outbound
|
||||||
|
ticker *time.Ticker
|
||||||
|
checking atomic.Bool
|
||||||
|
history *urltest.HistoryStorage
|
||||||
|
callbackAccess sync.Mutex
|
||||||
|
callbacks list.List[adapter.ProviderUpdateCallback]
|
||||||
|
|
||||||
|
link string
|
||||||
|
enabled bool
|
||||||
|
removeEmojis bool
|
||||||
|
timeout time.Duration
|
||||||
|
interval time.Duration
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewAdapter(ctx context.Context, router adapter.Router, outbound adapter.OutboundManager, logFactory log.Factory, logger log.ContextLogger, providerTag string, providerType string, options option.ProviderHealthCheckOptions) Adapter {
|
||||||
|
timeout := time.Duration(options.Timeout)
|
||||||
|
if timeout == 0 {
|
||||||
|
timeout = 3 * time.Second
|
||||||
|
}
|
||||||
|
interval := time.Duration(options.Interval)
|
||||||
|
if interval == 0 {
|
||||||
|
interval = 10 * time.Minute
|
||||||
|
}
|
||||||
|
if interval < time.Minute {
|
||||||
|
interval = time.Minute
|
||||||
|
}
|
||||||
|
return Adapter{
|
||||||
|
ctx: ctx,
|
||||||
|
outbound: outbound,
|
||||||
|
router: router,
|
||||||
|
logFactory: logFactory,
|
||||||
|
logger: logger,
|
||||||
|
providerType: providerType,
|
||||||
|
providerTag: providerTag,
|
||||||
|
|
||||||
|
enabled: options.Enabled,
|
||||||
|
link: options.URL,
|
||||||
|
timeout: timeout,
|
||||||
|
interval: interval,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Adapter) SetRemoveEmojis(remove bool) {
|
||||||
|
a.removeEmojis = remove
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Adapter) Start() error {
|
||||||
|
a.history = service.PtrFromContext[urltest.HistoryStorage](a.ctx)
|
||||||
|
if a.history == nil {
|
||||||
|
a.history = urltest.NewHistoryStorage()
|
||||||
|
}
|
||||||
|
go a.loopCheck()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Adapter) Type() string {
|
||||||
|
return a.providerType
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Adapter) Tag() string {
|
||||||
|
return a.providerTag
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Adapter) Outbounds() []adapter.Outbound {
|
||||||
|
return a.outbounds
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Adapter) Outbound(tag string) (adapter.Outbound, bool) {
|
||||||
|
if a.outboundsByTag == nil {
|
||||||
|
return nil, false
|
||||||
|
}
|
||||||
|
detour, ok := a.outboundsByTag[tag]
|
||||||
|
return detour, ok
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Adapter) UpdateOutbounds(oldOpts []option.Outbound, newOpts []option.Outbound) {
|
||||||
|
if a.removeEmojis {
|
||||||
|
removeEmojisFromTags(newOpts)
|
||||||
|
}
|
||||||
|
uniquifyTags(newOpts)
|
||||||
|
a.removeUseless(newOpts)
|
||||||
|
var (
|
||||||
|
oldOptByTag = make(map[string]option.Outbound)
|
||||||
|
outbounds = make([]adapter.Outbound, 0, len(newOpts))
|
||||||
|
outboundsByTag = make(map[string]adapter.Outbound)
|
||||||
|
)
|
||||||
|
for _, opt := range oldOpts {
|
||||||
|
oldOptByTag[opt.Tag] = opt
|
||||||
|
}
|
||||||
|
for i, opt := range newOpts {
|
||||||
|
var tag string
|
||||||
|
if opt.Tag != "" {
|
||||||
|
tag = F.ToString(a.providerTag, "/", opt.Tag)
|
||||||
|
} else {
|
||||||
|
tag = F.ToString(a.providerTag, "/", i)
|
||||||
|
}
|
||||||
|
outbound, exist := a.outbound.Outbound(tag)
|
||||||
|
if !exist || !reflect.DeepEqual(opt, oldOptByTag[opt.Tag]) {
|
||||||
|
err := a.outbound.Create(
|
||||||
|
adapter.WithContext(a.ctx, &adapter.InboundContext{
|
||||||
|
Outbound: tag,
|
||||||
|
}),
|
||||||
|
a.router,
|
||||||
|
a.logFactory.NewLogger(F.ToString("outbound/", opt.Type, "[", tag, "]")),
|
||||||
|
tag,
|
||||||
|
opt.Type,
|
||||||
|
opt.Options,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
a.logger.Warn(err, " in ", tag, ", skip create this outbound")
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
outbound, _ = a.outbound.Outbound(tag)
|
||||||
|
}
|
||||||
|
outbounds = append(outbounds, outbound)
|
||||||
|
outboundsByTag[tag] = outbound
|
||||||
|
}
|
||||||
|
if a.enabled && a.history != nil {
|
||||||
|
go a.HealthCheck(a.ctx)
|
||||||
|
}
|
||||||
|
a.outbounds = outbounds
|
||||||
|
a.outboundsByTag = outboundsByTag
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Adapter) HealthCheck(ctx context.Context) (map[string]uint16, error) {
|
||||||
|
if a.ticker != nil {
|
||||||
|
a.ticker.Reset(a.interval)
|
||||||
|
}
|
||||||
|
return a.healthcheck(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Adapter) RegisterCallback(callback adapter.ProviderUpdateCallback) *list.Element[adapter.ProviderUpdateCallback] {
|
||||||
|
a.callbackAccess.Lock()
|
||||||
|
defer a.callbackAccess.Unlock()
|
||||||
|
return a.callbacks.PushBack(callback)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Adapter) UnregisterCallback(element *list.Element[adapter.ProviderUpdateCallback]) {
|
||||||
|
a.callbackAccess.Lock()
|
||||||
|
defer a.callbackAccess.Unlock()
|
||||||
|
a.callbacks.Remove(element)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Adapter) UpdateGroups() {
|
||||||
|
for element := a.callbacks.Front(); element != nil; element = element.Next() {
|
||||||
|
element.Value(a.providerTag)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Adapter) Close() error {
|
||||||
|
if a.ticker != nil {
|
||||||
|
a.ticker.Stop()
|
||||||
|
}
|
||||||
|
outbounds := a.outbounds
|
||||||
|
a.outbounds = nil
|
||||||
|
var err error
|
||||||
|
for _, ob := range outbounds {
|
||||||
|
if err2 := a.outbound.Remove(ob.Tag()); err2 != nil {
|
||||||
|
err = E.Append(err, err2, func(err error) error {
|
||||||
|
return E.Cause(err, "close outbound [", ob.Tag(), "]")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Adapter) loopCheck() {
|
||||||
|
if !a.enabled {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
a.ticker = time.NewTicker(a.interval)
|
||||||
|
a.healthcheck(a.ctx)
|
||||||
|
for {
|
||||||
|
select {
|
||||||
|
case <-a.ctx.Done():
|
||||||
|
return
|
||||||
|
case <-a.ticker.C:
|
||||||
|
a.healthcheck(a.ctx)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Adapter) healthcheck(ctx context.Context) (map[string]uint16, error) {
|
||||||
|
result := make(map[string]uint16)
|
||||||
|
if a.checking.Swap(true) {
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
defer a.checking.Store(false)
|
||||||
|
b, _ := batch.New(ctx, batch.WithConcurrencyNum[any](10))
|
||||||
|
var resultAccess sync.Mutex
|
||||||
|
checked := make(map[string]bool)
|
||||||
|
for _, detour := range a.outbounds {
|
||||||
|
tag := detour.Tag()
|
||||||
|
if checked[tag] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
checked[tag] = true
|
||||||
|
b.Go(tag, func() (any, error) {
|
||||||
|
ctx, cancel := context.WithTimeout(a.ctx, a.timeout)
|
||||||
|
defer cancel()
|
||||||
|
t, err := urltest.URLTest(ctx, a.link, detour)
|
||||||
|
if err != nil {
|
||||||
|
a.logger.Debug("outbound ", tag, " unavailable: ", err)
|
||||||
|
a.history.DeleteURLTestHistory(tag)
|
||||||
|
} else {
|
||||||
|
a.logger.Debug("outbound ", tag, " available: ", t, "ms")
|
||||||
|
a.history.StoreURLTestHistory(tag, &adapter.URLTestHistory{
|
||||||
|
Time: time.Now(),
|
||||||
|
Delay: t,
|
||||||
|
})
|
||||||
|
resultAccess.Lock()
|
||||||
|
result[tag] = t
|
||||||
|
resultAccess.Unlock()
|
||||||
|
}
|
||||||
|
return nil, nil
|
||||||
|
})
|
||||||
|
}
|
||||||
|
b.Wait()
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Adapter) removeUseless(newOpts []option.Outbound) {
|
||||||
|
if len(a.outbounds) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
exists := make(map[string]bool)
|
||||||
|
for i, opt := range newOpts {
|
||||||
|
var tag string
|
||||||
|
if opt.Tag != "" {
|
||||||
|
tag = F.ToString(a.providerTag, "/", opt.Tag)
|
||||||
|
} else {
|
||||||
|
tag = F.ToString(a.providerTag, "/", i)
|
||||||
|
}
|
||||||
|
exists[tag] = true
|
||||||
|
}
|
||||||
|
for _, opt := range a.outbounds {
|
||||||
|
if !exists[opt.Tag()] {
|
||||||
|
if err := a.outbound.Remove(opt.Tag()); err != nil {
|
||||||
|
a.logger.Error(err, "close outbound [", opt.Tag(), "]")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func uniquifyTags(opts []option.Outbound) {
|
||||||
|
count := make(map[string]int)
|
||||||
|
for i, opt := range opts {
|
||||||
|
count[opt.Tag]++
|
||||||
|
if count[opt.Tag] > 1 {
|
||||||
|
opts[i].Tag = F.ToString(opt.Tag, " #", count[opt.Tag])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func removeEmojisFromTags(opts []option.Outbound) {
|
||||||
|
for i, opt := range opts {
|
||||||
|
cleaned := flagRegex.ReplaceAllStringFunc(opt.Tag, flagToCountryCode)
|
||||||
|
cleaned = emojiRegex.ReplaceAllString(cleaned, "")
|
||||||
|
cleaned = multiSpaceRegex.ReplaceAllString(cleaned, " ")
|
||||||
|
opts[i].Tag = strings.TrimSpace(cleaned)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func flagToCountryCode(flag string) string {
|
||||||
|
runes := []rune(flag)
|
||||||
|
if len(runes) == 2 {
|
||||||
|
return string(rune(runes[0]-0x1F1E6+'A')) + string(rune(runes[1]-0x1F1E6+'A')) + " "
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
var flagRegex = regexp.MustCompile(`[\x{1F1E6}-\x{1F1FF}]{2}`)
|
||||||
|
var emojiRegex = regexp.MustCompile(`[\x{1F1E0}-\x{1F1FF}\x{1F300}-\x{1F9FF}\x{2600}-\x{27BF}\x{FE00}-\x{FE0F}\x{200D}]+`)
|
||||||
|
var multiSpaceRegex = regexp.MustCompile(`\s{2,}`)
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package provider
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/sagernet/sing-box/option"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestFlagToCountryCodeAllFlags(t *testing.T) {
|
||||||
|
for first := 'A'; first <= 'Z'; first++ {
|
||||||
|
for second := 'A'; second <= 'Z'; second++ {
|
||||||
|
flag := string(rune(0x1F1E6+(first-'A'))) + string(rune(0x1F1E6+(second-'A')))
|
||||||
|
expected := string(first) + string(second)
|
||||||
|
result := flagToCountryCode(flag)
|
||||||
|
// flagToCountryCode appends a space
|
||||||
|
if result != expected+" " {
|
||||||
|
t.Errorf("flagToCountryCode(%q) = %q, want %q", expected, result, expected+" ")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestRemoveEmojisFromTags(t *testing.T) {
|
||||||
|
tests := []struct {
|
||||||
|
input string
|
||||||
|
expected string
|
||||||
|
}{
|
||||||
|
{"🇺🇸 United States", "US United States"},
|
||||||
|
{"🇷🇺 Россия", "RU Россия"},
|
||||||
|
{"🇩🇪 Germany 🚀", "DE Germany"},
|
||||||
|
{"🇫🇷🇬🇧 France-UK", "FR GB France-UK"},
|
||||||
|
{"No emojis here", "No emojis here"},
|
||||||
|
{"🌍 World", "World"},
|
||||||
|
{"🇯🇵 Tokyo ⚡ Fast", "JP Tokyo Fast"},
|
||||||
|
{"Germany 🇩🇪", "Germany DE"},
|
||||||
|
{"Server 🇺🇸 Node", "Server US Node"},
|
||||||
|
}
|
||||||
|
for _, tt := range tests {
|
||||||
|
opts := []option.Outbound{{Tag: tt.input}}
|
||||||
|
removeEmojisFromTags(opts)
|
||||||
|
if opts[0].Tag != tt.expected {
|
||||||
|
t.Errorf("removeEmojisFromTags(%q) = %q, want %q", tt.input, opts[0].Tag, tt.expected)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,157 @@
|
|||||||
|
package provider
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"io"
|
||||||
|
"os"
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"github.com/sagernet/sing-box/adapter"
|
||||||
|
"github.com/sagernet/sing-box/common/taskmonitor"
|
||||||
|
C "github.com/sagernet/sing-box/constant"
|
||||||
|
"github.com/sagernet/sing-box/log"
|
||||||
|
"github.com/sagernet/sing/common"
|
||||||
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
|
"github.com/sagernet/sing/common/logger"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ adapter.ProviderManager = (*Manager)(nil)
|
||||||
|
|
||||||
|
type Manager struct {
|
||||||
|
logger log.ContextLogger
|
||||||
|
registry adapter.ProviderRegistry
|
||||||
|
access sync.Mutex
|
||||||
|
started bool
|
||||||
|
stage adapter.StartStage
|
||||||
|
providers []adapter.Provider
|
||||||
|
providerByTag map[string]adapter.Provider
|
||||||
|
wg sync.WaitGroup
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewManager(logger logger.ContextLogger, registry adapter.ProviderRegistry) *Manager {
|
||||||
|
return &Manager{
|
||||||
|
logger: logger,
|
||||||
|
registry: registry,
|
||||||
|
providerByTag: make(map[string]adapter.Provider),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Manager) Initialize() {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Manager) Start(stage adapter.StartStage) error {
|
||||||
|
m.access.Lock()
|
||||||
|
if m.started && m.stage >= stage {
|
||||||
|
panic("already started")
|
||||||
|
}
|
||||||
|
m.started = true
|
||||||
|
m.stage = stage
|
||||||
|
providers := m.providers
|
||||||
|
m.access.Unlock()
|
||||||
|
for _, provider := range providers {
|
||||||
|
err := adapter.LegacyStart(provider, stage)
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, stage, " provider/", provider.Type(), "[", provider.Tag(), "]")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Manager) Close() error {
|
||||||
|
monitor := taskmonitor.New(m.logger, C.StopTimeout)
|
||||||
|
m.access.Lock()
|
||||||
|
if !m.started {
|
||||||
|
m.access.Unlock()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
m.started = false
|
||||||
|
providers := m.providers
|
||||||
|
m.providers = nil
|
||||||
|
m.access.Unlock()
|
||||||
|
var err error
|
||||||
|
for _, provider := range providers {
|
||||||
|
if closer, isCloser := provider.(io.Closer); isCloser {
|
||||||
|
monitor.Start("close provider/", provider.Type(), "[", provider.Tag(), "]")
|
||||||
|
err = E.Append(err, closer.Close(), func(err error) error {
|
||||||
|
return E.Cause(err, "close provider/", provider.Type(), "[", provider.Tag(), "]")
|
||||||
|
})
|
||||||
|
monitor.Finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Manager) Providers() []adapter.Provider {
|
||||||
|
m.access.Lock()
|
||||||
|
defer m.access.Unlock()
|
||||||
|
return m.providers
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Manager) Get(tag string) (adapter.Provider, bool) {
|
||||||
|
m.access.Lock()
|
||||||
|
provider, found := m.providerByTag[tag]
|
||||||
|
m.access.Unlock()
|
||||||
|
return provider, found
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Manager) Remove(tag string) error {
|
||||||
|
m.access.Lock()
|
||||||
|
provider, found := m.providerByTag[tag]
|
||||||
|
if !found {
|
||||||
|
m.access.Unlock()
|
||||||
|
return os.ErrInvalid
|
||||||
|
}
|
||||||
|
delete(m.providerByTag, tag)
|
||||||
|
index := common.Index(m.providers, func(it adapter.Provider) bool {
|
||||||
|
return it == provider
|
||||||
|
})
|
||||||
|
if index == -1 {
|
||||||
|
panic("invalid provider index")
|
||||||
|
}
|
||||||
|
m.providers = append(m.providers[:index], m.providers[index+1:]...)
|
||||||
|
started := m.started
|
||||||
|
m.access.Unlock()
|
||||||
|
if started {
|
||||||
|
return common.Close(provider)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Manager) Create(ctx context.Context, router adapter.Router, logFactory log.Factory, tag string, providerType string, options any) error {
|
||||||
|
if tag == "" {
|
||||||
|
return os.ErrInvalid
|
||||||
|
}
|
||||||
|
|
||||||
|
provider, err := m.registry.CreateProvider(ctx, router, logFactory, tag, providerType, options)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
m.access.Lock()
|
||||||
|
defer m.access.Unlock()
|
||||||
|
if m.started {
|
||||||
|
for _, stage := range adapter.ListStartStages {
|
||||||
|
err = adapter.LegacyStart(provider, stage)
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, stage, " provider/", provider.Type(), "[", provider.Tag(), "]")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if existsProvider, loaded := m.providerByTag[tag]; loaded {
|
||||||
|
if m.started {
|
||||||
|
err = common.Close(existsProvider)
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, "close provider", provider.Type(), "[", existsProvider.Tag(), "]")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
existsIndex := common.Index(m.providers, func(it adapter.Provider) bool {
|
||||||
|
return it == existsProvider
|
||||||
|
})
|
||||||
|
if existsIndex == -1 {
|
||||||
|
panic("invalid provider index")
|
||||||
|
}
|
||||||
|
m.providers = append(m.providers[:existsIndex], m.providers[existsIndex+1:]...)
|
||||||
|
}
|
||||||
|
m.providers = append(m.providers, provider)
|
||||||
|
m.providerByTag[tag] = provider
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
package provider
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"github.com/sagernet/sing-box/adapter"
|
||||||
|
"github.com/sagernet/sing-box/log"
|
||||||
|
"github.com/sagernet/sing/common"
|
||||||
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ConstructorFunc[T any] func(ctx context.Context, router adapter.Router, logFactory log.Factory, tag string, options T) (adapter.Provider, error)
|
||||||
|
|
||||||
|
func Register[Options any](registry *Registry, providerType string, constructor ConstructorFunc[Options]) {
|
||||||
|
registry.register(providerType, func() any {
|
||||||
|
return new(Options)
|
||||||
|
}, func(ctx context.Context, router adapter.Router, logFactory log.Factory, tag string, rawOptions any) (adapter.Provider, error) {
|
||||||
|
var options *Options
|
||||||
|
if rawOptions != nil {
|
||||||
|
options = rawOptions.(*Options)
|
||||||
|
}
|
||||||
|
return constructor(ctx, router, logFactory, tag, common.PtrValueOrDefault(options))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ adapter.ProviderRegistry = (*Registry)(nil)
|
||||||
|
|
||||||
|
type (
|
||||||
|
optionsConstructorFunc func() any
|
||||||
|
constructorFunc func(ctx context.Context, router adapter.Router, logFactory log.Factory, tag string, options any) (adapter.Provider, error)
|
||||||
|
)
|
||||||
|
|
||||||
|
type Registry struct {
|
||||||
|
access sync.Mutex
|
||||||
|
optionsType map[string]optionsConstructorFunc
|
||||||
|
constructors map[string]constructorFunc
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRegistry() *Registry {
|
||||||
|
return &Registry{
|
||||||
|
optionsType: make(map[string]optionsConstructorFunc),
|
||||||
|
constructors: make(map[string]constructorFunc),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *Registry) CreateOptions(providerType string) (any, bool) {
|
||||||
|
r.access.Lock()
|
||||||
|
defer r.access.Unlock()
|
||||||
|
optionsConstructor, loaded := r.optionsType[providerType]
|
||||||
|
if !loaded {
|
||||||
|
return nil, false
|
||||||
|
}
|
||||||
|
return optionsConstructor(), true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *Registry) CreateProvider(ctx context.Context, router adapter.Router, logFactory log.Factory, tag string, providerType string, options any) (adapter.Provider, error) {
|
||||||
|
r.access.Lock()
|
||||||
|
defer r.access.Unlock()
|
||||||
|
constructor, loaded := r.constructors[providerType]
|
||||||
|
if !loaded {
|
||||||
|
return nil, E.New("provider type not found: '" + providerType + "'")
|
||||||
|
}
|
||||||
|
return constructor(ctx, router, logFactory, tag, options)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *Registry) register(providerType string, optionsConstructor optionsConstructorFunc, constructor constructorFunc) {
|
||||||
|
r.access.Lock()
|
||||||
|
defer r.access.Unlock()
|
||||||
|
r.optionsType[providerType] = optionsConstructor
|
||||||
|
r.constructors[providerType] = constructor
|
||||||
|
}
|
||||||
+96
-54
@@ -2,15 +2,14 @@ package adapter
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"crypto/tls"
|
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/netip"
|
||||||
"sync"
|
"time"
|
||||||
|
|
||||||
C "github.com/sagernet/sing-box/constant"
|
"github.com/sagernet/sing-tun"
|
||||||
|
"github.com/sagernet/sing-tun/gtcpip/header"
|
||||||
M "github.com/sagernet/sing/common/metadata"
|
M "github.com/sagernet/sing/common/metadata"
|
||||||
N "github.com/sagernet/sing/common/network"
|
N "github.com/sagernet/sing/common/network"
|
||||||
"github.com/sagernet/sing/common/ntp"
|
|
||||||
"github.com/sagernet/sing/common/x/list"
|
"github.com/sagernet/sing/common/x/list"
|
||||||
|
|
||||||
"go4.org/netipx"
|
"go4.org/netipx"
|
||||||
@@ -19,18 +18,93 @@ import (
|
|||||||
type Router interface {
|
type Router interface {
|
||||||
Lifecycle
|
Lifecycle
|
||||||
ConnectionRouter
|
ConnectionRouter
|
||||||
PreMatch(metadata InboundContext) error
|
PreMatch(metadata InboundContext, firstPacket []byte) PreMatchResult
|
||||||
|
HijackDNSPacket(ctx context.Context, payload []byte, writer N.PacketWriter, metadata InboundContext)
|
||||||
ConnectionRouterEx
|
ConnectionRouterEx
|
||||||
RuleSet(tag string) (RuleSet, bool)
|
RuleSet(tag string) (RuleSet, bool)
|
||||||
NeedWIFIState() bool
|
|
||||||
Rules() []Rule
|
Rules() []Rule
|
||||||
|
NeedFindProcess() bool
|
||||||
|
NeedFindNeighbor() bool
|
||||||
|
NeighborResolver() NeighborResolver
|
||||||
AppendTracker(tracker ConnectionTracker)
|
AppendTracker(tracker ConnectionTracker)
|
||||||
ResetNetwork()
|
ResetNetwork()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PreMatchAction uint8
|
||||||
|
|
||||||
|
const (
|
||||||
|
PreMatchContinue PreMatchAction = iota
|
||||||
|
PreMatchFlow
|
||||||
|
PreMatchReject
|
||||||
|
PreMatchDrop
|
||||||
|
PreMatchBypass
|
||||||
|
PreMatchHijackDNS
|
||||||
|
)
|
||||||
|
|
||||||
|
type PreMatchResult struct {
|
||||||
|
Action PreMatchAction
|
||||||
|
Outbound Outbound
|
||||||
|
Destination netip.AddrPort
|
||||||
|
UDPTimeout time.Duration
|
||||||
|
NewTracker func() tun.FlowTracker
|
||||||
|
}
|
||||||
|
|
||||||
|
func JudgeFlow(router Router, inbound string, inboundType string, network uint8, source netip.AddrPort, destination netip.AddrPort, firstPacket []byte) tun.FlowVerdict {
|
||||||
|
var networkName string
|
||||||
|
switch network {
|
||||||
|
case uint8(header.TCPProtocolNumber):
|
||||||
|
networkName = N.NetworkTCP
|
||||||
|
case uint8(header.UDPProtocolNumber):
|
||||||
|
networkName = N.NetworkUDP
|
||||||
|
case uint8(header.ICMPv4ProtocolNumber), uint8(header.ICMPv6ProtocolNumber):
|
||||||
|
networkName = N.NetworkICMP
|
||||||
|
default:
|
||||||
|
return tun.FlowVerdict{Action: tun.ActionAccept}
|
||||||
|
}
|
||||||
|
metadata := InboundContext{
|
||||||
|
Inbound: inbound,
|
||||||
|
InboundType: inboundType,
|
||||||
|
Network: networkName,
|
||||||
|
Source: M.SocksaddrFromNetIP(source),
|
||||||
|
Destination: M.SocksaddrFromNetIP(destination),
|
||||||
|
}
|
||||||
|
if networkName == N.NetworkICMP {
|
||||||
|
metadata.Source.Port = 0
|
||||||
|
metadata.Destination.Port = 0
|
||||||
|
}
|
||||||
|
result := router.PreMatch(metadata, firstPacket)
|
||||||
|
switch result.Action {
|
||||||
|
case PreMatchFlow:
|
||||||
|
port, isPort := result.Outbound.(tun.Port)
|
||||||
|
if !isPort {
|
||||||
|
return tun.FlowVerdict{Action: tun.ActionAccept}
|
||||||
|
}
|
||||||
|
verdict := tun.FlowVerdict{Action: tun.ActionFlow, Port: port, UDPTimeout: result.UDPTimeout, NewTracker: result.NewTracker}
|
||||||
|
if result.Destination.IsValid() {
|
||||||
|
destinationPort := result.Destination.Port()
|
||||||
|
if networkName == N.NetworkICMP {
|
||||||
|
destinationPort = destination.Port()
|
||||||
|
}
|
||||||
|
verdict.Destination = netip.AddrPortFrom(result.Destination.Addr(), destinationPort)
|
||||||
|
}
|
||||||
|
return verdict
|
||||||
|
case PreMatchReject:
|
||||||
|
return tun.FlowVerdict{Action: tun.ActionReject}
|
||||||
|
case PreMatchDrop:
|
||||||
|
return tun.FlowVerdict{Action: tun.ActionDrop}
|
||||||
|
case PreMatchBypass:
|
||||||
|
return tun.FlowVerdict{Action: tun.ActionBypass}
|
||||||
|
case PreMatchHijackDNS:
|
||||||
|
return tun.FlowVerdict{Action: tun.ActionHijackDNS}
|
||||||
|
default:
|
||||||
|
return tun.FlowVerdict{Action: tun.ActionAccept}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type ConnectionTracker interface {
|
type ConnectionTracker interface {
|
||||||
RoutedConnection(ctx context.Context, conn net.Conn, metadata InboundContext, matchedRule Rule, matchOutbound Outbound) net.Conn
|
RoutedConnection(ctx context.Context, conn net.Conn, metadata InboundContext, matchedRule Rule, matchOutbound Outbound) net.Conn
|
||||||
RoutedPacketConnection(ctx context.Context, conn N.PacketConn, metadata InboundContext, matchedRule Rule, matchOutbound Outbound) N.PacketConn
|
RoutedPacketConnection(ctx context.Context, conn N.PacketConn, metadata InboundContext, matchedRule Rule, matchOutbound Outbound) N.PacketConn
|
||||||
|
RoutedFlow(ctx context.Context, metadata InboundContext, matchedRule Rule, matchOutbound Outbound) tun.FlowTracker
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Use ConnectionRouterEx instead.
|
// Deprecated: Use ConnectionRouterEx instead.
|
||||||
@@ -48,7 +122,6 @@ type ConnectionRouterEx interface {
|
|||||||
type RuleSet interface {
|
type RuleSet interface {
|
||||||
Name() string
|
Name() string
|
||||||
StartContext(ctx context.Context, startContext *HTTPStartContext) error
|
StartContext(ctx context.Context, startContext *HTTPStartContext) error
|
||||||
PostStart() error
|
|
||||||
Metadata() RuleSetMetadata
|
Metadata() RuleSetMetadata
|
||||||
ExtractIPSet() []*netipx.IPSet
|
ExtractIPSet() []*netipx.IPSet
|
||||||
IncRef()
|
IncRef()
|
||||||
@@ -62,51 +135,20 @@ type RuleSet interface {
|
|||||||
|
|
||||||
type RuleSetUpdateCallback func(it RuleSet)
|
type RuleSetUpdateCallback func(it RuleSet)
|
||||||
|
|
||||||
|
type DNSRuleSetUpdateValidator interface {
|
||||||
|
ValidateRuleSetMetadataUpdate(tag string, metadata RuleSetMetadata) error
|
||||||
|
}
|
||||||
|
|
||||||
|
// ip_version is not a headless-rule item, so ContainsIPVersionRule is intentionally absent.
|
||||||
type RuleSetMetadata struct {
|
type RuleSetMetadata struct {
|
||||||
ContainsProcessRule bool
|
ContainsProcessRule bool
|
||||||
ContainsWIFIRule bool
|
ContainsWIFIRule bool
|
||||||
ContainsIPCIDRRule bool
|
ContainsIPCIDRRule bool
|
||||||
}
|
ContainsDNSQueryTypeRule bool
|
||||||
type HTTPStartContext struct {
|
// ContainsNonIPCIDRRule signals that the rule-set carries at least one sub-rule
|
||||||
ctx context.Context
|
// with a predicate other than destination ip_cidr / ip_set, so it can contribute
|
||||||
access sync.Mutex
|
// to DNS pre-response matching. A rule-set where this is false and
|
||||||
httpClientCache map[string]*http.Client
|
// ContainsIPCIDRRule is true is "pure-IP" and matches nothing before a DNS
|
||||||
}
|
// response is available.
|
||||||
|
ContainsNonIPCIDRRule bool
|
||||||
func NewHTTPStartContext(ctx context.Context) *HTTPStartContext {
|
|
||||||
return &HTTPStartContext{
|
|
||||||
ctx: ctx,
|
|
||||||
httpClientCache: make(map[string]*http.Client),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *HTTPStartContext) HTTPClient(detour string, dialer N.Dialer) *http.Client {
|
|
||||||
c.access.Lock()
|
|
||||||
defer c.access.Unlock()
|
|
||||||
if httpClient, loaded := c.httpClientCache[detour]; loaded {
|
|
||||||
return httpClient
|
|
||||||
}
|
|
||||||
httpClient := &http.Client{
|
|
||||||
Transport: &http.Transport{
|
|
||||||
ForceAttemptHTTP2: true,
|
|
||||||
TLSHandshakeTimeout: C.TCPTimeout,
|
|
||||||
DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
|
|
||||||
return dialer.DialContext(ctx, network, M.ParseSocksaddr(addr))
|
|
||||||
},
|
|
||||||
TLSClientConfig: &tls.Config{
|
|
||||||
Time: ntp.TimeFuncFromContext(c.ctx),
|
|
||||||
RootCAs: RootPoolFromContext(c.ctx),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
c.httpClientCache[detour] = httpClient
|
|
||||||
return httpClient
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *HTTPStartContext) Close() {
|
|
||||||
c.access.Lock()
|
|
||||||
defer c.access.Unlock()
|
|
||||||
for _, client := range c.httpClientCache {
|
|
||||||
client.CloseIdleConnections()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-2
@@ -2,6 +2,8 @@ package adapter
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
C "github.com/sagernet/sing-box/constant"
|
C "github.com/sagernet/sing-box/constant"
|
||||||
|
|
||||||
|
"github.com/miekg/dns"
|
||||||
)
|
)
|
||||||
|
|
||||||
type HeadlessRule interface {
|
type HeadlessRule interface {
|
||||||
@@ -18,8 +20,13 @@ type Rule interface {
|
|||||||
|
|
||||||
type DNSRule interface {
|
type DNSRule interface {
|
||||||
Rule
|
Rule
|
||||||
|
LegacyPreMatch(metadata *InboundContext) bool
|
||||||
WithAddressLimit() bool
|
WithAddressLimit() bool
|
||||||
MatchAddressLimit(metadata *InboundContext) bool
|
MatchAddressLimit(metadata *InboundContext, response *dns.Msg) bool
|
||||||
|
MatchResponseTag() string
|
||||||
|
MatchResponseTags() []string
|
||||||
|
MatchResponseAnonymous() bool
|
||||||
|
Race() bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type RuleAction interface {
|
type RuleAction interface {
|
||||||
@@ -29,7 +36,7 @@ type RuleAction interface {
|
|||||||
|
|
||||||
func IsFinalAction(action RuleAction) bool {
|
func IsFinalAction(action RuleAction) bool {
|
||||||
switch action.Type() {
|
switch action.Type() {
|
||||||
case C.RuleActionTypeSniff, C.RuleActionTypeResolve:
|
case C.RuleActionTypeSniff, C.RuleActionTypeResolve, C.RuleActionTypeEvaluate:
|
||||||
return false
|
return false
|
||||||
default:
|
default:
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package adapter
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/sagernet/sing/service"
|
||||||
|
)
|
||||||
|
|
||||||
|
type SecurityPolicy interface {
|
||||||
|
CheckFeature(ctx context.Context, feature string) error
|
||||||
|
}
|
||||||
|
|
||||||
|
func CheckSecurityFeature(ctx context.Context, feature string) error {
|
||||||
|
policy := service.FromContext[SecurityPolicy](ctx)
|
||||||
|
if policy == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return policy.CheckFeature(ctx, feature)
|
||||||
|
}
|
||||||
@@ -43,9 +43,12 @@ func (m *Manager) Start(stage adapter.StartStage) error {
|
|||||||
services := m.services
|
services := m.services
|
||||||
m.access.Unlock()
|
m.access.Unlock()
|
||||||
for _, service := range services {
|
for _, service := range services {
|
||||||
|
name := "service/" + service.Type() + "[" + service.Tag() + "]"
|
||||||
|
done := adapter.LogElapsed(m.logger, stage, " ", name)
|
||||||
err := adapter.LegacyStart(service, stage)
|
err := adapter.LegacyStart(service, stage)
|
||||||
|
done()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return E.Cause(err, stage, " service/", service.Type(), "[", service.Tag(), "]")
|
return E.Cause(err, stage, " ", name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@@ -63,11 +66,14 @@ func (m *Manager) Close() error {
|
|||||||
monitor := taskmonitor.New(m.logger, C.StopTimeout)
|
monitor := taskmonitor.New(m.logger, C.StopTimeout)
|
||||||
var err error
|
var err error
|
||||||
for _, service := range services {
|
for _, service := range services {
|
||||||
monitor.Start("close service/", service.Type(), "[", service.Tag(), "]")
|
name := "service/" + service.Type() + "[" + service.Tag() + "]"
|
||||||
|
done := adapter.LogElapsed(m.logger, "close ", name)
|
||||||
|
monitor.Start("close ", name)
|
||||||
err = E.Append(err, service.Close(), func(err error) error {
|
err = E.Append(err, service.Close(), func(err error) error {
|
||||||
return E.Cause(err, "close service/", service.Type(), "[", service.Tag(), "]")
|
return E.Cause(err, "close ", name)
|
||||||
})
|
})
|
||||||
monitor.Finish()
|
monitor.Finish()
|
||||||
|
done()
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -116,10 +122,13 @@ func (m *Manager) Create(ctx context.Context, logger log.ContextLogger, tag stri
|
|||||||
m.access.Lock()
|
m.access.Lock()
|
||||||
defer m.access.Unlock()
|
defer m.access.Unlock()
|
||||||
if m.started {
|
if m.started {
|
||||||
|
name := "service/" + service.Type() + "[" + service.Tag() + "]"
|
||||||
for _, stage := range adapter.ListStartStages {
|
for _, stage := range adapter.ListStartStages {
|
||||||
|
done := adapter.LogElapsed(m.logger, stage, " ", name)
|
||||||
err = adapter.LegacyStart(service, stage)
|
err = adapter.LegacyStart(service, stage)
|
||||||
|
done()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return E.Cause(err, stage, " service/", service.Type(), "[", service.Tag(), "]")
|
return E.Cause(err, stage, " ", name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package service
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"maps"
|
||||||
|
"slices"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/sagernet/sing-box/adapter"
|
"github.com/sagernet/sing-box/adapter"
|
||||||
@@ -44,6 +46,12 @@ func NewRegistry() *Registry {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Registry) OptionTypes() []string {
|
||||||
|
m.access.Lock()
|
||||||
|
defer m.access.Unlock()
|
||||||
|
return slices.Sorted(maps.Keys(m.optionsType))
|
||||||
|
}
|
||||||
|
|
||||||
func (m *Registry) CreateOptions(outboundType string) (any, bool) {
|
func (m *Registry) CreateOptions(outboundType string) (any, bool) {
|
||||||
m.access.Lock()
|
m.access.Lock()
|
||||||
defer m.access.Unlock()
|
defer m.access.Unlock()
|
||||||
|
|||||||
@@ -0,0 +1,104 @@
|
|||||||
|
package adapter
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"io"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type TailscaleEndpoint interface {
|
||||||
|
SubscribeTailscaleStatus(ctx context.Context, fn func(*TailscaleEndpointStatus)) error
|
||||||
|
StartTailscalePing(ctx context.Context, peerIP string, fn func(*TailscalePingResult)) error
|
||||||
|
SetTailscaleExitNode(ctx context.Context, stableID string) error
|
||||||
|
Logout(ctx context.Context) error
|
||||||
|
GetTailscaleCertificate(ctx context.Context, domain string, minValidity time.Duration) (certificatePEM []byte, privateKeyPEM []byte, err error)
|
||||||
|
SubscribeTaildropInbox(ctx context.Context, fn func(*TaildropInbox)) error
|
||||||
|
MarkTaildropInboxRead() error
|
||||||
|
SendTaildropFile(ctx context.Context, peerStableID string, fileName string, size int64, content io.Reader, progress func(sentBytes int64)) error
|
||||||
|
OpenTaildropFile(fileName string) (io.ReadCloser, int64, error)
|
||||||
|
DeleteTaildropFile(fileName string) error
|
||||||
|
CancelTaildropReceiving(senderID string, fileName string) error
|
||||||
|
}
|
||||||
|
|
||||||
|
type TaildropInbox struct {
|
||||||
|
Files []*TaildropFile
|
||||||
|
Receiving []*TaildropReceivingFile
|
||||||
|
}
|
||||||
|
|
||||||
|
type TaildropFile struct {
|
||||||
|
Name string
|
||||||
|
Size int64
|
||||||
|
SenderName string
|
||||||
|
ModifiedAt int64
|
||||||
|
}
|
||||||
|
|
||||||
|
type TaildropReceivingFile struct {
|
||||||
|
Name string
|
||||||
|
Size int64
|
||||||
|
ReceivedBytes int64
|
||||||
|
SenderID string
|
||||||
|
SenderName string
|
||||||
|
}
|
||||||
|
|
||||||
|
type TailscalePingResult struct {
|
||||||
|
LatencyMs float64
|
||||||
|
IsDirect bool
|
||||||
|
Endpoint string
|
||||||
|
PeerRelay string
|
||||||
|
DERPRegionID int32
|
||||||
|
DERPRegionCode string
|
||||||
|
Error string
|
||||||
|
}
|
||||||
|
|
||||||
|
type TailscaleEndpointStatus struct {
|
||||||
|
BackendState string
|
||||||
|
AuthURL string
|
||||||
|
NetworkName string
|
||||||
|
MagicDNSSuffix string
|
||||||
|
Self *TailscalePeer
|
||||||
|
ExitNode *TailscalePeer
|
||||||
|
UserGroups []*TailscaleUserGroup
|
||||||
|
KeyAuth bool
|
||||||
|
CanShareFiles bool
|
||||||
|
WaitingFileCount int32
|
||||||
|
ReceivingFileCount int32
|
||||||
|
UnreadFileCount int32
|
||||||
|
CertDomains []string
|
||||||
|
}
|
||||||
|
|
||||||
|
type TailscaleUserGroup struct {
|
||||||
|
UserID int64
|
||||||
|
LoginName string
|
||||||
|
DisplayName string
|
||||||
|
ProfilePicURL string
|
||||||
|
Peers []*TailscalePeer
|
||||||
|
}
|
||||||
|
|
||||||
|
type TailscalePeer struct {
|
||||||
|
StableID string
|
||||||
|
HostName string
|
||||||
|
DNSName string
|
||||||
|
OS string
|
||||||
|
TailscaleIPs []string
|
||||||
|
SSHHostKeys []string
|
||||||
|
Online bool
|
||||||
|
ExitNode bool
|
||||||
|
ExitNodeOption bool
|
||||||
|
ShareeNode bool
|
||||||
|
Expired bool
|
||||||
|
Active bool
|
||||||
|
CanReceiveFiles bool
|
||||||
|
RxBytes int64
|
||||||
|
TxBytes int64
|
||||||
|
UserID int64
|
||||||
|
KeyExpiry int64
|
||||||
|
LastSeen int64
|
||||||
|
}
|
||||||
|
|
||||||
|
type ShellSession interface {
|
||||||
|
MasterFD() int32
|
||||||
|
Resize(rows int32, cols int32) error
|
||||||
|
Signal(signal int32) error
|
||||||
|
WaitExit() (int32, error)
|
||||||
|
Close() error
|
||||||
|
}
|
||||||
+42
-42
@@ -9,31 +9,31 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
ConnectionHandlerFuncEx = func(ctx context.Context, conn net.Conn, metadata InboundContext, onClose N.CloseHandlerFunc)
|
ConnectionHandlerFunc = func(ctx context.Context, conn net.Conn, metadata InboundContext, onClose N.CloseHandlerFunc)
|
||||||
PacketConnectionHandlerFuncEx = func(ctx context.Context, conn N.PacketConn, metadata InboundContext, onClose N.CloseHandlerFunc)
|
PacketConnectionHandlerFunc = func(ctx context.Context, conn N.PacketConn, metadata InboundContext, onClose N.CloseHandlerFunc)
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewUpstreamHandlerEx(
|
func NewUpstreamHandler(
|
||||||
metadata InboundContext,
|
metadata InboundContext,
|
||||||
connectionHandler ConnectionHandlerFuncEx,
|
connectionHandler ConnectionHandlerFunc,
|
||||||
packetHandler PacketConnectionHandlerFuncEx,
|
packetHandler PacketConnectionHandlerFunc,
|
||||||
) UpstreamHandlerAdapterEx {
|
) UpstreamHandlerAdapter {
|
||||||
return &myUpstreamHandlerWrapperEx{
|
return &myUpstreamHandlerWrapper{
|
||||||
metadata: metadata,
|
metadata: metadata,
|
||||||
connectionHandler: connectionHandler,
|
connectionHandler: connectionHandler,
|
||||||
packetHandler: packetHandler,
|
packetHandler: packetHandler,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ UpstreamHandlerAdapterEx = (*myUpstreamHandlerWrapperEx)(nil)
|
var _ UpstreamHandlerAdapter = (*myUpstreamHandlerWrapper)(nil)
|
||||||
|
|
||||||
type myUpstreamHandlerWrapperEx struct {
|
type myUpstreamHandlerWrapper struct {
|
||||||
metadata InboundContext
|
metadata InboundContext
|
||||||
connectionHandler ConnectionHandlerFuncEx
|
connectionHandler ConnectionHandlerFunc
|
||||||
packetHandler PacketConnectionHandlerFuncEx
|
packetHandler PacketConnectionHandlerFunc
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *myUpstreamHandlerWrapperEx) NewConnectionEx(ctx context.Context, conn net.Conn, source M.Socksaddr, destination M.Socksaddr, onClose N.CloseHandlerFunc) {
|
func (w *myUpstreamHandlerWrapper) NewConnectionEx(ctx context.Context, conn net.Conn, source M.Socksaddr, destination M.Socksaddr, onClose N.CloseHandlerFunc) {
|
||||||
myMetadata := w.metadata
|
myMetadata := w.metadata
|
||||||
if source.IsValid() {
|
if source.IsValid() {
|
||||||
myMetadata.Source = source
|
myMetadata.Source = source
|
||||||
@@ -44,7 +44,7 @@ func (w *myUpstreamHandlerWrapperEx) NewConnectionEx(ctx context.Context, conn n
|
|||||||
w.connectionHandler(ctx, conn, myMetadata, onClose)
|
w.connectionHandler(ctx, conn, myMetadata, onClose)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *myUpstreamHandlerWrapperEx) NewPacketConnectionEx(ctx context.Context, conn N.PacketConn, source M.Socksaddr, destination M.Socksaddr, onClose N.CloseHandlerFunc) {
|
func (w *myUpstreamHandlerWrapper) NewPacketConnectionEx(ctx context.Context, conn N.PacketConn, source M.Socksaddr, destination M.Socksaddr, onClose N.CloseHandlerFunc) {
|
||||||
myMetadata := w.metadata
|
myMetadata := w.metadata
|
||||||
if source.IsValid() {
|
if source.IsValid() {
|
||||||
myMetadata.Source = source
|
myMetadata.Source = source
|
||||||
@@ -55,25 +55,25 @@ func (w *myUpstreamHandlerWrapperEx) NewPacketConnectionEx(ctx context.Context,
|
|||||||
w.packetHandler(ctx, conn, myMetadata, onClose)
|
w.packetHandler(ctx, conn, myMetadata, onClose)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ UpstreamHandlerAdapterEx = (*myUpstreamContextHandlerWrapperEx)(nil)
|
var _ UpstreamHandlerAdapter = (*myUpstreamContextHandlerWrapper)(nil)
|
||||||
|
|
||||||
type myUpstreamContextHandlerWrapperEx struct {
|
type myUpstreamContextHandlerWrapper struct {
|
||||||
connectionHandler ConnectionHandlerFuncEx
|
connectionHandler ConnectionHandlerFunc
|
||||||
packetHandler PacketConnectionHandlerFuncEx
|
packetHandler PacketConnectionHandlerFunc
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewUpstreamContextHandlerEx(
|
func NewUpstreamContextHandler(
|
||||||
connectionHandler ConnectionHandlerFuncEx,
|
connectionHandler ConnectionHandlerFunc,
|
||||||
packetHandler PacketConnectionHandlerFuncEx,
|
packetHandler PacketConnectionHandlerFunc,
|
||||||
) UpstreamHandlerAdapterEx {
|
) UpstreamHandlerAdapter {
|
||||||
return &myUpstreamContextHandlerWrapperEx{
|
return &myUpstreamContextHandlerWrapper{
|
||||||
connectionHandler: connectionHandler,
|
connectionHandler: connectionHandler,
|
||||||
packetHandler: packetHandler,
|
packetHandler: packetHandler,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *myUpstreamContextHandlerWrapperEx) NewConnectionEx(ctx context.Context, conn net.Conn, source M.Socksaddr, destination M.Socksaddr, onClose N.CloseHandlerFunc) {
|
func (w *myUpstreamContextHandlerWrapper) NewConnectionEx(ctx context.Context, conn net.Conn, source M.Socksaddr, destination M.Socksaddr, onClose N.CloseHandlerFunc) {
|
||||||
myMetadata := ContextFrom(ctx)
|
_, myMetadata := ExtendContext(ctx)
|
||||||
if source.IsValid() {
|
if source.IsValid() {
|
||||||
myMetadata.Source = source
|
myMetadata.Source = source
|
||||||
}
|
}
|
||||||
@@ -83,8 +83,8 @@ func (w *myUpstreamContextHandlerWrapperEx) NewConnectionEx(ctx context.Context,
|
|||||||
w.connectionHandler(ctx, conn, *myMetadata, onClose)
|
w.connectionHandler(ctx, conn, *myMetadata, onClose)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *myUpstreamContextHandlerWrapperEx) NewPacketConnectionEx(ctx context.Context, conn N.PacketConn, source M.Socksaddr, destination M.Socksaddr, onClose N.CloseHandlerFunc) {
|
func (w *myUpstreamContextHandlerWrapper) NewPacketConnectionEx(ctx context.Context, conn N.PacketConn, source M.Socksaddr, destination M.Socksaddr, onClose N.CloseHandlerFunc) {
|
||||||
myMetadata := ContextFrom(ctx)
|
_, myMetadata := ExtendContext(ctx)
|
||||||
if source.IsValid() {
|
if source.IsValid() {
|
||||||
myMetadata.Source = source
|
myMetadata.Source = source
|
||||||
}
|
}
|
||||||
@@ -94,24 +94,24 @@ func (w *myUpstreamContextHandlerWrapperEx) NewPacketConnectionEx(ctx context.Co
|
|||||||
w.packetHandler(ctx, conn, *myMetadata, onClose)
|
w.packetHandler(ctx, conn, *myMetadata, onClose)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRouteHandlerEx(
|
func NewRouteHandler(
|
||||||
metadata InboundContext,
|
metadata InboundContext,
|
||||||
router ConnectionRouterEx,
|
router ConnectionRouterEx,
|
||||||
) UpstreamHandlerAdapterEx {
|
) UpstreamHandlerAdapter {
|
||||||
return &routeHandlerWrapperEx{
|
return &routeHandlerWrapper{
|
||||||
metadata: metadata,
|
metadata: metadata,
|
||||||
router: router,
|
router: router,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ UpstreamHandlerAdapterEx = (*routeHandlerWrapperEx)(nil)
|
var _ UpstreamHandlerAdapter = (*routeHandlerWrapper)(nil)
|
||||||
|
|
||||||
type routeHandlerWrapperEx struct {
|
type routeHandlerWrapper struct {
|
||||||
metadata InboundContext
|
metadata InboundContext
|
||||||
router ConnectionRouterEx
|
router ConnectionRouterEx
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *routeHandlerWrapperEx) NewConnectionEx(ctx context.Context, conn net.Conn, source M.Socksaddr, destination M.Socksaddr, onClose N.CloseHandlerFunc) {
|
func (r *routeHandlerWrapper) NewConnectionEx(ctx context.Context, conn net.Conn, source M.Socksaddr, destination M.Socksaddr, onClose N.CloseHandlerFunc) {
|
||||||
if source.IsValid() {
|
if source.IsValid() {
|
||||||
r.metadata.Source = source
|
r.metadata.Source = source
|
||||||
}
|
}
|
||||||
@@ -121,7 +121,7 @@ func (r *routeHandlerWrapperEx) NewConnectionEx(ctx context.Context, conn net.Co
|
|||||||
r.router.RouteConnectionEx(ctx, conn, r.metadata, onClose)
|
r.router.RouteConnectionEx(ctx, conn, r.metadata, onClose)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *routeHandlerWrapperEx) NewPacketConnectionEx(ctx context.Context, conn N.PacketConn, source M.Socksaddr, destination M.Socksaddr, onClose N.CloseHandlerFunc) {
|
func (r *routeHandlerWrapper) NewPacketConnectionEx(ctx context.Context, conn N.PacketConn, source M.Socksaddr, destination M.Socksaddr, onClose N.CloseHandlerFunc) {
|
||||||
if source.IsValid() {
|
if source.IsValid() {
|
||||||
r.metadata.Source = source
|
r.metadata.Source = source
|
||||||
}
|
}
|
||||||
@@ -131,22 +131,22 @@ func (r *routeHandlerWrapperEx) NewPacketConnectionEx(ctx context.Context, conn
|
|||||||
r.router.RoutePacketConnectionEx(ctx, conn, r.metadata, onClose)
|
r.router.RoutePacketConnectionEx(ctx, conn, r.metadata, onClose)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRouteContextHandlerEx(
|
func NewRouteContextHandler(
|
||||||
router ConnectionRouterEx,
|
router ConnectionRouterEx,
|
||||||
) UpstreamHandlerAdapterEx {
|
) UpstreamHandlerAdapter {
|
||||||
return &routeContextHandlerWrapperEx{
|
return &routeContextHandlerWrapper{
|
||||||
router: router,
|
router: router,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ UpstreamHandlerAdapterEx = (*routeContextHandlerWrapperEx)(nil)
|
var _ UpstreamHandlerAdapter = (*routeContextHandlerWrapper)(nil)
|
||||||
|
|
||||||
type routeContextHandlerWrapperEx struct {
|
type routeContextHandlerWrapper struct {
|
||||||
router ConnectionRouterEx
|
router ConnectionRouterEx
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *routeContextHandlerWrapperEx) NewConnectionEx(ctx context.Context, conn net.Conn, source M.Socksaddr, destination M.Socksaddr, onClose N.CloseHandlerFunc) {
|
func (r *routeContextHandlerWrapper) NewConnectionEx(ctx context.Context, conn net.Conn, source M.Socksaddr, destination M.Socksaddr, onClose N.CloseHandlerFunc) {
|
||||||
metadata := ContextFrom(ctx)
|
_, metadata := ExtendContext(ctx)
|
||||||
if source.IsValid() {
|
if source.IsValid() {
|
||||||
metadata.Source = source
|
metadata.Source = source
|
||||||
}
|
}
|
||||||
@@ -156,8 +156,8 @@ func (r *routeContextHandlerWrapperEx) NewConnectionEx(ctx context.Context, conn
|
|||||||
r.router.RouteConnectionEx(ctx, conn, *metadata, onClose)
|
r.router.RouteConnectionEx(ctx, conn, *metadata, onClose)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *routeContextHandlerWrapperEx) NewPacketConnectionEx(ctx context.Context, conn N.PacketConn, source M.Socksaddr, destination M.Socksaddr, onClose N.CloseHandlerFunc) {
|
func (r *routeContextHandlerWrapper) NewPacketConnectionEx(ctx context.Context, conn N.PacketConn, source M.Socksaddr, destination M.Socksaddr, onClose N.CloseHandlerFunc) {
|
||||||
metadata := ContextFrom(ctx)
|
_, metadata := ExtendContext(ctx)
|
||||||
if source.IsValid() {
|
if source.IsValid() {
|
||||||
metadata.Source = source
|
metadata.Source = source
|
||||||
}
|
}
|
||||||
|
|||||||
+61
-52
@@ -12,21 +12,30 @@ import (
|
|||||||
|
|
||||||
type (
|
type (
|
||||||
// Deprecated
|
// Deprecated
|
||||||
ConnectionHandlerFunc = func(ctx context.Context, conn net.Conn, metadata InboundContext) error
|
LegacyConnectionHandlerFunc = func(ctx context.Context, conn net.Conn, metadata InboundContext) error
|
||||||
// Deprecated
|
// Deprecated
|
||||||
PacketConnectionHandlerFunc = func(ctx context.Context, conn N.PacketConn, metadata InboundContext) error
|
LegacyPacketConnectionHandlerFunc = func(ctx context.Context, conn N.PacketConn, metadata InboundContext) error
|
||||||
)
|
)
|
||||||
|
|
||||||
// Deprecated
|
// Deprecated
|
||||||
//
|
//
|
||||||
//nolint:staticcheck
|
//nolint:staticcheck
|
||||||
func NewUpstreamHandler(
|
type LegacyUpstreamHandlerAdapter interface {
|
||||||
|
N.TCPConnectionHandler
|
||||||
|
N.UDPConnectionHandler
|
||||||
|
E.Handler
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated
|
||||||
|
//
|
||||||
|
//nolint:staticcheck
|
||||||
|
func NewLegacyUpstreamHandler(
|
||||||
metadata InboundContext,
|
metadata InboundContext,
|
||||||
connectionHandler ConnectionHandlerFunc,
|
connectionHandler LegacyConnectionHandlerFunc,
|
||||||
packetHandler PacketConnectionHandlerFunc,
|
packetHandler LegacyPacketConnectionHandlerFunc,
|
||||||
errorHandler E.Handler,
|
errorHandler E.Handler,
|
||||||
) UpstreamHandlerAdapter {
|
) LegacyUpstreamHandlerAdapter {
|
||||||
return &myUpstreamHandlerWrapper{
|
return &legacyUpstreamHandlerWrapper{
|
||||||
metadata: metadata,
|
metadata: metadata,
|
||||||
connectionHandler: connectionHandler,
|
connectionHandler: connectionHandler,
|
||||||
packetHandler: packetHandler,
|
packetHandler: packetHandler,
|
||||||
@@ -34,20 +43,20 @@ func NewUpstreamHandler(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ UpstreamHandlerAdapter = (*myUpstreamHandlerWrapper)(nil)
|
var _ LegacyUpstreamHandlerAdapter = (*legacyUpstreamHandlerWrapper)(nil)
|
||||||
|
|
||||||
// Deprecated: use myUpstreamHandlerWrapperEx instead.
|
// Deprecated: use NewUpstreamHandler instead.
|
||||||
//
|
//
|
||||||
//nolint:staticcheck
|
//nolint:staticcheck
|
||||||
type myUpstreamHandlerWrapper struct {
|
type legacyUpstreamHandlerWrapper struct {
|
||||||
metadata InboundContext
|
metadata InboundContext
|
||||||
connectionHandler ConnectionHandlerFunc
|
connectionHandler LegacyConnectionHandlerFunc
|
||||||
packetHandler PacketConnectionHandlerFunc
|
packetHandler LegacyPacketConnectionHandlerFunc
|
||||||
errorHandler E.Handler
|
errorHandler E.Handler
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: use myUpstreamHandlerWrapperEx instead.
|
// Deprecated: use NewUpstreamHandler instead.
|
||||||
func (w *myUpstreamHandlerWrapper) NewConnection(ctx context.Context, conn net.Conn, metadata M.Metadata) error {
|
func (w *legacyUpstreamHandlerWrapper) NewConnection(ctx context.Context, conn net.Conn, metadata M.Metadata) error {
|
||||||
myMetadata := w.metadata
|
myMetadata := w.metadata
|
||||||
if metadata.Source.IsValid() {
|
if metadata.Source.IsValid() {
|
||||||
myMetadata.Source = metadata.Source
|
myMetadata.Source = metadata.Source
|
||||||
@@ -58,8 +67,8 @@ func (w *myUpstreamHandlerWrapper) NewConnection(ctx context.Context, conn net.C
|
|||||||
return w.connectionHandler(ctx, conn, myMetadata)
|
return w.connectionHandler(ctx, conn, myMetadata)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: use myUpstreamHandlerWrapperEx instead.
|
// Deprecated: use NewUpstreamHandler instead.
|
||||||
func (w *myUpstreamHandlerWrapper) NewPacketConnection(ctx context.Context, conn N.PacketConn, metadata M.Metadata) error {
|
func (w *legacyUpstreamHandlerWrapper) NewPacketConnection(ctx context.Context, conn N.PacketConn, metadata M.Metadata) error {
|
||||||
myMetadata := w.metadata
|
myMetadata := w.metadata
|
||||||
if metadata.Source.IsValid() {
|
if metadata.Source.IsValid() {
|
||||||
myMetadata.Source = metadata.Source
|
myMetadata.Source = metadata.Source
|
||||||
@@ -70,41 +79,41 @@ func (w *myUpstreamHandlerWrapper) NewPacketConnection(ctx context.Context, conn
|
|||||||
return w.packetHandler(ctx, conn, myMetadata)
|
return w.packetHandler(ctx, conn, myMetadata)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: use myUpstreamHandlerWrapperEx instead.
|
// Deprecated: use NewUpstreamHandler instead.
|
||||||
func (w *myUpstreamHandlerWrapper) NewError(ctx context.Context, err error) {
|
func (w *legacyUpstreamHandlerWrapper) NewError(ctx context.Context, err error) {
|
||||||
w.errorHandler.NewError(ctx, err)
|
w.errorHandler.NewError(ctx, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: removed
|
// Deprecated: removed
|
||||||
func UpstreamMetadata(metadata InboundContext) M.Metadata {
|
func UpstreamMetadata(metadata InboundContext) M.Metadata {
|
||||||
return M.Metadata{
|
return M.Metadata{
|
||||||
Source: metadata.Source,
|
Source: metadata.Source.Unwrap(),
|
||||||
Destination: metadata.Destination,
|
Destination: metadata.Destination.Unwrap(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Use NewUpstreamContextHandlerEx instead.
|
// Deprecated: Use NewUpstreamContextHandler instead.
|
||||||
type myUpstreamContextHandlerWrapper struct {
|
type legacyUpstreamContextHandlerWrapper struct {
|
||||||
connectionHandler ConnectionHandlerFunc
|
connectionHandler LegacyConnectionHandlerFunc
|
||||||
packetHandler PacketConnectionHandlerFunc
|
packetHandler LegacyPacketConnectionHandlerFunc
|
||||||
errorHandler E.Handler
|
errorHandler E.Handler
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Use NewUpstreamContextHandlerEx instead.
|
// Deprecated: Use NewUpstreamContextHandler instead.
|
||||||
func NewUpstreamContextHandler(
|
func NewLegacyUpstreamContextHandler(
|
||||||
connectionHandler ConnectionHandlerFunc,
|
connectionHandler LegacyConnectionHandlerFunc,
|
||||||
packetHandler PacketConnectionHandlerFunc,
|
packetHandler LegacyPacketConnectionHandlerFunc,
|
||||||
errorHandler E.Handler,
|
errorHandler E.Handler,
|
||||||
) UpstreamHandlerAdapter {
|
) LegacyUpstreamHandlerAdapter {
|
||||||
return &myUpstreamContextHandlerWrapper{
|
return &legacyUpstreamContextHandlerWrapper{
|
||||||
connectionHandler: connectionHandler,
|
connectionHandler: connectionHandler,
|
||||||
packetHandler: packetHandler,
|
packetHandler: packetHandler,
|
||||||
errorHandler: errorHandler,
|
errorHandler: errorHandler,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Use NewUpstreamContextHandlerEx instead.
|
// Deprecated: Use NewUpstreamContextHandler instead.
|
||||||
func (w *myUpstreamContextHandlerWrapper) NewConnection(ctx context.Context, conn net.Conn, metadata M.Metadata) error {
|
func (w *legacyUpstreamContextHandlerWrapper) NewConnection(ctx context.Context, conn net.Conn, metadata M.Metadata) error {
|
||||||
myMetadata := ContextFrom(ctx)
|
myMetadata := ContextFrom(ctx)
|
||||||
if metadata.Source.IsValid() {
|
if metadata.Source.IsValid() {
|
||||||
myMetadata.Source = metadata.Source
|
myMetadata.Source = metadata.Source
|
||||||
@@ -115,8 +124,8 @@ func (w *myUpstreamContextHandlerWrapper) NewConnection(ctx context.Context, con
|
|||||||
return w.connectionHandler(ctx, conn, *myMetadata)
|
return w.connectionHandler(ctx, conn, *myMetadata)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Use NewUpstreamContextHandlerEx instead.
|
// Deprecated: Use NewUpstreamContextHandler instead.
|
||||||
func (w *myUpstreamContextHandlerWrapper) NewPacketConnection(ctx context.Context, conn N.PacketConn, metadata M.Metadata) error {
|
func (w *legacyUpstreamContextHandlerWrapper) NewPacketConnection(ctx context.Context, conn N.PacketConn, metadata M.Metadata) error {
|
||||||
myMetadata := ContextFrom(ctx)
|
myMetadata := ContextFrom(ctx)
|
||||||
if metadata.Source.IsValid() {
|
if metadata.Source.IsValid() {
|
||||||
myMetadata.Source = metadata.Source
|
myMetadata.Source = metadata.Source
|
||||||
@@ -127,18 +136,18 @@ func (w *myUpstreamContextHandlerWrapper) NewPacketConnection(ctx context.Contex
|
|||||||
return w.packetHandler(ctx, conn, *myMetadata)
|
return w.packetHandler(ctx, conn, *myMetadata)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Use NewUpstreamContextHandlerEx instead.
|
// Deprecated: Use NewUpstreamContextHandler instead.
|
||||||
func (w *myUpstreamContextHandlerWrapper) NewError(ctx context.Context, err error) {
|
func (w *legacyUpstreamContextHandlerWrapper) NewError(ctx context.Context, err error) {
|
||||||
w.errorHandler.NewError(ctx, err)
|
w.errorHandler.NewError(ctx, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Use ConnectionRouterEx instead.
|
// Deprecated: Use ConnectionRouterEx instead.
|
||||||
func NewRouteHandler(
|
func NewLegacyRouteHandler(
|
||||||
metadata InboundContext,
|
metadata InboundContext,
|
||||||
router ConnectionRouter,
|
router ConnectionRouter,
|
||||||
logger logger.ContextLogger,
|
logger logger.ContextLogger,
|
||||||
) UpstreamHandlerAdapter {
|
) LegacyUpstreamHandlerAdapter {
|
||||||
return &routeHandlerWrapper{
|
return &legacyRouteHandlerWrapper{
|
||||||
metadata: metadata,
|
metadata: metadata,
|
||||||
router: router,
|
router: router,
|
||||||
logger: logger,
|
logger: logger,
|
||||||
@@ -146,29 +155,29 @@ func NewRouteHandler(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Use ConnectionRouterEx instead.
|
// Deprecated: Use ConnectionRouterEx instead.
|
||||||
func NewRouteContextHandler(
|
func NewLegacyRouteContextHandler(
|
||||||
router ConnectionRouter,
|
router ConnectionRouter,
|
||||||
logger logger.ContextLogger,
|
logger logger.ContextLogger,
|
||||||
) UpstreamHandlerAdapter {
|
) LegacyUpstreamHandlerAdapter {
|
||||||
return &routeContextHandlerWrapper{
|
return &legacyRouteContextHandlerWrapper{
|
||||||
router: router,
|
router: router,
|
||||||
logger: logger,
|
logger: logger,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ UpstreamHandlerAdapter = (*routeHandlerWrapper)(nil)
|
var _ LegacyUpstreamHandlerAdapter = (*legacyRouteHandlerWrapper)(nil)
|
||||||
|
|
||||||
// Deprecated: Use ConnectionRouterEx instead.
|
// Deprecated: Use ConnectionRouterEx instead.
|
||||||
//
|
//
|
||||||
//nolint:staticcheck
|
//nolint:staticcheck
|
||||||
type routeHandlerWrapper struct {
|
type legacyRouteHandlerWrapper struct {
|
||||||
metadata InboundContext
|
metadata InboundContext
|
||||||
router ConnectionRouter
|
router ConnectionRouter
|
||||||
logger logger.ContextLogger
|
logger logger.ContextLogger
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Use ConnectionRouterEx instead.
|
// Deprecated: Use ConnectionRouterEx instead.
|
||||||
func (w *routeHandlerWrapper) NewConnection(ctx context.Context, conn net.Conn, metadata M.Metadata) error {
|
func (w *legacyRouteHandlerWrapper) NewConnection(ctx context.Context, conn net.Conn, metadata M.Metadata) error {
|
||||||
myMetadata := w.metadata
|
myMetadata := w.metadata
|
||||||
if metadata.Source.IsValid() {
|
if metadata.Source.IsValid() {
|
||||||
myMetadata.Source = metadata.Source
|
myMetadata.Source = metadata.Source
|
||||||
@@ -180,7 +189,7 @@ func (w *routeHandlerWrapper) NewConnection(ctx context.Context, conn net.Conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Use ConnectionRouterEx instead.
|
// Deprecated: Use ConnectionRouterEx instead.
|
||||||
func (w *routeHandlerWrapper) NewPacketConnection(ctx context.Context, conn N.PacketConn, metadata M.Metadata) error {
|
func (w *legacyRouteHandlerWrapper) NewPacketConnection(ctx context.Context, conn N.PacketConn, metadata M.Metadata) error {
|
||||||
myMetadata := w.metadata
|
myMetadata := w.metadata
|
||||||
if metadata.Source.IsValid() {
|
if metadata.Source.IsValid() {
|
||||||
myMetadata.Source = metadata.Source
|
myMetadata.Source = metadata.Source
|
||||||
@@ -192,20 +201,20 @@ func (w *routeHandlerWrapper) NewPacketConnection(ctx context.Context, conn N.Pa
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Use ConnectionRouterEx instead.
|
// Deprecated: Use ConnectionRouterEx instead.
|
||||||
func (w *routeHandlerWrapper) NewError(ctx context.Context, err error) {
|
func (w *legacyRouteHandlerWrapper) NewError(ctx context.Context, err error) {
|
||||||
w.logger.ErrorContext(ctx, err)
|
w.logger.ErrorContext(ctx, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ UpstreamHandlerAdapter = (*routeContextHandlerWrapper)(nil)
|
var _ LegacyUpstreamHandlerAdapter = (*legacyRouteContextHandlerWrapper)(nil)
|
||||||
|
|
||||||
// Deprecated: Use ConnectionRouterEx instead.
|
// Deprecated: Use ConnectionRouterEx instead.
|
||||||
type routeContextHandlerWrapper struct {
|
type legacyRouteContextHandlerWrapper struct {
|
||||||
router ConnectionRouter
|
router ConnectionRouter
|
||||||
logger logger.ContextLogger
|
logger logger.ContextLogger
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Use ConnectionRouterEx instead.
|
// Deprecated: Use ConnectionRouterEx instead.
|
||||||
func (w *routeContextHandlerWrapper) NewConnection(ctx context.Context, conn net.Conn, metadata M.Metadata) error {
|
func (w *legacyRouteContextHandlerWrapper) NewConnection(ctx context.Context, conn net.Conn, metadata M.Metadata) error {
|
||||||
myMetadata := ContextFrom(ctx)
|
myMetadata := ContextFrom(ctx)
|
||||||
if metadata.Source.IsValid() {
|
if metadata.Source.IsValid() {
|
||||||
myMetadata.Source = metadata.Source
|
myMetadata.Source = metadata.Source
|
||||||
@@ -217,7 +226,7 @@ func (w *routeContextHandlerWrapper) NewConnection(ctx context.Context, conn net
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Use ConnectionRouterEx instead.
|
// Deprecated: Use ConnectionRouterEx instead.
|
||||||
func (w *routeContextHandlerWrapper) NewPacketConnection(ctx context.Context, conn N.PacketConn, metadata M.Metadata) error {
|
func (w *legacyRouteContextHandlerWrapper) NewPacketConnection(ctx context.Context, conn N.PacketConn, metadata M.Metadata) error {
|
||||||
myMetadata := ContextFrom(ctx)
|
myMetadata := ContextFrom(ctx)
|
||||||
if metadata.Source.IsValid() {
|
if metadata.Source.IsValid() {
|
||||||
myMetadata.Source = metadata.Source
|
myMetadata.Source = metadata.Source
|
||||||
@@ -229,6 +238,6 @@ func (w *routeContextHandlerWrapper) NewPacketConnection(ctx context.Context, co
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Use ConnectionRouterEx instead.
|
// Deprecated: Use ConnectionRouterEx instead.
|
||||||
func (w *routeContextHandlerWrapper) NewError(ctx context.Context, err error) {
|
func (w *legacyRouteContextHandlerWrapper) NewError(ctx context.Context, err error) {
|
||||||
w.logger.ErrorContext(ctx, err)
|
w.logger.ErrorContext(ctx, err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
//go:build with_usbip && (linux || (darwin && cgo) || windows)
|
||||||
|
|
||||||
|
package adapter
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/sagernet/sing-usbip"
|
||||||
|
)
|
||||||
|
|
||||||
|
type USBIPDynamicServer interface {
|
||||||
|
AddDevice(info usbip.ProvidedDeviceInfo, transport usbip.DeviceTransport) (string, error)
|
||||||
|
RemoveDevice(busID string)
|
||||||
|
SubscribeDevices(ctx context.Context, listener func([]usbip.ControlDeviceInfo))
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
//go:build !with_usbip || !(linux || (darwin && cgo) || windows)
|
||||||
|
|
||||||
|
package adapter
|
||||||
|
|
||||||
|
type USBIPDynamicServer interface {
|
||||||
|
usbipNotIncluded()
|
||||||
|
}
|
||||||
@@ -4,25 +4,31 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/sagernet/sing-box/adapter"
|
"github.com/sagernet/sing-box/adapter"
|
||||||
|
boxCertificate "github.com/sagernet/sing-box/adapter/certificate"
|
||||||
"github.com/sagernet/sing-box/adapter/endpoint"
|
"github.com/sagernet/sing-box/adapter/endpoint"
|
||||||
"github.com/sagernet/sing-box/adapter/inbound"
|
"github.com/sagernet/sing-box/adapter/inbound"
|
||||||
"github.com/sagernet/sing-box/adapter/outbound"
|
"github.com/sagernet/sing-box/adapter/outbound"
|
||||||
|
"github.com/sagernet/sing-box/adapter/provider"
|
||||||
boxService "github.com/sagernet/sing-box/adapter/service"
|
boxService "github.com/sagernet/sing-box/adapter/service"
|
||||||
"github.com/sagernet/sing-box/common/certificate"
|
"github.com/sagernet/sing-box/common/certificate"
|
||||||
"github.com/sagernet/sing-box/common/dialer"
|
"github.com/sagernet/sing-box/common/dialer"
|
||||||
|
"github.com/sagernet/sing-box/common/httpclient"
|
||||||
|
"github.com/sagernet/sing-box/common/netns"
|
||||||
"github.com/sagernet/sing-box/common/taskmonitor"
|
"github.com/sagernet/sing-box/common/taskmonitor"
|
||||||
"github.com/sagernet/sing-box/common/tls"
|
"github.com/sagernet/sing-box/common/tls"
|
||||||
|
"github.com/sagernet/sing-box/common/trafficcontrol"
|
||||||
|
"github.com/sagernet/sing-box/common/urltest"
|
||||||
C "github.com/sagernet/sing-box/constant"
|
C "github.com/sagernet/sing-box/constant"
|
||||||
"github.com/sagernet/sing-box/dns"
|
"github.com/sagernet/sing-box/dns"
|
||||||
"github.com/sagernet/sing-box/dns/transport/local"
|
|
||||||
"github.com/sagernet/sing-box/experimental"
|
"github.com/sagernet/sing-box/experimental"
|
||||||
"github.com/sagernet/sing-box/experimental/cachefile"
|
"github.com/sagernet/sing-box/experimental/cachefile"
|
||||||
"github.com/sagernet/sing-box/experimental/libbox/platform"
|
"github.com/sagernet/sing-box/experimental/deprecated"
|
||||||
"github.com/sagernet/sing-box/log"
|
"github.com/sagernet/sing-box/log"
|
||||||
"github.com/sagernet/sing-box/option"
|
"github.com/sagernet/sing-box/option"
|
||||||
"github.com/sagernet/sing-box/protocol/direct"
|
"github.com/sagernet/sing-box/protocol/direct"
|
||||||
@@ -38,26 +44,33 @@ import (
|
|||||||
var _ adapter.SimpleLifecycle = (*Box)(nil)
|
var _ adapter.SimpleLifecycle = (*Box)(nil)
|
||||||
|
|
||||||
type Box struct {
|
type Box struct {
|
||||||
createdAt time.Time
|
ctx context.Context
|
||||||
logFactory log.Factory
|
createdAt time.Time
|
||||||
logger log.ContextLogger
|
debugOptions option.DebugOptions
|
||||||
network *route.NetworkManager
|
debugHTTPServer *http.Server
|
||||||
endpoint *endpoint.Manager
|
logFactory log.Factory
|
||||||
inbound *inbound.Manager
|
logger log.ContextLogger
|
||||||
outbound *outbound.Manager
|
network *route.NetworkManager
|
||||||
service *boxService.Manager
|
endpoint *endpoint.Manager
|
||||||
dnsTransport *dns.TransportManager
|
inbound *inbound.Manager
|
||||||
dnsRouter *dns.Router
|
outbound *outbound.Manager
|
||||||
connection *route.ConnectionManager
|
provider *provider.Manager
|
||||||
router *route.Router
|
service *boxService.Manager
|
||||||
internalService []adapter.LifecycleService
|
certificateProvider *boxCertificate.Manager
|
||||||
done chan struct{}
|
dnsTransport *dns.TransportManager
|
||||||
|
dnsRouter *dns.Router
|
||||||
|
connection *route.ConnectionManager
|
||||||
|
router *route.Router
|
||||||
|
httpClientService adapter.LifecycleService
|
||||||
|
internalService []adapter.LifecycleService
|
||||||
|
done chan struct{}
|
||||||
}
|
}
|
||||||
|
|
||||||
type Options struct {
|
type Options struct {
|
||||||
option.Options
|
option.Options
|
||||||
Context context.Context
|
Context context.Context
|
||||||
PlatformLogWriter log.PlatformWriter
|
PlatformLogWriter log.PlatformWriter
|
||||||
|
NetworkNamespaceHolderArgs []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func Context(
|
func Context(
|
||||||
@@ -65,8 +78,10 @@ func Context(
|
|||||||
inboundRegistry adapter.InboundRegistry,
|
inboundRegistry adapter.InboundRegistry,
|
||||||
outboundRegistry adapter.OutboundRegistry,
|
outboundRegistry adapter.OutboundRegistry,
|
||||||
endpointRegistry adapter.EndpointRegistry,
|
endpointRegistry adapter.EndpointRegistry,
|
||||||
|
providerRegistry adapter.ProviderRegistry,
|
||||||
dnsTransportRegistry adapter.DNSTransportRegistry,
|
dnsTransportRegistry adapter.DNSTransportRegistry,
|
||||||
serviceRegistry adapter.ServiceRegistry,
|
serviceRegistry adapter.ServiceRegistry,
|
||||||
|
certificateProviderRegistry adapter.CertificateProviderRegistry,
|
||||||
) context.Context {
|
) context.Context {
|
||||||
if service.FromContext[option.InboundOptionsRegistry](ctx) == nil ||
|
if service.FromContext[option.InboundOptionsRegistry](ctx) == nil ||
|
||||||
service.FromContext[adapter.InboundRegistry](ctx) == nil {
|
service.FromContext[adapter.InboundRegistry](ctx) == nil {
|
||||||
@@ -83,6 +98,11 @@ func Context(
|
|||||||
ctx = service.ContextWith[option.EndpointOptionsRegistry](ctx, endpointRegistry)
|
ctx = service.ContextWith[option.EndpointOptionsRegistry](ctx, endpointRegistry)
|
||||||
ctx = service.ContextWith[adapter.EndpointRegistry](ctx, endpointRegistry)
|
ctx = service.ContextWith[adapter.EndpointRegistry](ctx, endpointRegistry)
|
||||||
}
|
}
|
||||||
|
if service.FromContext[option.ProviderOptionsRegistry](ctx) == nil ||
|
||||||
|
service.FromContext[adapter.ProviderRegistry](ctx) == nil {
|
||||||
|
ctx = service.ContextWith[option.ProviderOptionsRegistry](ctx, providerRegistry)
|
||||||
|
ctx = service.ContextWith[adapter.ProviderRegistry](ctx, providerRegistry)
|
||||||
|
}
|
||||||
if service.FromContext[adapter.DNSTransportRegistry](ctx) == nil {
|
if service.FromContext[adapter.DNSTransportRegistry](ctx) == nil {
|
||||||
ctx = service.ContextWith[option.DNSTransportOptionsRegistry](ctx, dnsTransportRegistry)
|
ctx = service.ContextWith[option.DNSTransportOptionsRegistry](ctx, dnsTransportRegistry)
|
||||||
ctx = service.ContextWith[adapter.DNSTransportRegistry](ctx, dnsTransportRegistry)
|
ctx = service.ContextWith[adapter.DNSTransportRegistry](ctx, dnsTransportRegistry)
|
||||||
@@ -91,6 +111,10 @@ func Context(
|
|||||||
ctx = service.ContextWith[option.ServiceOptionsRegistry](ctx, serviceRegistry)
|
ctx = service.ContextWith[option.ServiceOptionsRegistry](ctx, serviceRegistry)
|
||||||
ctx = service.ContextWith[adapter.ServiceRegistry](ctx, serviceRegistry)
|
ctx = service.ContextWith[adapter.ServiceRegistry](ctx, serviceRegistry)
|
||||||
}
|
}
|
||||||
|
if service.FromContext[adapter.CertificateProviderRegistry](ctx) == nil {
|
||||||
|
ctx = service.ContextWith[option.CertificateProviderOptionsRegistry](ctx, certificateProviderRegistry)
|
||||||
|
ctx = service.ContextWith[adapter.CertificateProviderRegistry](ctx, certificateProviderRegistry)
|
||||||
|
}
|
||||||
return ctx
|
return ctx
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,8 +129,10 @@ func New(options Options) (*Box, error) {
|
|||||||
endpointRegistry := service.FromContext[adapter.EndpointRegistry](ctx)
|
endpointRegistry := service.FromContext[adapter.EndpointRegistry](ctx)
|
||||||
inboundRegistry := service.FromContext[adapter.InboundRegistry](ctx)
|
inboundRegistry := service.FromContext[adapter.InboundRegistry](ctx)
|
||||||
outboundRegistry := service.FromContext[adapter.OutboundRegistry](ctx)
|
outboundRegistry := service.FromContext[adapter.OutboundRegistry](ctx)
|
||||||
|
providerRegistry := service.FromContext[adapter.ProviderRegistry](ctx)
|
||||||
dnsTransportRegistry := service.FromContext[adapter.DNSTransportRegistry](ctx)
|
dnsTransportRegistry := service.FromContext[adapter.DNSTransportRegistry](ctx)
|
||||||
serviceRegistry := service.FromContext[adapter.ServiceRegistry](ctx)
|
serviceRegistry := service.FromContext[adapter.ServiceRegistry](ctx)
|
||||||
|
certificateProviderRegistry := service.FromContext[adapter.CertificateProviderRegistry](ctx)
|
||||||
|
|
||||||
if endpointRegistry == nil {
|
if endpointRegistry == nil {
|
||||||
return nil, E.New("missing endpoint registry in context")
|
return nil, E.New("missing endpoint registry in context")
|
||||||
@@ -117,16 +143,26 @@ func New(options Options) (*Box, error) {
|
|||||||
if outboundRegistry == nil {
|
if outboundRegistry == nil {
|
||||||
return nil, E.New("missing outbound registry in context")
|
return nil, E.New("missing outbound registry in context")
|
||||||
}
|
}
|
||||||
|
if providerRegistry == nil {
|
||||||
|
return nil, E.New("missing provider registry in context")
|
||||||
|
}
|
||||||
if dnsTransportRegistry == nil {
|
if dnsTransportRegistry == nil {
|
||||||
return nil, E.New("missing DNS transport registry in context")
|
return nil, E.New("missing DNS transport registry in context")
|
||||||
}
|
}
|
||||||
if serviceRegistry == nil {
|
if serviceRegistry == nil {
|
||||||
return nil, E.New("missing service registry in context")
|
return nil, E.New("missing service registry in context")
|
||||||
}
|
}
|
||||||
|
if certificateProviderRegistry == nil {
|
||||||
|
return nil, E.New("missing certificate provider registry in context")
|
||||||
|
}
|
||||||
|
|
||||||
ctx = pause.WithDefaultManager(ctx)
|
ctx = pause.WithDefaultManager(ctx)
|
||||||
experimentalOptions := common.PtrValueOrDefault(options.Experimental)
|
experimentalOptions := common.PtrValueOrDefault(options.Experimental)
|
||||||
applyDebugOptions(common.PtrValueOrDefault(experimentalOptions.Debug))
|
debugOptions := common.PtrValueOrDefault(experimentalOptions.Debug)
|
||||||
|
err := checkDebugOptions(debugOptions)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
var needCacheFile bool
|
var needCacheFile bool
|
||||||
var needClashAPI bool
|
var needClashAPI bool
|
||||||
var needV2RayAPI bool
|
var needV2RayAPI bool
|
||||||
@@ -139,7 +175,16 @@ func New(options Options) (*Box, error) {
|
|||||||
if experimentalOptions.V2RayAPI != nil && experimentalOptions.V2RayAPI.Listen != "" {
|
if experimentalOptions.V2RayAPI != nil && experimentalOptions.V2RayAPI.Listen != "" {
|
||||||
needV2RayAPI = true
|
needV2RayAPI = true
|
||||||
}
|
}
|
||||||
platformInterface := service.FromContext[platform.Interface](ctx)
|
if experimentalOptions.UnifiedDelay != nil && experimentalOptions.UnifiedDelay.Enabled {
|
||||||
|
ctx = urltest.ContextWithIsUnifiedDelay(ctx)
|
||||||
|
}
|
||||||
|
needAPIService := common.Any(options.Services, func(it option.Service) bool {
|
||||||
|
return it.Type == C.TypeAPI
|
||||||
|
})
|
||||||
|
if service.PtrFromContext[urltest.HistoryStorage](ctx) == nil {
|
||||||
|
ctx = service.ContextWithPtr(ctx, urltest.NewHistoryStorage())
|
||||||
|
}
|
||||||
|
platformInterface := service.FromContext[adapter.PlatformInterface](ctx)
|
||||||
var defaultLogWriter io.Writer
|
var defaultLogWriter io.Writer
|
||||||
if platformInterface != nil {
|
if platformInterface != nil {
|
||||||
defaultLogWriter = io.Discard
|
defaultLogWriter = io.Discard
|
||||||
@@ -147,7 +192,7 @@ func New(options Options) (*Box, error) {
|
|||||||
logFactory, err := log.New(log.Options{
|
logFactory, err := log.New(log.Options{
|
||||||
Context: ctx,
|
Context: ctx,
|
||||||
Options: common.PtrValueOrDefault(options.Log),
|
Options: common.PtrValueOrDefault(options.Log),
|
||||||
Observable: needClashAPI,
|
Observable: needClashAPI || needAPIService,
|
||||||
DefaultWriter: defaultLogWriter,
|
DefaultWriter: defaultLogWriter,
|
||||||
BaseTime: createdAt,
|
BaseTime: createdAt,
|
||||||
PlatformWriter: options.PlatformLogWriter,
|
PlatformWriter: options.PlatformLogWriter,
|
||||||
@@ -155,8 +200,10 @@ func New(options Options) (*Box, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, E.Cause(err, "create log factory")
|
return nil, E.Cause(err, "create log factory")
|
||||||
}
|
}
|
||||||
|
service.MustRegister[log.Factory](ctx, logFactory)
|
||||||
|
|
||||||
var internalServices []adapter.LifecycleService
|
var internalServices []adapter.LifecycleService
|
||||||
|
routeOptions := common.PtrValueOrDefault(options.Route)
|
||||||
certificateOptions := common.PtrValueOrDefault(options.Certificate)
|
certificateOptions := common.PtrValueOrDefault(options.Certificate)
|
||||||
if C.IsAndroid || certificateOptions.Store != "" && certificateOptions.Store != C.CertificateStoreSystem ||
|
if C.IsAndroid || certificateOptions.Store != "" && certificateOptions.Store != C.CertificateStoreSystem ||
|
||||||
len(certificateOptions.Certificate) > 0 ||
|
len(certificateOptions.Certificate) > 0 ||
|
||||||
@@ -169,34 +216,56 @@ func New(options Options) (*Box, error) {
|
|||||||
service.MustRegister[adapter.CertificateStore](ctx, certificateStore)
|
service.MustRegister[adapter.CertificateStore](ctx, certificateStore)
|
||||||
internalServices = append(internalServices, certificateStore)
|
internalServices = append(internalServices, certificateStore)
|
||||||
}
|
}
|
||||||
|
netnsManager, err := netns.NewManager(logFactory.NewLogger("netns"), options.NetworkNamespaces, options.NetworkNamespaceHolderArgs)
|
||||||
routeOptions := common.PtrValueOrDefault(options.Route)
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
service.MustRegister[adapter.NetworkNamespaceManager](ctx, netnsManager)
|
||||||
|
internalServices = append(internalServices, netnsManager)
|
||||||
dnsOptions := common.PtrValueOrDefault(options.DNS)
|
dnsOptions := common.PtrValueOrDefault(options.DNS)
|
||||||
endpointManager := endpoint.NewManager(logFactory.NewLogger("endpoint"), endpointRegistry)
|
endpointManager := endpoint.NewManager(logFactory.NewLogger("endpoint"), endpointRegistry)
|
||||||
inboundManager := inbound.NewManager(logFactory.NewLogger("inbound"), inboundRegistry, endpointManager)
|
inboundManager := inbound.NewManager(logFactory.NewLogger("inbound"), inboundRegistry, endpointManager)
|
||||||
outboundManager := outbound.NewManager(logFactory.NewLogger("outbound"), outboundRegistry, endpointManager, routeOptions.Final)
|
outboundManager := outbound.NewManager(logFactory.NewLogger("outbound"), outboundRegistry, endpointManager, routeOptions.Final)
|
||||||
|
providerManager := provider.NewManager(logFactory.NewLogger("provider"), providerRegistry)
|
||||||
dnsTransportManager := dns.NewTransportManager(logFactory.NewLogger("dns/transport"), dnsTransportRegistry, outboundManager, dnsOptions.Final)
|
dnsTransportManager := dns.NewTransportManager(logFactory.NewLogger("dns/transport"), dnsTransportRegistry, outboundManager, dnsOptions.Final)
|
||||||
serviceManager := boxService.NewManager(logFactory.NewLogger("service"), serviceRegistry)
|
serviceManager := boxService.NewManager(logFactory.NewLogger("service"), serviceRegistry)
|
||||||
|
certificateProviderManager := boxCertificate.NewManager(logFactory.NewLogger("certificate-provider"), certificateProviderRegistry)
|
||||||
service.MustRegister[adapter.EndpointManager](ctx, endpointManager)
|
service.MustRegister[adapter.EndpointManager](ctx, endpointManager)
|
||||||
service.MustRegister[adapter.InboundManager](ctx, inboundManager)
|
service.MustRegister[adapter.InboundManager](ctx, inboundManager)
|
||||||
service.MustRegister[adapter.OutboundManager](ctx, outboundManager)
|
service.MustRegister[adapter.OutboundManager](ctx, outboundManager)
|
||||||
|
service.MustRegister[adapter.ProviderManager](ctx, providerManager)
|
||||||
service.MustRegister[adapter.DNSTransportManager](ctx, dnsTransportManager)
|
service.MustRegister[adapter.DNSTransportManager](ctx, dnsTransportManager)
|
||||||
service.MustRegister[adapter.ServiceManager](ctx, serviceManager)
|
service.MustRegister[adapter.ServiceManager](ctx, serviceManager)
|
||||||
dnsRouter := dns.NewRouter(ctx, logFactory, dnsOptions)
|
service.MustRegister[adapter.CertificateProviderManager](ctx, certificateProviderManager)
|
||||||
|
dnsRouter, err := dns.NewRouter(ctx, logFactory, dnsOptions)
|
||||||
|
if err != nil {
|
||||||
|
return nil, E.Cause(err, "initialize DNS router")
|
||||||
|
}
|
||||||
service.MustRegister[adapter.DNSRouter](ctx, dnsRouter)
|
service.MustRegister[adapter.DNSRouter](ctx, dnsRouter)
|
||||||
networkManager, err := route.NewNetworkManager(ctx, logFactory.NewLogger("network"), routeOptions)
|
service.MustRegister[adapter.DNSRuleSetUpdateValidator](ctx, dnsRouter)
|
||||||
|
networkManager, err := route.NewNetworkManager(ctx, logFactory.NewLogger("network"), routeOptions, dnsOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, E.Cause(err, "initialize network manager")
|
return nil, E.Cause(err, "initialize network manager")
|
||||||
}
|
}
|
||||||
service.MustRegister[adapter.NetworkManager](ctx, networkManager)
|
service.MustRegister[adapter.NetworkManager](ctx, networkManager)
|
||||||
connectionManager := route.NewConnectionManager(logFactory.NewLogger("connection"))
|
connectionManager := route.NewConnectionManager(logFactory.NewLogger("connection"))
|
||||||
service.MustRegister[adapter.ConnectionManager](ctx, connectionManager)
|
service.MustRegister[adapter.ConnectionManager](ctx, connectionManager)
|
||||||
router := route.NewRouter(ctx, logFactory, routeOptions, dnsOptions)
|
// Must register after ConnectionManager: the Apple HTTP engine's proxy bridge reads it from the context when Manager.Start resolves the default client.
|
||||||
|
httpClientManager := httpclient.NewManager(ctx, logFactory.NewLogger("httpclient"), options.HTTPClients, routeOptions.DefaultHTTPClient)
|
||||||
|
service.MustRegister[adapter.HTTPClientManager](ctx, httpClientManager)
|
||||||
|
httpClientService := adapter.LifecycleService(httpClientManager)
|
||||||
|
router := route.NewRouter(ctx, logFactory, "router", routeOptions, dnsOptions)
|
||||||
service.MustRegister[adapter.Router](ctx, router)
|
service.MustRegister[adapter.Router](ctx, router)
|
||||||
err = router.Initialize(routeOptions.Rules, routeOptions.RuleSet)
|
err = router.Initialize(routeOptions.Rules, routeOptions.RuleSet)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, E.Cause(err, "initialize router")
|
return nil, E.Cause(err, "initialize router")
|
||||||
}
|
}
|
||||||
|
if needClashAPI || needAPIService {
|
||||||
|
trafficManager := trafficcontrol.NewManager(outboundManager)
|
||||||
|
service.MustRegisterPtr(ctx, trafficManager)
|
||||||
|
router.AppendTracker(trafficManager)
|
||||||
|
internalServices = append(internalServices, trafficManager)
|
||||||
|
}
|
||||||
ntpOptions := common.PtrValueOrDefault(options.NTP)
|
ntpOptions := common.PtrValueOrDefault(options.NTP)
|
||||||
var timeService *tls.TimeServiceWrapper
|
var timeService *tls.TimeServiceWrapper
|
||||||
if ntpOptions.Enabled {
|
if ntpOptions.Enabled {
|
||||||
@@ -270,6 +339,28 @@ func New(options Options) (*Box, error) {
|
|||||||
return nil, E.Cause(err, "initialize inbound[", i, "]")
|
return nil, E.Cause(err, "initialize inbound[", i, "]")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
options.Outbounds = append(options.Outbounds, option.Outbound{
|
||||||
|
Tag: "Compatible",
|
||||||
|
Type: C.TypeDirect,
|
||||||
|
})
|
||||||
|
for i, serviceOptions := range options.Services {
|
||||||
|
var tag string
|
||||||
|
if serviceOptions.Tag != "" {
|
||||||
|
tag = serviceOptions.Tag
|
||||||
|
} else {
|
||||||
|
tag = F.ToString(i)
|
||||||
|
}
|
||||||
|
err = serviceManager.Create(
|
||||||
|
ctx,
|
||||||
|
logFactory.NewLogger(F.ToString("service/", serviceOptions.Type, "[", tag, "]")),
|
||||||
|
tag,
|
||||||
|
serviceOptions.Type,
|
||||||
|
serviceOptions.Options,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return nil, E.Cause(err, "initialize service[", i, "]")
|
||||||
|
}
|
||||||
|
}
|
||||||
for i, outboundOptions := range options.Outbounds {
|
for i, outboundOptions := range options.Outbounds {
|
||||||
var tag string
|
var tag string
|
||||||
if outboundOptions.Tag != "" {
|
if outboundOptions.Tag != "" {
|
||||||
@@ -296,40 +387,67 @@ func New(options Options) (*Box, error) {
|
|||||||
return nil, E.Cause(err, "initialize outbound[", i, "]")
|
return nil, E.Cause(err, "initialize outbound[", i, "]")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for i, serviceOptions := range options.Services {
|
for i, providerOptions := range options.Providers {
|
||||||
var tag string
|
var tag string
|
||||||
if serviceOptions.Tag != "" {
|
if providerOptions.Tag != "" {
|
||||||
tag = serviceOptions.Tag
|
tag = providerOptions.Tag
|
||||||
} else {
|
} else {
|
||||||
tag = F.ToString(i)
|
tag = F.ToString(i)
|
||||||
}
|
}
|
||||||
err = serviceManager.Create(
|
err = providerManager.Create(
|
||||||
ctx,
|
ctx,
|
||||||
logFactory.NewLogger(F.ToString("service/", serviceOptions.Type, "[", tag, "]")),
|
router,
|
||||||
|
logFactory,
|
||||||
tag,
|
tag,
|
||||||
serviceOptions.Type,
|
providerOptions.Type,
|
||||||
serviceOptions.Options,
|
providerOptions.Options,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, E.Cause(err, "initialize service[", i, "]")
|
return nil, E.Cause(err, "initialize provider[", i, "]")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
outboundManager.Initialize(common.Must1(
|
for i, certificateProviderOptions := range options.CertificateProviders {
|
||||||
direct.NewOutbound(
|
var tag string
|
||||||
|
if certificateProviderOptions.Tag != "" {
|
||||||
|
tag = certificateProviderOptions.Tag
|
||||||
|
} else {
|
||||||
|
tag = F.ToString(i)
|
||||||
|
}
|
||||||
|
err = certificateProviderManager.Create(
|
||||||
|
ctx,
|
||||||
|
logFactory.NewLogger(F.ToString("certificate-provider/", certificateProviderOptions.Type, "[", tag, "]")),
|
||||||
|
tag,
|
||||||
|
certificateProviderOptions.Type,
|
||||||
|
certificateProviderOptions.Options,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return nil, E.Cause(err, "initialize certificate provider[", i, "]")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
outboundManager.Initialize(func() (adapter.Outbound, error) {
|
||||||
|
return direct.NewOutbound(
|
||||||
ctx,
|
ctx,
|
||||||
router,
|
router,
|
||||||
logFactory.NewLogger("outbound/direct"),
|
logFactory.NewLogger("outbound/direct"),
|
||||||
"direct",
|
"direct",
|
||||||
option.DirectOutboundOptions{},
|
option.DirectOutboundOptions{},
|
||||||
),
|
)
|
||||||
))
|
})
|
||||||
dnsTransportManager.Initialize(common.Must1(
|
dnsTransportManager.Initialize(func() (adapter.DNSTransport, error) {
|
||||||
local.NewTransport(
|
return dnsTransportRegistry.CreateDNSTransport(
|
||||||
ctx,
|
ctx,
|
||||||
logFactory.NewLogger("dns/local"),
|
logFactory.NewLogger("dns/local"),
|
||||||
"local",
|
"local",
|
||||||
option.LocalDNSServerOptions{},
|
C.DNSTypeLocal,
|
||||||
)))
|
&option.LocalDNSServerOptions{},
|
||||||
|
)
|
||||||
|
})
|
||||||
|
httpClientManager.Initialize(func() (*httpclient.ManagedTransport, error) {
|
||||||
|
deprecated.Report(ctx, deprecated.OptionImplicitDefaultHTTPClient)
|
||||||
|
var httpClientOptions option.HTTPClientOptions
|
||||||
|
httpClientOptions.DefaultOutbound = true
|
||||||
|
return httpclient.NewTransport(ctx, logFactory.NewLogger("httpclient"), "", httpClientOptions)
|
||||||
|
})
|
||||||
if platformInterface != nil {
|
if platformInterface != nil {
|
||||||
err = platformInterface.Initialize(networkManager)
|
err = platformInterface.Initialize(networkManager)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -337,7 +455,7 @@ func New(options Options) (*Box, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if needCacheFile {
|
if needCacheFile {
|
||||||
cacheFile := cachefile.New(ctx, common.PtrValueOrDefault(experimentalOptions.CacheFile))
|
cacheFile := cachefile.New(ctx, logFactory.NewLogger("cache-file"), common.PtrValueOrDefault(experimentalOptions.CacheFile))
|
||||||
service.MustRegister[adapter.CacheFile](ctx, cacheFile)
|
service.MustRegister[adapter.CacheFile](ctx, cacheFile)
|
||||||
internalServices = append(internalServices, cacheFile)
|
internalServices = append(internalServices, cacheFile)
|
||||||
}
|
}
|
||||||
@@ -348,7 +466,6 @@ func New(options Options) (*Box, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, E.Cause(err, "create clash-server")
|
return nil, E.Cause(err, "create clash-server")
|
||||||
}
|
}
|
||||||
router.AppendTracker(clashServer)
|
|
||||||
service.MustRegister[adapter.ClashServer](ctx, clashServer)
|
service.MustRegister[adapter.ClashServer](ctx, clashServer)
|
||||||
internalServices = append(internalServices, clashServer)
|
internalServices = append(internalServices, clashServer)
|
||||||
}
|
}
|
||||||
@@ -364,6 +481,12 @@ func New(options Options) (*Box, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ntpOptions.Enabled {
|
if ntpOptions.Enabled {
|
||||||
|
if ntpOptions.WriteToSystem {
|
||||||
|
err = adapter.CheckSecurityFeature(ctx, "NTP `write_to_system`")
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
ntpDialer, err := dialer.New(ctx, ntpOptions.DialerOptions, ntpOptions.ServerIsDomain())
|
ntpDialer, err := dialer.New(ctx, ntpOptions.DialerOptions, ntpOptions.ServerIsDomain())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, E.Cause(err, "create NTP service")
|
return nil, E.Cause(err, "create NTP service")
|
||||||
@@ -380,20 +503,25 @@ func New(options Options) (*Box, error) {
|
|||||||
internalServices = append(internalServices, adapter.NewLifecycleService(ntpService, "ntp service"))
|
internalServices = append(internalServices, adapter.NewLifecycleService(ntpService, "ntp service"))
|
||||||
}
|
}
|
||||||
return &Box{
|
return &Box{
|
||||||
network: networkManager,
|
ctx: ctx,
|
||||||
endpoint: endpointManager,
|
network: networkManager,
|
||||||
inbound: inboundManager,
|
endpoint: endpointManager,
|
||||||
outbound: outboundManager,
|
inbound: inboundManager,
|
||||||
dnsTransport: dnsTransportManager,
|
outbound: outboundManager,
|
||||||
service: serviceManager,
|
provider: providerManager,
|
||||||
dnsRouter: dnsRouter,
|
dnsTransport: dnsTransportManager,
|
||||||
connection: connectionManager,
|
service: serviceManager,
|
||||||
router: router,
|
certificateProvider: certificateProviderManager,
|
||||||
createdAt: createdAt,
|
dnsRouter: dnsRouter,
|
||||||
logFactory: logFactory,
|
connection: connectionManager,
|
||||||
logger: logFactory.Logger(),
|
router: router,
|
||||||
internalService: internalServices,
|
httpClientService: httpClientService,
|
||||||
done: make(chan struct{}),
|
createdAt: createdAt,
|
||||||
|
debugOptions: debugOptions,
|
||||||
|
logFactory: logFactory,
|
||||||
|
logger: logFactory.Logger(),
|
||||||
|
internalService: internalServices,
|
||||||
|
done: make(chan struct{}),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -412,7 +540,7 @@ func (s *Box) PreStart() error {
|
|||||||
s.Close()
|
s.Close()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
s.logger.Info("sing-box pre-started (", F.Seconds(time.Since(s.createdAt).Seconds()), "s)")
|
s.logger.Notice("sing-box pre-started (", F.Seconds(time.Since(s.createdAt).Seconds()), "s)")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -431,7 +559,7 @@ func (s *Box) Start() error {
|
|||||||
s.Close()
|
s.Close()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
s.logger.Info("sing-box started (", F.Seconds(time.Since(s.createdAt).Seconds()), "s)")
|
s.logger.Notice("sing-box started (", F.Seconds(time.Since(s.createdAt).Seconds()), "s)")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -443,15 +571,28 @@ func (s *Box) preStart() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return E.Cause(err, "start logger")
|
return E.Cause(err, "start logger")
|
||||||
}
|
}
|
||||||
err = adapter.StartNamed(adapter.StartStateInitialize, s.internalService) // cache-file clash-api v2ray-api
|
applyDebugOptions(s.debugOptions)
|
||||||
|
s.debugHTTPServer, err = startDebugHTTPServer(s.debugOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = adapter.Start(adapter.StartStateInitialize, s.network, s.dnsTransport, s.dnsRouter, s.connection, s.router, s.outbound, s.inbound, s.endpoint, s.service)
|
err = adapter.StartNamed(s.ctx, s.logger, adapter.StartStateInitialize, s.internalService) // cache-file clash-api v2ray-api
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = adapter.Start(adapter.StartStateStart, s.outbound, s.dnsTransport, s.dnsRouter, s.network, s.connection, s.router)
|
err = adapter.Start(s.ctx, s.logger, adapter.StartStateInitialize, s.network, s.dnsTransport, s.dnsRouter, s.connection, s.router, s.outbound, s.provider, s.inbound, s.endpoint, s.service, s.certificateProvider)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = adapter.Start(s.ctx, s.logger, adapter.StartStateStart, s.outbound, s.provider, s.dnsTransport, s.network, s.connection)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = adapter.StartNamed(s.ctx, s.logger, adapter.StartStateStart, []adapter.LifecycleService{s.httpClientService})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = adapter.Start(s.ctx, s.logger, adapter.StartStateStart, s.router, s.dnsRouter)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -463,27 +604,35 @@ func (s *Box) start() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = adapter.StartNamed(adapter.StartStateStart, s.internalService)
|
err = adapter.StartNamed(s.ctx, s.logger, adapter.StartStateStart, s.internalService)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = adapter.Start(adapter.StartStateStart, s.inbound, s.endpoint, s.service)
|
err = adapter.Start(s.ctx, s.logger, adapter.StartStateStart, s.endpoint)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = adapter.Start(adapter.StartStatePostStart, s.outbound, s.network, s.dnsTransport, s.dnsRouter, s.connection, s.router, s.inbound, s.endpoint, s.service)
|
err = adapter.Start(s.ctx, s.logger, adapter.StartStateStart, s.certificateProvider)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = adapter.StartNamed(adapter.StartStatePostStart, s.internalService)
|
err = adapter.Start(s.ctx, s.logger, adapter.StartStateStart, s.inbound, s.service)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = adapter.Start(adapter.StartStateStarted, s.network, s.dnsTransport, s.dnsRouter, s.connection, s.router, s.outbound, s.inbound, s.endpoint, s.service)
|
err = adapter.Start(s.ctx, s.logger, adapter.StartStatePostStart, s.outbound, s.provider, s.network, s.dnsTransport, s.dnsRouter, s.connection, s.router, s.endpoint, s.certificateProvider, s.inbound, s.service)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = adapter.StartNamed(adapter.StartStateStarted, s.internalService)
|
err = adapter.StartNamed(s.ctx, s.logger, adapter.StartStatePostStart, s.internalService)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = adapter.Start(s.ctx, s.logger, adapter.StartStateStarted, s.network, s.dnsTransport, s.dnsRouter, s.connection, s.router, s.outbound, s.provider, s.endpoint, s.certificateProvider, s.inbound, s.service)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = adapter.StartNamed(s.ctx, s.logger, adapter.StartStateStarted, s.internalService)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -497,17 +646,55 @@ func (s *Box) Close() error {
|
|||||||
default:
|
default:
|
||||||
close(s.done)
|
close(s.done)
|
||||||
}
|
}
|
||||||
err := common.Close(
|
var err error
|
||||||
s.inbound, s.outbound, s.endpoint, s.router, s.connection, s.dnsRouter, s.dnsTransport, s.network,
|
if s.debugHTTPServer != nil {
|
||||||
)
|
err = E.Append(err, s.debugHTTPServer.Close(), func(err error) error {
|
||||||
|
return E.Cause(err, "close debug HTTP server")
|
||||||
|
})
|
||||||
|
s.debugHTTPServer = nil
|
||||||
|
}
|
||||||
|
for _, closeItem := range []struct {
|
||||||
|
name string
|
||||||
|
service adapter.Lifecycle
|
||||||
|
}{
|
||||||
|
{"service", s.service},
|
||||||
|
{"inbound", s.inbound},
|
||||||
|
{"certificate-provider", s.certificateProvider},
|
||||||
|
{"provider", s.provider},
|
||||||
|
{"endpoint", s.endpoint},
|
||||||
|
{"outbound", s.outbound},
|
||||||
|
{"router", s.router},
|
||||||
|
{"connection", s.connection},
|
||||||
|
{"dns-router", s.dnsRouter},
|
||||||
|
{"dns-transport", s.dnsTransport},
|
||||||
|
{"network", s.network},
|
||||||
|
} {
|
||||||
|
done := adapter.LogElapsed(s.logger, "close ", closeItem.name)
|
||||||
|
err = E.Append(err, closeItem.service.Close(), func(err error) error {
|
||||||
|
return E.Cause(err, "close ", closeItem.name)
|
||||||
|
})
|
||||||
|
done()
|
||||||
|
}
|
||||||
|
if s.httpClientService != nil {
|
||||||
|
s.logger.Trace("close ", s.httpClientService.Name())
|
||||||
|
startTime := time.Now()
|
||||||
|
err = E.Append(err, s.httpClientService.Close(), func(err error) error {
|
||||||
|
return E.Cause(err, "close ", s.httpClientService.Name())
|
||||||
|
})
|
||||||
|
s.logger.Trace("close ", s.httpClientService.Name(), " completed (", F.Seconds(time.Since(startTime).Seconds()), "s)")
|
||||||
|
}
|
||||||
for _, lifecycleService := range s.internalService {
|
for _, lifecycleService := range s.internalService {
|
||||||
|
done := adapter.LogElapsed(s.logger, "close ", lifecycleService.Name())
|
||||||
err = E.Append(err, lifecycleService.Close(), func(err error) error {
|
err = E.Append(err, lifecycleService.Close(), func(err error) error {
|
||||||
return E.Cause(err, "close ", lifecycleService.Name())
|
return E.Cause(err, "close ", lifecycleService.Name())
|
||||||
})
|
})
|
||||||
|
done()
|
||||||
}
|
}
|
||||||
|
done := adapter.LogElapsed(s.logger, "close logger")
|
||||||
err = E.Append(err, s.logFactory.Close(), func(err error) error {
|
err = E.Append(err, s.logFactory.Close(), func(err error) error {
|
||||||
return E.Cause(err, "close logger")
|
return E.Cause(err, "close logger")
|
||||||
})
|
})
|
||||||
|
done()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -526,3 +713,11 @@ func (s *Box) Inbound() adapter.InboundManager {
|
|||||||
func (s *Box) Outbound() adapter.OutboundManager {
|
func (s *Box) Outbound() adapter.OutboundManager {
|
||||||
return s.outbound
|
return s.outbound
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Box) Endpoint() adapter.EndpointManager {
|
||||||
|
return s.endpoint
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Box) LogFactory() log.Factory {
|
||||||
|
return s.logFactory
|
||||||
|
}
|
||||||
|
|||||||
+1
-1
Submodule clients/android updated: cec05bf693...eb87216961
+1
-1
Submodule clients/apple updated: ae5818ee5a...c19945f65b
Submodule
+1
Submodule clients/desktop added at cebee0d527
@@ -0,0 +1,194 @@
|
|||||||
|
// Command admin_panel_pack post-processes a directory of built SPA
|
||||||
|
// assets so it can be served straight from the Go binary via //go:embed.
|
||||||
|
// It does *not* generate any Go source any more — that responsibility
|
||||||
|
// moved to the embed directive in service/admin_panel/service.go.
|
||||||
|
//
|
||||||
|
// Three transformations happen here, all in-place inside the supplied
|
||||||
|
// directory:
|
||||||
|
//
|
||||||
|
// 1. Legacy WOFF (1.0) fallback fonts are deleted. Every browser made
|
||||||
|
// after 2014 reads WOFF2 natively, so shipping both formats roughly
|
||||||
|
// doubles the embedded font payload for no real-world benefit. The
|
||||||
|
// matching `,url(*.woff) format("woff")` segments are stripped from
|
||||||
|
// the bundled CSS in step (2) so the @font-face rules don't reference
|
||||||
|
// files that aren't shipped.
|
||||||
|
// 2. Bundled CSS is rewritten to drop those WOFF URL fragments.
|
||||||
|
// 3. Compressible text assets (.html, .css, .js, .svg, .json, .map) are
|
||||||
|
// pre-gzipped as companion `*.gz` files. The HTTP handler then either
|
||||||
|
// passes those bytes through verbatim with Content-Encoding: gzip or
|
||||||
|
// falls back to the raw file for the rare client that does not
|
||||||
|
// advertise gzip support — no on-line compression, no surprises.
|
||||||
|
// Already-compressed formats (.woff2, fonts, images) are skipped: gzip
|
||||||
|
// can't shrink them and the duplicate would only inflate the binary.
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"compress/gzip"
|
||||||
|
"flag"
|
||||||
|
"fmt"
|
||||||
|
"io/fs"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"regexp"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
dir := flag.String("dir", "service/admin_panel/dist", "directory of built SPA assets to post-process in place")
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
woffDropped, err := pruneWoff(*dir)
|
||||||
|
if err != nil {
|
||||||
|
fail("prune woff: %v", err)
|
||||||
|
}
|
||||||
|
cssRewritten, err := rewriteCSS(*dir)
|
||||||
|
if err != nil {
|
||||||
|
fail("rewrite css: %v", err)
|
||||||
|
}
|
||||||
|
stats, err := gzipText(*dir)
|
||||||
|
if err != nil {
|
||||||
|
fail("gzip text: %v", err)
|
||||||
|
}
|
||||||
|
fmt.Fprintf(os.Stderr, "post-processed %s: dropped %d woff, rewrote %d css, gzipped %d files (%d→%d bytes)\n",
|
||||||
|
*dir, woffDropped, cssRewritten, stats.gzipped, stats.totalRaw, stats.totalGz)
|
||||||
|
}
|
||||||
|
|
||||||
|
// pruneWoff deletes every legacy *.woff (WOFF 1.0) font under dir. The
|
||||||
|
// bundled CSS still references them on entry; rewriteCSS drops those
|
||||||
|
// references in a separate pass so the two operations stay independently
|
||||||
|
// testable.
|
||||||
|
func pruneWoff(dir string) (int, error) {
|
||||||
|
var n int
|
||||||
|
err := filepath.WalkDir(dir, func(p string, d fs.DirEntry, walkErr error) error {
|
||||||
|
if walkErr != nil {
|
||||||
|
return walkErr
|
||||||
|
}
|
||||||
|
if d.IsDir() || !strings.EqualFold(filepath.Ext(p), ".woff") {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if err := os.Remove(p); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
n++
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
return n, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// woffRefAfterRE / woffRefBeforeRE match a single WOFF 1.0 entry inside a
|
||||||
|
// Vite-bundled CSS `src:` declaration. Vite minifies the rule to
|
||||||
|
// `src:url(./X.woff2) format("woff2"),url(./X.woff) format("woff");` so the
|
||||||
|
// "after" regex (the common case) eats the *leading* comma + woff entry,
|
||||||
|
// leaving only the woff2 source. We also handle the rare reverse ordering
|
||||||
|
// in a second pass.
|
||||||
|
var (
|
||||||
|
woffRefAfterRE = regexp.MustCompile(`,\s*url\([^)]*\.woff\)\s*format\(["']woff["']\)`)
|
||||||
|
woffRefBeforeRE = regexp.MustCompile(`url\([^)]*\.woff\)\s*format\(["']woff["']\)\s*,\s*`)
|
||||||
|
)
|
||||||
|
|
||||||
|
// rewriteCSS drops every reference to a *.woff URL from every *.css file
|
||||||
|
// under dir. Pairs naturally with pruneWoff: after both passes, no font
|
||||||
|
// URL in the bundle points at a file that isn't shipped.
|
||||||
|
func rewriteCSS(dir string) (int, error) {
|
||||||
|
var n int
|
||||||
|
err := filepath.WalkDir(dir, func(p string, d fs.DirEntry, walkErr error) error {
|
||||||
|
if walkErr != nil {
|
||||||
|
return walkErr
|
||||||
|
}
|
||||||
|
if d.IsDir() || !strings.EqualFold(filepath.Ext(p), ".css") {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
data, err := os.ReadFile(p)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
out := woffRefAfterRE.ReplaceAll(data, nil)
|
||||||
|
out = woffRefBeforeRE.ReplaceAll(out, nil)
|
||||||
|
if bytes.Equal(out, data) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if err := os.WriteFile(p, out, 0o644); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
n++
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
return n, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// gzipExts is the set of file extensions for which a `.gz` companion is
|
||||||
|
// generated. Anything not on this list is left alone — woff2/png/jpeg/etc.
|
||||||
|
// are already compressed, so gzip can only inflate them slightly while
|
||||||
|
// doubling the embedded payload.
|
||||||
|
var gzipExts = map[string]bool{
|
||||||
|
".html": true,
|
||||||
|
".css": true,
|
||||||
|
".js": true,
|
||||||
|
".mjs": true,
|
||||||
|
".svg": true,
|
||||||
|
".json": true,
|
||||||
|
".map": true,
|
||||||
|
".txt": true,
|
||||||
|
".xml": true,
|
||||||
|
".wasm": true,
|
||||||
|
}
|
||||||
|
|
||||||
|
type gzipStats struct {
|
||||||
|
gzipped int
|
||||||
|
totalRaw int64
|
||||||
|
totalGz int64
|
||||||
|
}
|
||||||
|
|
||||||
|
// gzipText produces a `<file>.gz` companion next to every text-like asset
|
||||||
|
// in dir, using gzip.BestCompression. The companion is dropped if the
|
||||||
|
// compressed bytes don't save at least 10 % over the raw file — same
|
||||||
|
// heuristic we used in the previous (Go-source-emitting) generation, just
|
||||||
|
// applied to disk files now.
|
||||||
|
func gzipText(dir string) (gzipStats, error) {
|
||||||
|
var stats gzipStats
|
||||||
|
err := filepath.WalkDir(dir, func(p string, d fs.DirEntry, walkErr error) error {
|
||||||
|
if walkErr != nil {
|
||||||
|
return walkErr
|
||||||
|
}
|
||||||
|
if d.IsDir() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
ext := strings.ToLower(filepath.Ext(p))
|
||||||
|
if ext == ".gz" || !gzipExts[ext] {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
raw, err := os.ReadFile(p)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var buf bytes.Buffer
|
||||||
|
w, err := gzip.NewWriterLevel(&buf, gzip.BestCompression)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
// Reproducible: no mtime, no OS marker.
|
||||||
|
w.ModTime = time.Time{}
|
||||||
|
w.OS = 0xff
|
||||||
|
if _, err := w.Write(raw); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := w.Close(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if buf.Len() > len(raw)*9/10 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
stats.gzipped++
|
||||||
|
stats.totalRaw += int64(len(raw))
|
||||||
|
stats.totalGz += int64(buf.Len())
|
||||||
|
return os.WriteFile(p+".gz", buf.Bytes(), 0o644)
|
||||||
|
})
|
||||||
|
return stats, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func fail(format string, args ...any) {
|
||||||
|
fmt.Fprintf(os.Stderr, "admin_panel_pack: "+format+"\n", args...)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
@@ -19,8 +19,11 @@ import (
|
|||||||
func main() {
|
func main() {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
switch os.Args[1] {
|
switch os.Args[1] {
|
||||||
case "next_macos_project_version":
|
case "next_project_version":
|
||||||
err := fetchMacOSVersion(ctx)
|
if len(os.Args) < 3 {
|
||||||
|
log.Fatal("platform required: ios, macos, or tvos")
|
||||||
|
}
|
||||||
|
err := fetchNextProjectVersion(ctx, os.Args[2])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -50,8 +53,8 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
appID = "6673731168"
|
appID = "6785326793"
|
||||||
groupID = "5c5f3b78-b7a0-40c0-bcad-e6ef87bbefda"
|
groupID = "39f9ebdc-05d4-421f-9595-dae71df227c4"
|
||||||
)
|
)
|
||||||
|
|
||||||
func createClient(expireDuration time.Duration) *asc.Client {
|
func createClient(expireDuration time.Duration) *asc.Client {
|
||||||
@@ -66,46 +69,80 @@ func createClient(expireDuration time.Duration) *asc.Client {
|
|||||||
return asc.NewClient(tokenConfig.Client())
|
return asc.NewClient(tokenConfig.Client())
|
||||||
}
|
}
|
||||||
|
|
||||||
func fetchMacOSVersion(ctx context.Context) error {
|
func fetchNextProjectVersion(ctx context.Context, platformName string) error {
|
||||||
|
var platform asc.Platform
|
||||||
|
switch platformName {
|
||||||
|
case "ios":
|
||||||
|
platform = asc.PlatformIOS
|
||||||
|
case "macos":
|
||||||
|
platform = asc.PlatformMACOS
|
||||||
|
case "tvos":
|
||||||
|
platform = asc.PlatformTVOS
|
||||||
|
default:
|
||||||
|
return E.New("unknown platform: ", platformName)
|
||||||
|
}
|
||||||
|
|
||||||
|
query := &asc.ListBuildsQuery{
|
||||||
|
FilterApp: []string{appID},
|
||||||
|
FilterPreReleaseVersionPlatform: []string{string(platform)},
|
||||||
|
Limit: 200,
|
||||||
|
}
|
||||||
|
if platform != asc.PlatformMACOS {
|
||||||
|
tagVersion, err := build_shared.ReadTagVersion()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
query.FilterPreReleaseVersionVersion = []string{build_shared.TestFlightVersion(tagVersion)}
|
||||||
|
}
|
||||||
|
|
||||||
client := createClient(time.Minute)
|
client := createClient(time.Minute)
|
||||||
versions, _, err := client.Apps.ListAppStoreVersionsForApp(ctx, appID, &asc.ListAppStoreVersionsQuery{
|
builds, _, err := client.Builds.ListBuilds(ctx, query)
|
||||||
FilterPlatform: []string{"MAC_OS"},
|
|
||||||
})
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
var versionID string
|
nextProjectVersion := 1
|
||||||
findVersion:
|
var projectVersion int
|
||||||
for _, version := range versions.Data {
|
for _, build := range builds.Data {
|
||||||
switch *version.Attributes.AppStoreState {
|
projectVersion, err = strconv.Atoi(*build.Attributes.Version)
|
||||||
case asc.AppStoreVersionStateReadyForSale,
|
if err != nil {
|
||||||
asc.AppStoreVersionStatePendingDeveloperRelease:
|
return E.Cause(err, "parse version code")
|
||||||
versionID = version.ID
|
}
|
||||||
break findVersion
|
if projectVersion >= nextProjectVersion {
|
||||||
|
nextProjectVersion = projectVersion + 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if versionID == "" {
|
os.Stdout.WriteString(F.ToString(nextProjectVersion, "\n"))
|
||||||
return E.New("no version found")
|
|
||||||
}
|
|
||||||
latestBuild, _, err := client.Builds.GetBuildForAppStoreVersion(ctx, versionID, &asc.GetBuildForAppStoreVersionQuery{})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
versionInt, err := strconv.Atoi(*latestBuild.Data.Attributes.Version)
|
|
||||||
if err != nil {
|
|
||||||
return E.Cause(err, "parse version code")
|
|
||||||
}
|
|
||||||
os.Stdout.WriteString(F.ToString(versionInt+1, "\n"))
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func publishTestflight(ctx context.Context) error {
|
func publishTestflight(ctx context.Context) error {
|
||||||
|
if len(os.Args) < 3 {
|
||||||
|
return E.New("platform required: ios, macos, or tvos")
|
||||||
|
}
|
||||||
|
var platform asc.Platform
|
||||||
|
switch os.Args[2] {
|
||||||
|
case "ios":
|
||||||
|
platform = asc.PlatformIOS
|
||||||
|
case "macos":
|
||||||
|
platform = asc.PlatformMACOS
|
||||||
|
case "tvos":
|
||||||
|
platform = asc.PlatformTVOS
|
||||||
|
default:
|
||||||
|
return E.New("unknown platform: ", os.Args[2])
|
||||||
|
}
|
||||||
|
|
||||||
tagVersion, err := build_shared.ReadTagVersion()
|
tagVersion, err := build_shared.ReadTagVersion()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
tag := tagVersion.VersionString()
|
tag := tagVersion.VersionString()
|
||||||
client := createClient(10 * time.Minute)
|
|
||||||
|
releaseNotes := F.ToString("sing-box ", tagVersion.String())
|
||||||
|
if len(os.Args) >= 4 {
|
||||||
|
releaseNotes = strings.Join(os.Args[3:], " ")
|
||||||
|
}
|
||||||
|
|
||||||
|
client := createClient(20 * time.Minute)
|
||||||
|
|
||||||
log.Info(tag, " list build IDs")
|
log.Info(tag, " list build IDs")
|
||||||
buildIDsResponse, _, err := client.TestFlight.ListBuildIDsForBetaGroup(ctx, groupID, nil)
|
buildIDsResponse, _, err := client.TestFlight.ListBuildIDsForBetaGroup(ctx, groupID, nil)
|
||||||
@@ -115,95 +152,76 @@ func publishTestflight(ctx context.Context) error {
|
|||||||
buildIDs := common.Map(buildIDsResponse.Data, func(it asc.RelationshipData) string {
|
buildIDs := common.Map(buildIDsResponse.Data, func(it asc.RelationshipData) string {
|
||||||
return it.ID
|
return it.ID
|
||||||
})
|
})
|
||||||
var platforms []asc.Platform
|
|
||||||
if len(os.Args) == 3 {
|
waitingForProcess := false
|
||||||
switch os.Args[2] {
|
log.Info(string(platform), " list builds")
|
||||||
case "ios":
|
for {
|
||||||
platforms = []asc.Platform{asc.PlatformIOS}
|
builds, _, err := client.Builds.ListBuilds(ctx, &asc.ListBuildsQuery{
|
||||||
case "macos":
|
FilterApp: []string{appID},
|
||||||
platforms = []asc.Platform{asc.PlatformMACOS}
|
FilterPreReleaseVersionPlatform: []string{string(platform)},
|
||||||
case "tvos":
|
})
|
||||||
platforms = []asc.Platform{asc.PlatformTVOS}
|
if err != nil {
|
||||||
default:
|
return err
|
||||||
return E.New("unknown platform: ", os.Args[2])
|
|
||||||
}
|
}
|
||||||
} else {
|
build := builds.Data[0]
|
||||||
platforms = []asc.Platform{
|
log.Info(string(platform), " ", tag, " found build: ", build.ID, " (", *build.Attributes.Version, ")")
|
||||||
asc.PlatformIOS,
|
if !waitingForProcess && (common.Contains(buildIDs, build.ID) || time.Since(build.Attributes.UploadedDate.Time) > 30*time.Minute) {
|
||||||
asc.PlatformMACOS,
|
log.Info(string(platform), " ", tag, " waiting for process")
|
||||||
asc.PlatformTVOS,
|
time.Sleep(15 * time.Second)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
}
|
if *build.Attributes.ProcessingState != "VALID" {
|
||||||
for _, platform := range platforms {
|
waitingForProcess = true
|
||||||
log.Info(string(platform), " list builds")
|
log.Info(string(platform), " ", tag, " waiting for process: ", *build.Attributes.ProcessingState)
|
||||||
for {
|
time.Sleep(15 * time.Second)
|
||||||
builds, _, err := client.Builds.ListBuilds(ctx, &asc.ListBuildsQuery{
|
continue
|
||||||
FilterApp: []string{appID},
|
}
|
||||||
FilterPreReleaseVersionPlatform: []string{string(platform)},
|
log.Info(string(platform), " ", tag, " list localizations")
|
||||||
})
|
localizations, _, err := client.TestFlight.ListBetaBuildLocalizationsForBuild(ctx, build.ID, nil)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
localization := common.Find(localizations.Data, func(it asc.BetaBuildLocalization) bool {
|
||||||
|
return *it.Attributes.Locale == "en-US"
|
||||||
|
})
|
||||||
|
if localization.ID == "" {
|
||||||
|
log.Fatal(string(platform), " ", tag, " no en-US localization found")
|
||||||
|
}
|
||||||
|
if localization.Attributes == nil || localization.Attributes.WhatsNew == nil || *localization.Attributes.WhatsNew == "" {
|
||||||
|
log.Info(string(platform), " ", tag, " update localization")
|
||||||
|
_, _, err = client.TestFlight.UpdateBetaBuildLocalization(ctx, localization.ID, common.Ptr(releaseNotes))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
build := builds.Data[0]
|
}
|
||||||
if common.Contains(buildIDs, build.ID) || time.Since(build.Attributes.UploadedDate.Time) > 5*time.Minute {
|
log.Info(string(platform), " ", tag, " publish")
|
||||||
log.Info(string(platform), " ", tag, " waiting for process")
|
response, err := client.TestFlight.AddBuildsToBetaGroup(ctx, groupID, []string{build.ID})
|
||||||
time.Sleep(15 * time.Second)
|
if response != nil && (response.StatusCode == http.StatusUnprocessableEntity || response.StatusCode == http.StatusNotFound) {
|
||||||
continue
|
log.Info("waiting for process")
|
||||||
}
|
time.Sleep(15 * time.Second)
|
||||||
if *build.Attributes.ProcessingState != "VALID" {
|
continue
|
||||||
log.Info(string(platform), " ", tag, " waiting for process: ", *build.Attributes.ProcessingState)
|
} else if err != nil {
|
||||||
time.Sleep(15 * time.Second)
|
return err
|
||||||
continue
|
}
|
||||||
}
|
log.Info(string(platform), " ", tag, " list submissions")
|
||||||
log.Info(string(platform), " ", tag, " list localizations")
|
betaSubmissions, _, err := client.TestFlight.ListBetaAppReviewSubmissions(ctx, &asc.ListBetaAppReviewSubmissionsQuery{
|
||||||
localizations, _, err := client.TestFlight.ListBetaBuildLocalizationsForBuild(ctx, build.ID, nil)
|
FilterBuild: []string{build.ID},
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if len(betaSubmissions.Data) == 0 {
|
||||||
|
log.Info(string(platform), " ", tag, " create submission")
|
||||||
|
_, _, err = client.TestFlight.CreateBetaAppReviewSubmission(ctx, build.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
if strings.Contains(err.Error(), "ANOTHER_BUILD_IN_REVIEW") {
|
||||||
}
|
log.Error(err)
|
||||||
localization := common.Find(localizations.Data, func(it asc.BetaBuildLocalization) bool {
|
break
|
||||||
return *it.Attributes.Locale == "en-US"
|
|
||||||
})
|
|
||||||
if localization.ID == "" {
|
|
||||||
log.Fatal(string(platform), " ", tag, " no en-US localization found")
|
|
||||||
}
|
|
||||||
if localization.Attributes == nil || localization.Attributes.WhatsNew == nil || *localization.Attributes.WhatsNew == "" {
|
|
||||||
log.Info(string(platform), " ", tag, " update localization")
|
|
||||||
_, _, err = client.TestFlight.UpdateBetaBuildLocalization(ctx, localization.ID, common.Ptr(
|
|
||||||
F.ToString("sing-box ", tagVersion.String()),
|
|
||||||
))
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
log.Info(string(platform), " ", tag, " publish")
|
|
||||||
response, err := client.TestFlight.AddBuildsToBetaGroup(ctx, groupID, []string{build.ID})
|
|
||||||
if response != nil && response.StatusCode == http.StatusUnprocessableEntity {
|
|
||||||
log.Info("waiting for process")
|
|
||||||
time.Sleep(15 * time.Second)
|
|
||||||
continue
|
|
||||||
} else if err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
log.Info(string(platform), " ", tag, " list submissions")
|
|
||||||
betaSubmissions, _, err := client.TestFlight.ListBetaAppReviewSubmissions(ctx, &asc.ListBetaAppReviewSubmissionsQuery{
|
|
||||||
FilterBuild: []string{build.ID},
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if len(betaSubmissions.Data) == 0 {
|
|
||||||
log.Info(string(platform), " ", tag, " create submission")
|
|
||||||
_, _, err = client.TestFlight.CreateBetaAppReviewSubmission(ctx, build.ID)
|
|
||||||
if err != nil {
|
|
||||||
if strings.Contains(err.Error(), "ANOTHER_BUILD_IN_REVIEW") {
|
|
||||||
log.Error(err)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
|
break
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -287,7 +305,7 @@ func prepareAppStore(ctx context.Context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if len(builds.Data) == 0 {
|
if len(builds.Data) == 0 {
|
||||||
log.Fatal(platform, " ", tag, " no build found")
|
log.Fatal(string(platform), " ", tag, " no build found")
|
||||||
}
|
}
|
||||||
buildID := common.Ptr(builds.Data[0].ID)
|
buildID := common.Ptr(builds.Data[0].ID)
|
||||||
if version.ID == "" {
|
if version.ID == "" {
|
||||||
|
|||||||
@@ -0,0 +1,236 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"crypto/sha256"
|
||||||
|
"encoding/hex"
|
||||||
|
"flag"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
|
"slices"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/sagernet/sing-box/cmd/internal/build_shared"
|
||||||
|
"github.com/sagernet/sing-box/common/windivert"
|
||||||
|
"github.com/sagernet/sing-box/log"
|
||||||
|
"github.com/sagernet/sing-usbip/driverassets"
|
||||||
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
debugEnabled bool
|
||||||
|
outputPath string
|
||||||
|
target string
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
flag.BoolVar(&debugEnabled, "debug", false, "enable debug")
|
||||||
|
flag.StringVar(&outputPath, "output", "", "output path")
|
||||||
|
flag.StringVar(&target, "target", runtime.GOOS+"/"+runtime.GOARCH, "target platform")
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
flag.Parse()
|
||||||
|
err := build()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func build() error {
|
||||||
|
targetParts := strings.Split(target, "/")
|
||||||
|
if len(targetParts) != 2 || targetParts[0] == "" || targetParts[1] == "" {
|
||||||
|
return E.New("invalid target: ", target)
|
||||||
|
}
|
||||||
|
operatingSystem := targetParts[0]
|
||||||
|
architecture := targetParts[1]
|
||||||
|
if outputPath == "" {
|
||||||
|
outputPath = "sing-box-daemon"
|
||||||
|
if operatingSystem == "windows" {
|
||||||
|
outputPath += ".exe"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
absoluteOutputPath, err := filepath.Abs(outputPath)
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, "resolve output path")
|
||||||
|
}
|
||||||
|
err = os.MkdirAll(filepath.Dir(absoluteOutputPath), 0o755)
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, "create output directory")
|
||||||
|
}
|
||||||
|
version, err := build_shared.ReadTag()
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, "read version")
|
||||||
|
}
|
||||||
|
cgoEnabled := operatingSystem != "windows" && os.Getenv("CC") != ""
|
||||||
|
tags, err := buildTags(operatingSystem, architecture, cgoEnabled)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
arguments := []string{
|
||||||
|
"build",
|
||||||
|
"-v",
|
||||||
|
"-trimpath",
|
||||||
|
"-buildvcs=false",
|
||||||
|
"-tags", strings.Join(tags, ","),
|
||||||
|
"-ldflags", build_shared.LinkerFlags(version, debugEnabled),
|
||||||
|
"-o", absoluteOutputPath,
|
||||||
|
}
|
||||||
|
if operatingSystem == "windows" && architecture == "386" {
|
||||||
|
arguments = append(arguments, "-gcflags=net=-l")
|
||||||
|
}
|
||||||
|
arguments = append(arguments, "./experimental/boxdd")
|
||||||
|
command := exec.Command("go", arguments...)
|
||||||
|
cgoEnabledValue := "0"
|
||||||
|
if cgoEnabled {
|
||||||
|
cgoEnabledValue = "1"
|
||||||
|
}
|
||||||
|
command.Env = append(os.Environ(),
|
||||||
|
"CGO_ENABLED="+cgoEnabledValue,
|
||||||
|
"GOOS="+operatingSystem,
|
||||||
|
"GOARCH="+architecture,
|
||||||
|
"GOTOOLCHAIN=local",
|
||||||
|
)
|
||||||
|
command.Stdout = os.Stdout
|
||||||
|
command.Stderr = os.Stderr
|
||||||
|
err = command.Run()
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, "build sing-box daemon")
|
||||||
|
}
|
||||||
|
if operatingSystem == "windows" {
|
||||||
|
err = stageWinDivertDriver(architecture, filepath.Dir(absoluteOutputPath))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = stageUSBIPDrivers(architecture, filepath.Dir(absoluteOutputPath))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func stageUSBIPDrivers(architecture string, outputDirectory string) error {
|
||||||
|
driverPackages := []struct {
|
||||||
|
assets map[string]driverassets.Package
|
||||||
|
assetDir string
|
||||||
|
}{
|
||||||
|
{driverassets.VBoxUSB, filepath.Join("internal", "vboxusb", "assets")},
|
||||||
|
{driverassets.VHCI, filepath.Join("internal", "usbipvhci", "assets")},
|
||||||
|
}
|
||||||
|
var moduleDirectory string
|
||||||
|
for _, driverPackage := range driverPackages {
|
||||||
|
staged := driverPackage.assets[architecture]
|
||||||
|
for _, architecturePackage := range driverPackage.assets {
|
||||||
|
for _, file := range architecturePackage.Files {
|
||||||
|
if slices.ContainsFunc(staged.Files, func(stagedFile driverassets.File) bool {
|
||||||
|
return stagedFile.Name == file.Name
|
||||||
|
}) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
err := os.Remove(filepath.Join(outputDirectory, file.Name))
|
||||||
|
if err != nil && !os.IsNotExist(err) {
|
||||||
|
return E.Cause(err, "remove stale ", file.Name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(staged.Files) == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if moduleDirectory == "" {
|
||||||
|
listOutput, err := exec.Command("go", "list", "-m", "-f", "{{.Dir}}", "github.com/sagernet/sing-usbip").Output()
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, "locate sing-usbip module directory")
|
||||||
|
}
|
||||||
|
moduleDirectory = strings.TrimSpace(string(listOutput))
|
||||||
|
}
|
||||||
|
for _, file := range staged.Files {
|
||||||
|
content, err := os.ReadFile(filepath.Join(moduleDirectory, driverPackage.assetDir, architecture, file.Name))
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, "read ", file.Name)
|
||||||
|
}
|
||||||
|
checksum := sha256.Sum256(content)
|
||||||
|
if hex.EncodeToString(checksum[:]) != file.SHA256 {
|
||||||
|
return E.New(file.Name, " does not match the digest declared in sing-usbip/driverassets")
|
||||||
|
}
|
||||||
|
targetPath := filepath.Join(outputDirectory, file.Name)
|
||||||
|
stagedContent, err := os.ReadFile(targetPath)
|
||||||
|
if err == nil && bytes.Equal(stagedContent, content) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
err = os.WriteFile(targetPath, content, 0o644)
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, "write ", file.Name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func stageWinDivertDriver(architecture string, outputDirectory string) error {
|
||||||
|
var assetName, assetDigest string
|
||||||
|
switch architecture {
|
||||||
|
case "amd64":
|
||||||
|
assetName, assetDigest = windivert.Asset64Name, windivert.Asset64SHA256
|
||||||
|
case "386":
|
||||||
|
assetName, assetDigest = windivert.Asset32Name, windivert.Asset32SHA256
|
||||||
|
}
|
||||||
|
for _, name := range []string{windivert.Asset64Name, windivert.Asset32Name} {
|
||||||
|
if name == assetName {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
err := os.Remove(filepath.Join(outputDirectory, name))
|
||||||
|
if err != nil && !os.IsNotExist(err) {
|
||||||
|
return E.Cause(err, "remove stale ", name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if assetName == "" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
assetDirectory := filepath.Join("common", "windivert", "assets")
|
||||||
|
content, err := os.ReadFile(filepath.Join(assetDirectory, assetName))
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, "read ", assetName)
|
||||||
|
}
|
||||||
|
checksum := sha256.Sum256(content)
|
||||||
|
if hex.EncodeToString(checksum[:]) != assetDigest {
|
||||||
|
return E.New(assetName, " does not match the digest declared in common/windivert")
|
||||||
|
}
|
||||||
|
targetPath := filepath.Join(outputDirectory, assetName)
|
||||||
|
staged, err := os.ReadFile(targetPath)
|
||||||
|
if err == nil && bytes.Equal(staged, content) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
err = os.WriteFile(targetPath, content, 0o644)
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, "write ", assetName)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func buildTags(operatingSystem string, architecture string, cgoEnabled bool) ([]string, error) {
|
||||||
|
tagsFile := "release/DEFAULT_BUILD_TAGS"
|
||||||
|
if operatingSystem == "windows" {
|
||||||
|
if architecture == "386" {
|
||||||
|
tagsFile = "release/DEFAULT_BUILD_TAGS_OTHERS"
|
||||||
|
} else {
|
||||||
|
tagsFile = "release/DEFAULT_BUILD_TAGS_WINDOWS"
|
||||||
|
}
|
||||||
|
} else if !cgoEnabled {
|
||||||
|
tagsFile = "release/DEFAULT_BUILD_TAGS_OTHERS"
|
||||||
|
}
|
||||||
|
content, err := os.ReadFile(tagsFile)
|
||||||
|
if err != nil {
|
||||||
|
return nil, E.Cause(err, "read build tags")
|
||||||
|
}
|
||||||
|
tags := strings.Split(strings.TrimSpace(string(content)), ",")
|
||||||
|
if operatingSystem == "windows" {
|
||||||
|
tags = append(tags, "with_external_windivert", "with_external_usbip_drivers")
|
||||||
|
}
|
||||||
|
if debugEnabled {
|
||||||
|
tags = append(tags, "debug")
|
||||||
|
}
|
||||||
|
return tags, nil
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
_ "github.com/sagernet/gomobile"
|
_ "github.com/sagernet/gomobile"
|
||||||
@@ -19,12 +20,14 @@ var (
|
|||||||
debugEnabled bool
|
debugEnabled bool
|
||||||
target string
|
target string
|
||||||
platform string
|
platform string
|
||||||
|
// withTailscale bool
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
flag.BoolVar(&debugEnabled, "debug", false, "enable debug")
|
flag.BoolVar(&debugEnabled, "debug", false, "enable debug")
|
||||||
flag.StringVar(&target, "target", "android", "target platform")
|
flag.StringVar(&target, "target", "android", "target platform")
|
||||||
flag.StringVar(&platform, "platform", "", "specify platform")
|
flag.StringVar(&platform, "platform", "", "specify platform")
|
||||||
|
// flag.BoolVar(&withTailscale, "with-tailscale", false, "build tailscale for iOS and tvOS")
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -44,8 +47,9 @@ var (
|
|||||||
sharedFlags []string
|
sharedFlags []string
|
||||||
debugFlags []string
|
debugFlags []string
|
||||||
sharedTags []string
|
sharedTags []string
|
||||||
iosTags []string
|
darwinTags []string
|
||||||
memcTags []string
|
// memcTags []string
|
||||||
|
notMemcTags []string
|
||||||
debugTags []string
|
debugTags []string
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -56,18 +60,38 @@ func init() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
currentTag = "unknown"
|
currentTag = "unknown"
|
||||||
}
|
}
|
||||||
sharedFlags = append(sharedFlags, "-ldflags", "-X github.com/sagernet/sing-box/constant.Version="+currentTag+" -s -w -buildid=")
|
sharedFlags = append(sharedFlags, "-ldflags", build_shared.LinkerFlags(currentTag, false))
|
||||||
debugFlags = append(debugFlags, "-ldflags", "-X github.com/sagernet/sing-box/constant.Version="+currentTag)
|
debugFlags = append(debugFlags, "-ldflags", build_shared.LinkerFlags(currentTag, true))
|
||||||
|
|
||||||
sharedTags = append(sharedTags, "with_gvisor", "with_quic", "with_wireguard", "with_utls", "with_clash_api", "with_conntrack")
|
sharedTags = append(sharedTags, "with_gvisor", "with_quic", "with_wireguard", "with_masque", "with_mtproxy", "with_trusttunnel", "with_call", "with_sudoku", "with_utls", "with_naive_outbound", "with_clash_api", "with_usbip", "with_openvpn", "with_openconnect", "badlinkname", "tfogo_checklinkname0")
|
||||||
iosTags = append(iosTags, "with_dhcp", "with_low_memory")
|
darwinTags = append(darwinTags, "with_dhcp", "grpcnotrace")
|
||||||
memcTags = append(memcTags, "with_tailscale")
|
// memcTags = append(memcTags, "with_tailscale")
|
||||||
|
sharedTags = append(sharedTags, "with_tailscale", "ts_omit_logtail", "ts_omit_ssh", "ts_omit_drive", "ts_omit_taildrop", "ts_omit_webclient", "ts_omit_doctor", "ts_omit_capture", "ts_omit_kube", "ts_omit_aws", "ts_omit_synology", "ts_omit_bird")
|
||||||
|
notMemcTags = append(notMemcTags, "with_low_memory")
|
||||||
debugTags = append(debugTags, "debug")
|
debugTags = append(debugTags, "debug")
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildAndroid() {
|
type AndroidBuildConfig struct {
|
||||||
build_shared.FindSDK()
|
AndroidAPI int
|
||||||
|
OutputName string
|
||||||
|
Tags []string
|
||||||
|
}
|
||||||
|
|
||||||
|
func filterTags(tags []string, exclude ...string) []string {
|
||||||
|
excludeMap := make(map[string]bool)
|
||||||
|
for _, tag := range exclude {
|
||||||
|
excludeMap[tag] = true
|
||||||
|
}
|
||||||
|
var result []string
|
||||||
|
for _, tag := range tags {
|
||||||
|
if !excludeMap[tag] {
|
||||||
|
result = append(result, tag)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
func checkJavaVersion() {
|
||||||
var javaPath string
|
var javaPath string
|
||||||
javaHome := os.Getenv("JAVA_HOME")
|
javaHome := os.Getenv("JAVA_HOME")
|
||||||
if javaHome == "" {
|
if javaHome == "" {
|
||||||
@@ -83,21 +107,24 @@ func buildAndroid() {
|
|||||||
if !strings.Contains(javaVersion, "openjdk 17") {
|
if !strings.Contains(javaVersion, "openjdk 17") {
|
||||||
log.Fatal("java version should be openjdk 17")
|
log.Fatal("java version should be openjdk 17")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var bindTarget string
|
func getAndroidBindTarget() string {
|
||||||
if platform != "" {
|
if platform != "" {
|
||||||
bindTarget = platform
|
return platform
|
||||||
} else if debugEnabled {
|
} else if debugEnabled {
|
||||||
bindTarget = "android/arm64"
|
return "android/arm64"
|
||||||
} else {
|
|
||||||
bindTarget = "android"
|
|
||||||
}
|
}
|
||||||
|
return "android"
|
||||||
|
}
|
||||||
|
|
||||||
|
func buildAndroidVariant(config AndroidBuildConfig, bindTarget string) {
|
||||||
args := []string{
|
args := []string{
|
||||||
"bind",
|
"bind",
|
||||||
"-v",
|
"-v",
|
||||||
|
"-o", config.OutputName,
|
||||||
"-target", bindTarget,
|
"-target", bindTarget,
|
||||||
"-androidapi", "21",
|
"-androidapi", strconv.Itoa(config.AndroidAPI),
|
||||||
"-javapkg=io.nekohasekai",
|
"-javapkg=io.nekohasekai",
|
||||||
"-libname=box",
|
"-libname=box",
|
||||||
}
|
}
|
||||||
@@ -108,34 +135,59 @@ func buildAndroid() {
|
|||||||
args = append(args, debugFlags...)
|
args = append(args, debugFlags...)
|
||||||
}
|
}
|
||||||
|
|
||||||
tags := append(sharedTags, memcTags...)
|
args = append(args, "-tags", strings.Join(config.Tags, ","))
|
||||||
if debugEnabled {
|
|
||||||
tags = append(tags, debugTags...)
|
|
||||||
}
|
|
||||||
|
|
||||||
args = append(args, "-tags", strings.Join(tags, ","))
|
|
||||||
args = append(args, "./experimental/libbox")
|
args = append(args, "./experimental/libbox")
|
||||||
|
|
||||||
command := exec.Command(build_shared.GoBinPath+"/gomobile", args...)
|
command := exec.Command(build_shared.GoBinPath+"/gomobile", args...)
|
||||||
command.Stdout = os.Stdout
|
command.Stdout = os.Stdout
|
||||||
command.Stderr = os.Stderr
|
command.Stderr = os.Stderr
|
||||||
err = command.Run()
|
err := command.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
const name = "libbox.aar"
|
|
||||||
copyPath := filepath.Join("..", "sing-box-for-android", "app", "libs")
|
copyPath := filepath.Join("..", "sing-box-for-android", "app", "libs")
|
||||||
if rw.IsDir(copyPath) {
|
if rw.IsDir(copyPath) {
|
||||||
copyPath, _ = filepath.Abs(copyPath)
|
copyPath, _ = filepath.Abs(copyPath)
|
||||||
err = rw.CopyFile(name, filepath.Join(copyPath, name))
|
err = rw.CopyFile(config.OutputName, filepath.Join(copyPath, config.OutputName))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
log.Info("copied to ", copyPath)
|
log.Info("copied ", config.OutputName, " to ", copyPath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func buildAndroid() {
|
||||||
|
build_shared.FindSDK()
|
||||||
|
checkJavaVersion()
|
||||||
|
|
||||||
|
bindTarget := getAndroidBindTarget()
|
||||||
|
|
||||||
|
// Build main variant (SDK 24)
|
||||||
|
mainTags := append([]string{}, sharedTags...)
|
||||||
|
// mainTags = append(mainTags, memcTags...)
|
||||||
|
if debugEnabled {
|
||||||
|
mainTags = append(mainTags, debugTags...)
|
||||||
|
}
|
||||||
|
buildAndroidVariant(AndroidBuildConfig{
|
||||||
|
AndroidAPI: 24,
|
||||||
|
OutputName: "libbox.aar",
|
||||||
|
Tags: mainTags,
|
||||||
|
}, bindTarget)
|
||||||
|
|
||||||
|
// Build legacy variant (SDK 21, no naive outbound)
|
||||||
|
legacyTags := filterTags(sharedTags, "with_naive_outbound")
|
||||||
|
// legacyTags = append(legacyTags, memcTags...)
|
||||||
|
if debugEnabled {
|
||||||
|
legacyTags = append(legacyTags, debugTags...)
|
||||||
|
}
|
||||||
|
buildAndroidVariant(AndroidBuildConfig{
|
||||||
|
AndroidAPI: 21,
|
||||||
|
OutputName: "libbox-legacy.aar",
|
||||||
|
Tags: legacyTags,
|
||||||
|
}, bindTarget)
|
||||||
|
}
|
||||||
|
|
||||||
func buildApple() {
|
func buildApple() {
|
||||||
var bindTarget string
|
var bindTarget string
|
||||||
if platform != "" {
|
if platform != "" {
|
||||||
@@ -143,7 +195,7 @@ func buildApple() {
|
|||||||
} else if debugEnabled {
|
} else if debugEnabled {
|
||||||
bindTarget = "ios"
|
bindTarget = "ios"
|
||||||
} else {
|
} else {
|
||||||
bindTarget = "ios,tvos,macos"
|
bindTarget = "ios,iossimulator,tvos,tvossimulator,macos"
|
||||||
}
|
}
|
||||||
|
|
||||||
args := []string{
|
args := []string{
|
||||||
@@ -151,8 +203,14 @@ func buildApple() {
|
|||||||
"-v",
|
"-v",
|
||||||
"-target", bindTarget,
|
"-target", bindTarget,
|
||||||
"-libname=box",
|
"-libname=box",
|
||||||
"-tags-macos=" + strings.Join(memcTags, ","),
|
"-tags-not-macos=with_low_memory",
|
||||||
|
"-iosversion=15.0",
|
||||||
|
"-macosversion=13.0",
|
||||||
|
"-tvosversion=17.0",
|
||||||
}
|
}
|
||||||
|
//if !withTailscale {
|
||||||
|
// args = append(args, "-tags-macos="+strings.Join(memcTags, ","))
|
||||||
|
//}
|
||||||
|
|
||||||
if !debugEnabled {
|
if !debugEnabled {
|
||||||
args = append(args, sharedFlags...)
|
args = append(args, sharedFlags...)
|
||||||
@@ -160,7 +218,10 @@ func buildApple() {
|
|||||||
args = append(args, debugFlags...)
|
args = append(args, debugFlags...)
|
||||||
}
|
}
|
||||||
|
|
||||||
tags := append(sharedTags, iosTags...)
|
tags := append(sharedTags, darwinTags...)
|
||||||
|
//if withTailscale {
|
||||||
|
// tags = append(tags, memcTags...)
|
||||||
|
//}
|
||||||
if debugEnabled {
|
if debugEnabled {
|
||||||
tags = append(tags, debugTags...)
|
tags = append(tags, debugTags...)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package build_shared
|
||||||
|
|
||||||
|
import "strings"
|
||||||
|
|
||||||
|
func LinkerFlags(version string, debug bool) string {
|
||||||
|
flags := []string{
|
||||||
|
"-X github.com/sagernet/sing-box/constant.Version=" + version,
|
||||||
|
"-X runtime.godebugDefault=multipathtcp=0,tlssha1=1",
|
||||||
|
"-checklinkname=0",
|
||||||
|
}
|
||||||
|
if !debug {
|
||||||
|
flags = append(flags, "-s", "-w", "-buildid=")
|
||||||
|
}
|
||||||
|
return strings.Join(flags, " ")
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package build_shared
|
|||||||
import (
|
import (
|
||||||
"github.com/sagernet/sing-box/common/badversion"
|
"github.com/sagernet/sing-box/common/badversion"
|
||||||
"github.com/sagernet/sing/common"
|
"github.com/sagernet/sing/common"
|
||||||
|
F "github.com/sagernet/sing/common/format"
|
||||||
"github.com/sagernet/sing/common/shell"
|
"github.com/sagernet/sing/common/shell"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -36,3 +37,7 @@ func ReadTagVersion() (badversion.Version, error) {
|
|||||||
}
|
}
|
||||||
return version, nil
|
return version, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestFlightVersion(version badversion.Version) string {
|
||||||
|
return F.ToString(version.Major, ".", version.Minor, ".10")
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,117 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/sagernet/sing-box/log"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
err := filepath.Walk("docs", func(path string, info os.FileInfo, err error) error {
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if info.IsDir() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if !strings.HasSuffix(path, ".md") {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return processFile(path)
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func processFile(path string) error {
|
||||||
|
content, err := os.ReadFile(path)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
lines := strings.Split(string(content), "\n")
|
||||||
|
modified := false
|
||||||
|
result := make([]string, 0, len(lines))
|
||||||
|
|
||||||
|
inQuoteBlock := false
|
||||||
|
materialLines := []int{} // indices of :material- lines in the block
|
||||||
|
|
||||||
|
for _, line := range lines {
|
||||||
|
// Check for quote block start
|
||||||
|
if strings.HasPrefix(line, "!!! quote \"") && strings.Contains(line, "sing-box") {
|
||||||
|
inQuoteBlock = true
|
||||||
|
materialLines = nil
|
||||||
|
result = append(result, line)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inside a quote block
|
||||||
|
if inQuoteBlock {
|
||||||
|
trimmed := strings.TrimPrefix(line, " ")
|
||||||
|
isMaterialLine := strings.HasPrefix(trimmed, ":material-")
|
||||||
|
isEmpty := strings.TrimSpace(line) == ""
|
||||||
|
isIndented := strings.HasPrefix(line, " ")
|
||||||
|
|
||||||
|
if isMaterialLine {
|
||||||
|
materialLines = append(materialLines, len(result))
|
||||||
|
result = append(result, line)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// Block ends when:
|
||||||
|
// - Empty line AFTER we've seen material lines, OR
|
||||||
|
// - Non-indented, non-empty line
|
||||||
|
blockEnds := (isEmpty && len(materialLines) > 0) || (!isEmpty && !isIndented)
|
||||||
|
if blockEnds {
|
||||||
|
// Process collected material lines
|
||||||
|
if len(materialLines) > 0 {
|
||||||
|
for j, idx := range materialLines {
|
||||||
|
isLast := j == len(materialLines)-1
|
||||||
|
resultLine := strings.TrimRight(result[idx], " ")
|
||||||
|
if !isLast {
|
||||||
|
// Add trailing two spaces for non-last lines
|
||||||
|
resultLine += " "
|
||||||
|
}
|
||||||
|
if result[idx] != resultLine {
|
||||||
|
modified = true
|
||||||
|
result[idx] = resultLine
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inQuoteBlock = false
|
||||||
|
materialLines = nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result = append(result, line)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle case where file ends while still in a block
|
||||||
|
if inQuoteBlock && len(materialLines) > 0 {
|
||||||
|
for j, idx := range materialLines {
|
||||||
|
isLast := j == len(materialLines)-1
|
||||||
|
resultLine := strings.TrimRight(result[idx], " ")
|
||||||
|
if !isLast {
|
||||||
|
resultLine += " "
|
||||||
|
}
|
||||||
|
if result[idx] != resultLine {
|
||||||
|
modified = true
|
||||||
|
result[idx] = resultLine
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if modified {
|
||||||
|
newContent := strings.Join(result, "\n")
|
||||||
|
if !bytes.Equal(content, []byte(newContent)) {
|
||||||
|
log.Info("formatted: ", path)
|
||||||
|
return os.WriteFile(path, []byte(newContent), 0o644)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,165 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"archive/zip"
|
||||||
|
"crypto/sha256"
|
||||||
|
"flag"
|
||||||
|
"io"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/sagernet/sing-box/log"
|
||||||
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
|
)
|
||||||
|
|
||||||
|
var outputPath string
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
flag.StringVar(&outputPath, "output", "", "output AAR path")
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
flag.Parse()
|
||||||
|
err := merge()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func merge() error {
|
||||||
|
inputPaths := flag.Args()
|
||||||
|
if outputPath == "" {
|
||||||
|
return E.New("missing output path")
|
||||||
|
}
|
||||||
|
if len(inputPaths) == 0 {
|
||||||
|
return E.New("missing input AAR paths")
|
||||||
|
}
|
||||||
|
archiveReaders := make([]*zip.ReadCloser, 0, len(inputPaths))
|
||||||
|
for _, inputPath := range inputPaths {
|
||||||
|
archiveReader, err := zip.OpenReader(inputPath)
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, "open input AAR: ", inputPath)
|
||||||
|
}
|
||||||
|
archiveReaders = append(archiveReaders, archiveReader)
|
||||||
|
}
|
||||||
|
defer func() {
|
||||||
|
for _, archiveReader := range archiveReaders {
|
||||||
|
archiveReader.Close()
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
referenceEntries := make(map[string][sha256.Size]byte)
|
||||||
|
selectedEntries := make([]*zip.File, 0)
|
||||||
|
selectedJNIEntries := make(map[string]bool)
|
||||||
|
for inputIndex, archiveReader := range archiveReaders {
|
||||||
|
seenEntries := make(map[string]bool)
|
||||||
|
for _, archiveFile := range archiveReader.File {
|
||||||
|
if strings.HasPrefix(archiveFile.Name, "jni/") {
|
||||||
|
if archiveFile.FileInfo().IsDir() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if selectedJNIEntries[archiveFile.Name] {
|
||||||
|
return E.New("duplicate AAR JNI entry: ", archiveFile.Name)
|
||||||
|
}
|
||||||
|
selectedJNIEntries[archiveFile.Name] = true
|
||||||
|
selectedEntries = append(selectedEntries, archiveFile)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
entryDigest, err := digestEntry(archiveFile)
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, "read AAR entry: ", archiveFile.Name)
|
||||||
|
}
|
||||||
|
if inputIndex == 0 {
|
||||||
|
referenceEntries[archiveFile.Name] = entryDigest
|
||||||
|
selectedEntries = append(selectedEntries, archiveFile)
|
||||||
|
} else {
|
||||||
|
referenceDigest, loaded := referenceEntries[archiveFile.Name]
|
||||||
|
if !loaded {
|
||||||
|
return E.New("unexpected AAR entry: ", archiveFile.Name)
|
||||||
|
}
|
||||||
|
if referenceDigest != entryDigest {
|
||||||
|
return E.New("AAR entry differs between architectures: ", archiveFile.Name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
seenEntries[archiveFile.Name] = true
|
||||||
|
}
|
||||||
|
if inputIndex > 0 {
|
||||||
|
for referenceName := range referenceEntries {
|
||||||
|
if !seenEntries[referenceName] {
|
||||||
|
return E.New("missing AAR entry: ", referenceName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
absoluteOutputPath, err := filepath.Abs(outputPath)
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, "resolve output AAR path")
|
||||||
|
}
|
||||||
|
err = os.MkdirAll(filepath.Dir(absoluteOutputPath), 0o755)
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, "create output AAR directory")
|
||||||
|
}
|
||||||
|
temporaryFile, err := os.CreateTemp(filepath.Dir(absoluteOutputPath), ".merge-aar-*.aar")
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, "create temporary output AAR")
|
||||||
|
}
|
||||||
|
temporaryPath := temporaryFile.Name()
|
||||||
|
defer os.Remove(temporaryPath)
|
||||||
|
archiveWriter := zip.NewWriter(temporaryFile)
|
||||||
|
for _, archiveFile := range selectedEntries {
|
||||||
|
rawReader, openErr := archiveFile.OpenRaw()
|
||||||
|
if openErr != nil {
|
||||||
|
archiveWriter.Close()
|
||||||
|
temporaryFile.Close()
|
||||||
|
return E.Cause(openErr, "open raw AAR entry: ", archiveFile.Name)
|
||||||
|
}
|
||||||
|
header := archiveFile.FileHeader
|
||||||
|
rawWriter, createErr := archiveWriter.CreateRaw(&header)
|
||||||
|
if createErr != nil {
|
||||||
|
archiveWriter.Close()
|
||||||
|
temporaryFile.Close()
|
||||||
|
return E.Cause(createErr, "create output AAR entry: ", archiveFile.Name)
|
||||||
|
}
|
||||||
|
_, copyErr := io.Copy(rawWriter, rawReader)
|
||||||
|
if copyErr != nil {
|
||||||
|
archiveWriter.Close()
|
||||||
|
temporaryFile.Close()
|
||||||
|
return E.Cause(copyErr, "copy output AAR entry: ", archiveFile.Name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
err = archiveWriter.Close()
|
||||||
|
if err != nil {
|
||||||
|
temporaryFile.Close()
|
||||||
|
return E.Cause(err, "finalize output AAR")
|
||||||
|
}
|
||||||
|
err = temporaryFile.Close()
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, "close output AAR")
|
||||||
|
}
|
||||||
|
err = os.Rename(temporaryPath, absoluteOutputPath)
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, "replace output AAR")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func digestEntry(archiveFile *zip.File) ([sha256.Size]byte, error) {
|
||||||
|
entryReader, err := archiveFile.Open()
|
||||||
|
if err != nil {
|
||||||
|
return [sha256.Size]byte{}, err
|
||||||
|
}
|
||||||
|
digest := sha256.New()
|
||||||
|
_, err = io.Copy(digest, entryReader)
|
||||||
|
closeErr := entryReader.Close()
|
||||||
|
if err != nil {
|
||||||
|
return [sha256.Size]byte{}, err
|
||||||
|
}
|
||||||
|
if closeErr != nil {
|
||||||
|
return [sha256.Size]byte{}, closeErr
|
||||||
|
}
|
||||||
|
var result [sha256.Size]byte
|
||||||
|
copy(result[:], digest.Sum(nil))
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,172 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"flag"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"path/filepath"
|
||||||
|
"sort"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/sagernet/sing-box/log"
|
||||||
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
|
|
||||||
|
"howett.net/plist"
|
||||||
|
)
|
||||||
|
|
||||||
|
type xcFrameworkInfo struct {
|
||||||
|
AvailableLibraries []xcFrameworkLibrary `plist:"AvailableLibraries"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type xcFrameworkLibrary struct {
|
||||||
|
BinaryPath string `plist:"BinaryPath"`
|
||||||
|
LibraryIdentifier string `plist:"LibraryIdentifier"`
|
||||||
|
LibraryPath string `plist:"LibraryPath"`
|
||||||
|
SupportedArchitectures []string `plist:"SupportedArchitectures"`
|
||||||
|
SupportedPlatform string `plist:"SupportedPlatform"`
|
||||||
|
SupportedPlatformVariant string `plist:"SupportedPlatformVariant"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type frameworkSlice struct {
|
||||||
|
rootPath string
|
||||||
|
library xcFrameworkLibrary
|
||||||
|
}
|
||||||
|
|
||||||
|
var outputPath string
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
flag.StringVar(&outputPath, "output", "", "output XCFramework path")
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
flag.Parse()
|
||||||
|
err := merge()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func merge() error {
|
||||||
|
inputPaths := flag.Args()
|
||||||
|
if outputPath == "" {
|
||||||
|
return E.New("missing output path")
|
||||||
|
}
|
||||||
|
if len(inputPaths) == 0 {
|
||||||
|
return E.New("missing input XCFramework paths")
|
||||||
|
}
|
||||||
|
frameworkGroups := make(map[string][]frameworkSlice)
|
||||||
|
for _, inputPath := range inputPaths {
|
||||||
|
infoFile, err := os.Open(filepath.Join(inputPath, "Info.plist"))
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, "open XCFramework metadata: ", inputPath)
|
||||||
|
}
|
||||||
|
var info xcFrameworkInfo
|
||||||
|
decoder := plist.NewDecoder(infoFile)
|
||||||
|
err = decoder.Decode(&info)
|
||||||
|
closeErr := infoFile.Close()
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, "decode XCFramework metadata: ", inputPath)
|
||||||
|
}
|
||||||
|
if closeErr != nil {
|
||||||
|
return E.Cause(closeErr, "close XCFramework metadata: ", inputPath)
|
||||||
|
}
|
||||||
|
for _, library := range info.AvailableLibraries {
|
||||||
|
groupName := library.SupportedPlatform + "|" + library.SupportedPlatformVariant
|
||||||
|
frameworkGroups[groupName] = append(frameworkGroups[groupName], frameworkSlice{
|
||||||
|
rootPath: inputPath,
|
||||||
|
library: library,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
groupNames := make([]string, 0, len(frameworkGroups))
|
||||||
|
for groupName := range frameworkGroups {
|
||||||
|
groupNames = append(groupNames, groupName)
|
||||||
|
}
|
||||||
|
sort.Strings(groupNames)
|
||||||
|
absoluteOutputPath, err := filepath.Abs(outputPath)
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, "resolve output XCFramework path")
|
||||||
|
}
|
||||||
|
err = os.MkdirAll(filepath.Dir(absoluteOutputPath), 0o755)
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, "create output XCFramework directory")
|
||||||
|
}
|
||||||
|
temporaryDirectory, err := os.MkdirTemp(filepath.Dir(absoluteOutputPath), ".merge-xcframework-*")
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, "create XCFramework merge directory")
|
||||||
|
}
|
||||||
|
defer os.RemoveAll(temporaryDirectory)
|
||||||
|
frameworkPaths := make([]string, 0, len(groupNames))
|
||||||
|
for groupIndex, groupName := range groupNames {
|
||||||
|
frameworkSlices := frameworkGroups[groupName]
|
||||||
|
firstSlice := frameworkSlices[0]
|
||||||
|
firstFrameworkPath := filepath.Join(firstSlice.rootPath, firstSlice.library.LibraryIdentifier, firstSlice.library.LibraryPath)
|
||||||
|
if len(frameworkSlices) == 1 {
|
||||||
|
frameworkPaths = append(frameworkPaths, firstFrameworkPath)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
architectures := make(map[string]bool)
|
||||||
|
binaryPaths := make([]string, 0, len(frameworkSlices))
|
||||||
|
for _, currentSlice := range frameworkSlices {
|
||||||
|
if currentSlice.library.LibraryPath != firstSlice.library.LibraryPath || currentSlice.library.BinaryPath != firstSlice.library.BinaryPath {
|
||||||
|
return E.New("incompatible XCFramework slices for platform: ", currentSlice.library.SupportedPlatform)
|
||||||
|
}
|
||||||
|
for _, architecture := range currentSlice.library.SupportedArchitectures {
|
||||||
|
if architectures[architecture] {
|
||||||
|
return E.New("duplicate XCFramework architecture: ", architecture)
|
||||||
|
}
|
||||||
|
architectures[architecture] = true
|
||||||
|
}
|
||||||
|
binaryPaths = append(binaryPaths, filepath.Join(currentSlice.rootPath, currentSlice.library.LibraryIdentifier, currentSlice.library.BinaryPath))
|
||||||
|
}
|
||||||
|
mergedFrameworkPath := filepath.Join(temporaryDirectory, "framework-"+strconv.Itoa(groupIndex), filepath.Base(firstSlice.library.LibraryPath))
|
||||||
|
copyCommand := exec.Command("ditto", firstFrameworkPath, mergedFrameworkPath)
|
||||||
|
copyCommand.Stdout = os.Stdout
|
||||||
|
copyCommand.Stderr = os.Stderr
|
||||||
|
err = copyCommand.Run()
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, "copy XCFramework slice")
|
||||||
|
}
|
||||||
|
binaryRelativePath, relativeErr := filepath.Rel(firstSlice.library.LibraryPath, firstSlice.library.BinaryPath)
|
||||||
|
if relativeErr != nil {
|
||||||
|
return E.Cause(relativeErr, "resolve XCFramework binary path")
|
||||||
|
}
|
||||||
|
if binaryRelativePath == "." || strings.HasPrefix(binaryRelativePath, ".."+string(filepath.Separator)) {
|
||||||
|
return E.New("invalid XCFramework binary path: ", firstSlice.library.BinaryPath)
|
||||||
|
}
|
||||||
|
mergedBinaryPath := filepath.Join(mergedFrameworkPath, binaryRelativePath)
|
||||||
|
temporaryBinaryPath := mergedBinaryPath + ".merged"
|
||||||
|
lipoArguments := append([]string{"lipo", "-create"}, binaryPaths...)
|
||||||
|
lipoArguments = append(lipoArguments, "-output", temporaryBinaryPath)
|
||||||
|
lipoCommand := exec.Command("xcrun", lipoArguments...)
|
||||||
|
lipoCommand.Stdout = os.Stdout
|
||||||
|
lipoCommand.Stderr = os.Stderr
|
||||||
|
err = lipoCommand.Run()
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, "merge XCFramework binaries")
|
||||||
|
}
|
||||||
|
err = os.Rename(temporaryBinaryPath, mergedBinaryPath)
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, "replace merged XCFramework binary")
|
||||||
|
}
|
||||||
|
frameworkPaths = append(frameworkPaths, mergedFrameworkPath)
|
||||||
|
}
|
||||||
|
err = os.RemoveAll(absoluteOutputPath)
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, "remove output XCFramework")
|
||||||
|
}
|
||||||
|
xcodebuildArguments := []string{"-create-xcframework"}
|
||||||
|
for _, frameworkPath := range frameworkPaths {
|
||||||
|
xcodebuildArguments = append(xcodebuildArguments, "-framework", frameworkPath)
|
||||||
|
}
|
||||||
|
xcodebuildArguments = append(xcodebuildArguments, "-output", absoluteOutputPath)
|
||||||
|
xcodebuildCommand := exec.Command("xcodebuild", xcodebuildArguments...)
|
||||||
|
xcodebuildCommand.Stdout = os.Stdout
|
||||||
|
xcodebuildCommand.Stderr = os.Stderr
|
||||||
|
err = xcodebuildCommand.Run()
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, "create XCFramework")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -48,8 +48,8 @@ func GetRuntimeEnv(key string) (string, error) {
|
|||||||
if readErr != nil {
|
if readErr != nil {
|
||||||
return "", readErr
|
return "", readErr
|
||||||
}
|
}
|
||||||
envStrings := strings.Split(string(data), "\n")
|
envStrings := strings.SplitSeq(string(data), "\n")
|
||||||
for _, envItem := range envStrings {
|
for envItem := range envStrings {
|
||||||
envItem = strings.TrimSuffix(envItem, "\r")
|
envItem = strings.TrimSuffix(envItem, "\r")
|
||||||
envKeyValue := strings.Split(envItem, "=")
|
envKeyValue := strings.Split(envItem, "=")
|
||||||
if strings.EqualFold(strings.TrimSpace(envKeyValue[0]), key) {
|
if strings.EqualFold(strings.TrimSpace(envKeyValue[0]), key) {
|
||||||
|
|||||||
@@ -0,0 +1,284 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"net/netip"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"strings"
|
||||||
|
"syscall"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
C "github.com/sagernet/sing-box/constant"
|
||||||
|
"github.com/sagernet/sing-box/include"
|
||||||
|
"github.com/sagernet/sing-box/log"
|
||||||
|
"github.com/sagernet/sing-box/option"
|
||||||
|
"github.com/sagernet/sing/common"
|
||||||
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
|
"github.com/sagernet/sing/common/json"
|
||||||
|
"github.com/sagernet/sing/common/shell"
|
||||||
|
)
|
||||||
|
|
||||||
|
var iperf3Path string
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
err := main0()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func main0() error {
|
||||||
|
err := shell.Exec("sudo", "ls").Run()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
results, err := runTests()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
encoder := json.NewEncoder(os.Stdout)
|
||||||
|
encoder.SetIndent("", " ")
|
||||||
|
return encoder.Encode(results)
|
||||||
|
}
|
||||||
|
|
||||||
|
func runTests() ([]TestResult, error) {
|
||||||
|
boxPaths := []string{
|
||||||
|
os.ExpandEnv("$HOME/Downloads/sing-box-1.11.15-darwin-arm64/sing-box"),
|
||||||
|
//"/Users/sekai/Downloads/sing-box-1.11.15-linux-arm64/sing-box",
|
||||||
|
"./sing-box",
|
||||||
|
}
|
||||||
|
stacks := []string{
|
||||||
|
"gvisor",
|
||||||
|
"system",
|
||||||
|
}
|
||||||
|
mtus := []int{
|
||||||
|
1500,
|
||||||
|
4064,
|
||||||
|
// 16384,
|
||||||
|
// 32768,
|
||||||
|
// 49152,
|
||||||
|
65535,
|
||||||
|
}
|
||||||
|
flagList := [][]string{
|
||||||
|
{},
|
||||||
|
}
|
||||||
|
var results []TestResult
|
||||||
|
for _, boxPath := range boxPaths {
|
||||||
|
for _, stack := range stacks {
|
||||||
|
for _, mtu := range mtus {
|
||||||
|
if strings.HasPrefix(boxPath, ".") {
|
||||||
|
for _, flags := range flagList {
|
||||||
|
result, err := testOnce(boxPath, stack, mtu, false, flags)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
results = append(results, *result)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
result, err := testOnce(boxPath, stack, mtu, false, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
results = append(results, *result)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return results, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type TestResult struct {
|
||||||
|
BoxPath string `json:"box_path"`
|
||||||
|
Stack string `json:"stack"`
|
||||||
|
MTU int `json:"mtu"`
|
||||||
|
Flags []string `json:"flags"`
|
||||||
|
MultiThread bool `json:"multi_thread"`
|
||||||
|
UploadSpeed string `json:"upload_speed"`
|
||||||
|
DownloadSpeed string `json:"download_speed"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func testOnce(boxPath string, stackName string, mtu int, multiThread bool, flags []string) (result *TestResult, err error) {
|
||||||
|
testAddress := netip.MustParseAddr("1.1.1.1")
|
||||||
|
testConfig := option.Options{
|
||||||
|
Inbounds: []option.Inbound{
|
||||||
|
{
|
||||||
|
Type: C.TypeTun,
|
||||||
|
Options: &option.TunInboundOptions{
|
||||||
|
Address: []netip.Prefix{netip.MustParsePrefix("172.18.0.1/30")},
|
||||||
|
AutoRoute: true,
|
||||||
|
MTU: uint32(mtu),
|
||||||
|
Stack: stackName,
|
||||||
|
RouteAddress: []netip.Prefix{netip.PrefixFrom(testAddress, testAddress.BitLen())},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Route: &option.RouteOptions{
|
||||||
|
Rules: []option.Rule{
|
||||||
|
{
|
||||||
|
Type: C.RuleTypeDefault,
|
||||||
|
DefaultOptions: option.DefaultRule{
|
||||||
|
RawDefaultRule: option.RawDefaultRule{
|
||||||
|
IPCIDR: []string{testAddress.String()},
|
||||||
|
},
|
||||||
|
RuleAction: option.RuleAction{
|
||||||
|
Action: C.RuleActionTypeRouteOptions,
|
||||||
|
RouteOptionsOptions: option.RouteOptionsActionOptions{
|
||||||
|
OverrideAddress: "127.0.0.1",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
AutoDetectInterface: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
ctx := include.Context(context.Background())
|
||||||
|
tempConfig, err := os.CreateTemp("", "tun-bench-*.json")
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer os.Remove(tempConfig.Name())
|
||||||
|
encoder := json.NewEncoderContext(ctx, tempConfig)
|
||||||
|
encoder.SetIndent("", " ")
|
||||||
|
err = encoder.Encode(testConfig)
|
||||||
|
if err != nil {
|
||||||
|
return nil, E.Cause(err, "encode test config")
|
||||||
|
}
|
||||||
|
tempConfig.Close()
|
||||||
|
var sudoArgs []string
|
||||||
|
if len(flags) > 0 {
|
||||||
|
sudoArgs = append(sudoArgs, "env")
|
||||||
|
sudoArgs = append(sudoArgs, flags...)
|
||||||
|
}
|
||||||
|
sudoArgs = append(sudoArgs, boxPath, "run", "-c", tempConfig.Name())
|
||||||
|
boxProcess := shell.Exec("sudo", sudoArgs...)
|
||||||
|
boxProcess.Stdout = &stderrWriter{}
|
||||||
|
boxProcess.Stderr = io.Discard
|
||||||
|
err = boxProcess.Start()
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if C.IsDarwin {
|
||||||
|
iperf3Path, err = exec.LookPath("iperf3-darwin")
|
||||||
|
} else {
|
||||||
|
iperf3Path, err = exec.LookPath("iperf3")
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
serverProcess := shell.Exec(iperf3Path, "-s")
|
||||||
|
serverProcess.Stdout = io.Discard
|
||||||
|
serverProcess.Stderr = io.Discard
|
||||||
|
err = serverProcess.Start()
|
||||||
|
if err != nil {
|
||||||
|
return nil, E.Cause(err, "start iperf3 server")
|
||||||
|
}
|
||||||
|
|
||||||
|
time.Sleep(time.Second)
|
||||||
|
|
||||||
|
args := []string{"-c", testAddress.String()}
|
||||||
|
if multiThread {
|
||||||
|
args = append(args, "-P", "10")
|
||||||
|
}
|
||||||
|
|
||||||
|
uploadProcess := shell.Exec(iperf3Path, args...)
|
||||||
|
output, err := uploadProcess.Read()
|
||||||
|
if err != nil {
|
||||||
|
boxProcess.Process.Signal(syscall.SIGKILL)
|
||||||
|
serverProcess.Process.Signal(syscall.SIGKILL)
|
||||||
|
println(output)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
uploadResult := common.SubstringBeforeLast(output, "iperf Done.")
|
||||||
|
uploadResult = common.SubstringBeforeLast(uploadResult, "sender")
|
||||||
|
uploadResult = common.SubstringBeforeLast(uploadResult, "bits/sec")
|
||||||
|
uploadResult = common.SubstringAfterLast(uploadResult, "Bytes")
|
||||||
|
uploadResult = strings.ReplaceAll(uploadResult, " ", "")
|
||||||
|
|
||||||
|
result = &TestResult{
|
||||||
|
BoxPath: boxPath,
|
||||||
|
Stack: stackName,
|
||||||
|
MTU: mtu,
|
||||||
|
Flags: flags,
|
||||||
|
MultiThread: multiThread,
|
||||||
|
UploadSpeed: uploadResult,
|
||||||
|
}
|
||||||
|
|
||||||
|
downloadProcess := shell.Exec(iperf3Path, append(args, "-R")...)
|
||||||
|
output, err = downloadProcess.Read()
|
||||||
|
if err != nil {
|
||||||
|
boxProcess.Process.Signal(syscall.SIGKILL)
|
||||||
|
serverProcess.Process.Signal(syscall.SIGKILL)
|
||||||
|
println(output)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
downloadResult := common.SubstringBeforeLast(output, "iperf Done.")
|
||||||
|
downloadResult = common.SubstringBeforeLast(downloadResult, "receiver")
|
||||||
|
downloadResult = common.SubstringBeforeLast(downloadResult, "bits/sec")
|
||||||
|
downloadResult = common.SubstringAfterLast(downloadResult, "Bytes")
|
||||||
|
downloadResult = strings.ReplaceAll(downloadResult, " ", "")
|
||||||
|
|
||||||
|
result.DownloadSpeed = downloadResult
|
||||||
|
|
||||||
|
printArgs := []any{boxPath, stackName, mtu, "upload", uploadResult, "download", downloadResult}
|
||||||
|
if len(flags) > 0 {
|
||||||
|
printArgs = append(printArgs, "flags", strings.Join(flags, " "))
|
||||||
|
}
|
||||||
|
if multiThread {
|
||||||
|
printArgs = append(printArgs, "(-P 10)")
|
||||||
|
}
|
||||||
|
fmt.Println(printArgs...)
|
||||||
|
err = boxProcess.Process.Signal(syscall.SIGTERM)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
err = serverProcess.Process.Signal(syscall.SIGTERM)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
boxDone := make(chan struct{})
|
||||||
|
go func() {
|
||||||
|
boxProcess.Cmd.Wait()
|
||||||
|
close(boxDone)
|
||||||
|
}()
|
||||||
|
|
||||||
|
serverDone := make(chan struct{})
|
||||||
|
go func() {
|
||||||
|
serverProcess.Process.Wait()
|
||||||
|
close(serverDone)
|
||||||
|
}()
|
||||||
|
|
||||||
|
select {
|
||||||
|
case <-boxDone:
|
||||||
|
case <-time.After(2 * time.Second):
|
||||||
|
boxProcess.Process.Kill()
|
||||||
|
case <-time.After(4 * time.Second):
|
||||||
|
println("box process did not close!")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
select {
|
||||||
|
case <-serverDone:
|
||||||
|
case <-time.After(2 * time.Second):
|
||||||
|
serverProcess.Process.Kill()
|
||||||
|
case <-time.After(4 * time.Second):
|
||||||
|
println("server process did not close!")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type stderrWriter struct{}
|
||||||
|
|
||||||
|
func (w *stderrWriter) Write(p []byte) (n int, err error) {
|
||||||
|
return os.Stderr.Write(p)
|
||||||
|
}
|
||||||
@@ -39,7 +39,7 @@ func main() {
|
|||||||
common.Must(os.Chdir(androidPath))
|
common.Must(os.Chdir(androidPath))
|
||||||
localProps := common.Must1(os.ReadFile("version.properties"))
|
localProps := common.Must1(os.ReadFile("version.properties"))
|
||||||
var propsList [][]string
|
var propsList [][]string
|
||||||
for _, propLine := range strings.Split(string(localProps), "\n") {
|
for propLine := range strings.SplitSeq(string(localProps), "\n") {
|
||||||
propsList = append(propsList, strings.Split(propLine, "="))
|
propsList = append(propsList, strings.Split(propLine, "="))
|
||||||
}
|
}
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -8,16 +8,21 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/sagernet/sing-box/cmd/internal/build_shared"
|
"github.com/sagernet/sing-box/cmd/internal/build_shared"
|
||||||
|
"github.com/sagernet/sing-box/common/badversion"
|
||||||
"github.com/sagernet/sing-box/log"
|
"github.com/sagernet/sing-box/log"
|
||||||
"github.com/sagernet/sing/common"
|
"github.com/sagernet/sing/common"
|
||||||
|
|
||||||
"howett.net/plist"
|
"howett.net/plist"
|
||||||
)
|
)
|
||||||
|
|
||||||
var flagRunInCI bool
|
var (
|
||||||
|
flagRunInCI bool
|
||||||
|
flagTestFlight bool
|
||||||
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
flag.BoolVar(&flagRunInCI, "ci", false, "Run in CI")
|
flag.BoolVar(&flagRunInCI, "ci", false, "Run in CI")
|
||||||
|
flag.BoolVar(&flagTestFlight, "testflight", false, "Override the App Store marketing version with the version reserved for TestFlight")
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -40,19 +45,39 @@ func main() {
|
|||||||
common.Must(decoder.Decode(&project))
|
common.Must(decoder.Decode(&project))
|
||||||
objectsMap := project["objects"].(map[string]any)
|
objectsMap := project["objects"].(map[string]any)
|
||||||
projectContent := string(common.Must1(os.ReadFile("sing-box.xcodeproj/project.pbxproj")))
|
projectContent := string(common.Must1(os.ReadFile("sing-box.xcodeproj/project.pbxproj")))
|
||||||
newContent, updated0 := findAndReplace(objectsMap, projectContent, []string{"io.nekohasekai.sfavt"}, newVersion.VersionString())
|
newContent := projectContent
|
||||||
newContent, updated1 := findAndReplace(objectsMap, newContent, []string{"io.nekohasekai.sfavt.standalone", "io.nekohasekai.sfavt.system"}, newVersion.String())
|
var marketingVersionUpdated bool
|
||||||
if updated0 || updated1 {
|
if flagTestFlight {
|
||||||
log.Info("updated version to ", newVersion.VersionString(), " (", newVersion.String(), ")")
|
testFlightVersion := build_shared.TestFlightVersion(newVersion)
|
||||||
}
|
newContent, marketingVersionUpdated = findAndReplace(objectsMap, newContent, []string{"io.nekohasekai.sfamt"}, testFlightVersion)
|
||||||
var updated2 bool
|
if marketingVersionUpdated {
|
||||||
if macProjectVersion := os.Getenv("MACOS_PROJECT_VERSION"); macProjectVersion != "" {
|
log.Info("updated App Store version to ", testFlightVersion)
|
||||||
newContent, updated2 = findAndReplaceProjectVersion(objectsMap, newContent, []string{"SFM"}, macProjectVersion)
|
|
||||||
if updated2 {
|
|
||||||
log.Info("updated macos project version to ", macProjectVersion)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if updated0 || updated1 || updated2 {
|
var standaloneVersionUpdated bool
|
||||||
|
newContent, standaloneVersionUpdated = findAndReplace(objectsMap, newContent, []string{"io.nekohasekai.sfamt.standalone", "io.nekohasekai.sfamt.system"}, newVersion.String())
|
||||||
|
if standaloneVersionUpdated {
|
||||||
|
marketingVersionUpdated = true
|
||||||
|
log.Info("updated version to ", newVersion.String())
|
||||||
|
}
|
||||||
|
var projectVersionUpdated bool
|
||||||
|
for environmentName, directory := range map[string]string{
|
||||||
|
"IOS_PROJECT_VERSION": "SFI",
|
||||||
|
"MACOS_PROJECT_VERSION": "SFM",
|
||||||
|
"TVOS_PROJECT_VERSION": "SFT",
|
||||||
|
} {
|
||||||
|
projectVersion := os.Getenv(environmentName)
|
||||||
|
if projectVersion == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
var updated bool
|
||||||
|
newContent, updated = findAndReplaceProjectVersion(objectsMap, newContent, []string{directory}, projectVersion)
|
||||||
|
if updated {
|
||||||
|
projectVersionUpdated = true
|
||||||
|
log.Info("updated ", directory, " project version to ", projectVersion)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if marketingVersionUpdated || projectVersionUpdated {
|
||||||
common.Must(os.WriteFile("sing-box.xcodeproj/project.pbxproj", []byte(newContent), 0o644))
|
common.Must(os.WriteFile("sing-box.xcodeproj/project.pbxproj", []byte(newContent), 0o644))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -71,16 +96,25 @@ func findAndReplace(objectsMap map[string]any, projectContent string, bundleIDLi
|
|||||||
indexEnd := indexStart + strings.Index(projectContent[indexStart:], "}")
|
indexEnd := indexStart + strings.Index(projectContent[indexStart:], "}")
|
||||||
versionStart := indexStart + strings.Index(projectContent[indexStart:indexEnd], "MARKETING_VERSION = ") + 20
|
versionStart := indexStart + strings.Index(projectContent[indexStart:indexEnd], "MARKETING_VERSION = ") + 20
|
||||||
versionEnd := versionStart + strings.Index(projectContent[versionStart:indexEnd], ";")
|
versionEnd := versionStart + strings.Index(projectContent[versionStart:indexEnd], ";")
|
||||||
version := projectContent[versionStart:versionEnd]
|
version := strings.Trim(projectContent[versionStart:versionEnd], "\"")
|
||||||
if version == newVersion {
|
if version == newVersion {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
updated = true
|
updated = true
|
||||||
projectContent = projectContent[:versionStart] + newVersion + projectContent[versionEnd:]
|
projectContent = projectContent[:versionStart] + formatProjectVersion(newVersion) + projectContent[versionEnd:]
|
||||||
}
|
}
|
||||||
return projectContent, updated
|
return projectContent, updated
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Xcode serializes a version without quotes unless it contains a pre-release
|
||||||
|
// part; always quoting makes Xcode rewrite the value on the next save.
|
||||||
|
func formatProjectVersion(version string) string {
|
||||||
|
if badversion.Parse(version).PreReleaseIdentifier == "" {
|
||||||
|
return version
|
||||||
|
}
|
||||||
|
return "\"" + version + "\""
|
||||||
|
}
|
||||||
|
|
||||||
func findAndReplaceProjectVersion(objectsMap map[string]any, projectContent string, directoryList []string, newVersion string) (string, bool) {
|
func findAndReplaceProjectVersion(objectsMap map[string]any, projectContent string, directoryList []string, newVersion string) (string, bool) {
|
||||||
objectKeyList := findObjectKeyByDirectory(objectsMap, directoryList)
|
objectKeyList := findObjectKeyByDirectory(objectsMap, directoryList)
|
||||||
var updated bool
|
var updated bool
|
||||||
@@ -106,6 +140,7 @@ func findAndReplaceProjectVersion(objectsMap map[string]any, projectContent stri
|
|||||||
}
|
}
|
||||||
|
|
||||||
func findObjectKey(objectsMap map[string]any, bundleIDList []string) []string {
|
func findObjectKey(objectsMap map[string]any, bundleIDList []string) []string {
|
||||||
|
globalSettings := collectBuildSettings(objectsMap)
|
||||||
var objectKeyList []string
|
var objectKeyList []string
|
||||||
for objectKey, object := range objectsMap {
|
for objectKey, object := range objectsMap {
|
||||||
buildSettings := object.(map[string]any)["buildSettings"]
|
buildSettings := object.(map[string]any)["buildSettings"]
|
||||||
@@ -116,13 +151,51 @@ func findObjectKey(objectsMap map[string]any, bundleIDList []string) []string {
|
|||||||
if bundleIDObject == nil {
|
if bundleIDObject == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if common.Contains(bundleIDList, bundleIDObject.(string)) {
|
bundleID := expandBuildVariables(bundleIDObject.(string), globalSettings)
|
||||||
|
if common.Contains(bundleIDList, bundleID) {
|
||||||
objectKeyList = append(objectKeyList, objectKey)
|
objectKeyList = append(objectKeyList, objectKey)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return objectKeyList
|
return objectKeyList
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func collectBuildSettings(objectsMap map[string]any) map[string]string {
|
||||||
|
settings := make(map[string]string)
|
||||||
|
for _, object := range objectsMap {
|
||||||
|
buildSettings, loaded := object.(map[string]any)["buildSettings"].(map[string]any)
|
||||||
|
if !loaded {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
for key, value := range buildSettings {
|
||||||
|
valueString, isString := value.(string)
|
||||||
|
if !isString {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
settings[key] = valueString
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return settings
|
||||||
|
}
|
||||||
|
|
||||||
|
var buildVariableRegexp = regexp.MustCompile(`\$[({]([A-Za-z0-9_]+)[)}]`)
|
||||||
|
|
||||||
|
func expandBuildVariables(value string, settings map[string]string) string {
|
||||||
|
for {
|
||||||
|
expanded := buildVariableRegexp.ReplaceAllStringFunc(value, func(match string) string {
|
||||||
|
name := buildVariableRegexp.FindStringSubmatch(match)[1]
|
||||||
|
replacement, loaded := settings[name]
|
||||||
|
if !loaded {
|
||||||
|
return match
|
||||||
|
}
|
||||||
|
return replacement
|
||||||
|
})
|
||||||
|
if expanded == value {
|
||||||
|
return expanded
|
||||||
|
}
|
||||||
|
value = expanded
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func findObjectKeyByDirectory(objectsMap map[string]any, directoryList []string) []string {
|
func findObjectKeyByDirectory(objectsMap map[string]any, directoryList []string) []string {
|
||||||
var objectKeyList []string
|
var objectKeyList []string
|
||||||
for objectKey, object := range objectsMap {
|
for objectKey, object := range objectsMap {
|
||||||
|
|||||||
@@ -17,6 +17,10 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
}
|
}
|
||||||
|
err = updateChromeIncludedRootCAs()
|
||||||
|
if err != nil {
|
||||||
|
log.Error(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateMozillaIncludedRootCAs() error {
|
func updateMozillaIncludedRootCAs() error {
|
||||||
@@ -39,13 +43,8 @@ func updateMozillaIncludedRootCAs() error {
|
|||||||
|
|
||||||
package certificate
|
package certificate
|
||||||
|
|
||||||
import "crypto/x509"
|
func mozillaIncludedPEM() string {
|
||||||
|
return ` + "`")
|
||||||
var mozillaIncluded *x509.CertPool
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
mozillaIncluded = x509.NewCertPool()
|
|
||||||
`)
|
|
||||||
for {
|
for {
|
||||||
record, err := reader.Read()
|
record, err := reader.Read()
|
||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
@@ -56,16 +55,94 @@ func init() {
|
|||||||
if record[geoIndex] == "China" {
|
if record[geoIndex] == "China" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
generated.WriteString("\n // ")
|
cert := strings.Trim(record[certIndex], "'")
|
||||||
|
generated.WriteString("\n// ")
|
||||||
generated.WriteString(record[nameIndex])
|
generated.WriteString(record[nameIndex])
|
||||||
generated.WriteString("\n")
|
generated.WriteString("\n")
|
||||||
generated.WriteString(" mozillaIncluded.AppendCertsFromPEM([]byte(`")
|
|
||||||
cert := record[certIndex]
|
|
||||||
// Remove single quotes
|
|
||||||
cert = cert[1 : len(cert)-1]
|
|
||||||
generated.WriteString(cert)
|
generated.WriteString(cert)
|
||||||
generated.WriteString("`))\n")
|
generated.WriteString("\n")
|
||||||
}
|
}
|
||||||
generated.WriteString("}\n")
|
generated.WriteString("`\n}\n")
|
||||||
return os.WriteFile("common/certificate/mozilla.go", []byte(generated.String()), 0o644)
|
return os.WriteFile("common/certificate/mozilla.go", []byte(generated.String()), 0o644)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func fetchChinaFingerprints() (map[string]bool, error) {
|
||||||
|
response, err := http.Get("https://ccadb.my.salesforce-sites.com/ccadb/AllCertificateRecordsCSVFormatv4")
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer response.Body.Close()
|
||||||
|
reader := csv.NewReader(response.Body)
|
||||||
|
header, err := reader.Read()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
countryIndex := slices.Index(header, "Country")
|
||||||
|
fingerprintIndex := slices.Index(header, "SHA-256 Fingerprint")
|
||||||
|
|
||||||
|
chinaFingerprints := make(map[string]bool)
|
||||||
|
for {
|
||||||
|
record, err := reader.Read()
|
||||||
|
if err == io.EOF {
|
||||||
|
break
|
||||||
|
} else if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if record[countryIndex] == "China" {
|
||||||
|
chinaFingerprints[record[fingerprintIndex]] = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return chinaFingerprints, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func updateChromeIncludedRootCAs() error {
|
||||||
|
chinaFingerprints, err := fetchChinaFingerprints()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
response, err := http.Get("https://ccadb.my.salesforce-sites.com/ccadb/RootCACertificatesIncludedByRSReportCSV")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer response.Body.Close()
|
||||||
|
reader := csv.NewReader(response.Body)
|
||||||
|
header, err := reader.Read()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
subjectIndex := slices.Index(header, "Subject")
|
||||||
|
statusIndex := slices.Index(header, "Google Chrome Status")
|
||||||
|
certIndex := slices.Index(header, "X.509 Certificate (PEM)")
|
||||||
|
fingerprintIndex := slices.Index(header, "SHA-256 Fingerprint")
|
||||||
|
|
||||||
|
generated := strings.Builder{}
|
||||||
|
generated.WriteString(`// Code generated by 'make update_certificates'. DO NOT EDIT.
|
||||||
|
|
||||||
|
package certificate
|
||||||
|
|
||||||
|
func chromeIncludedPEM() string {
|
||||||
|
return ` + "`")
|
||||||
|
for {
|
||||||
|
record, err := reader.Read()
|
||||||
|
if err == io.EOF {
|
||||||
|
break
|
||||||
|
} else if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if record[statusIndex] != "Included" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if chinaFingerprints[record[fingerprintIndex]] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
cert := strings.Trim(record[certIndex], "'")
|
||||||
|
generated.WriteString("\n// ")
|
||||||
|
generated.WriteString(record[subjectIndex])
|
||||||
|
generated.WriteString("\n")
|
||||||
|
generated.WriteString(cert)
|
||||||
|
generated.WriteString("\n")
|
||||||
|
}
|
||||||
|
generated.WriteString("`\n}\n")
|
||||||
|
return os.WriteFile("common/certificate/chrome.go", []byte(generated.String()), 0o644)
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"flag"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"regexp"
|
||||||
|
"runtime"
|
||||||
|
|
||||||
|
"github.com/sagernet/sing-box/cmd/internal/build_shared"
|
||||||
|
"github.com/sagernet/sing-box/log"
|
||||||
|
"github.com/sagernet/sing/common"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
flagRunInCI bool
|
||||||
|
flagRunNightly bool
|
||||||
|
)
|
||||||
|
|
||||||
|
type versionMetadata struct {
|
||||||
|
Version string `json:"version"`
|
||||||
|
GoVersion string `json:"go_version"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
flag.BoolVar(&flagRunInCI, "ci", false, "Run in CI")
|
||||||
|
flag.BoolVar(&flagRunNightly, "nightly", false, "Run nightly")
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
flag.Parse()
|
||||||
|
newVersion := common.Must1(build_shared.ReadTag())
|
||||||
|
desktopPath := "../sing-box-for-desktop"
|
||||||
|
if flagRunInCI {
|
||||||
|
desktopPath = "clients/desktop"
|
||||||
|
}
|
||||||
|
desktopPath = common.Must1(filepath.Abs(desktopPath))
|
||||||
|
versionPath := filepath.Join(desktopPath, "version.json")
|
||||||
|
versionFile := common.Must1(os.Open(versionPath))
|
||||||
|
var metadata versionMetadata
|
||||||
|
common.Must(json.NewDecoder(versionFile).Decode(&metadata))
|
||||||
|
common.Must(versionFile.Close())
|
||||||
|
newGoVersion := runtime.Version()
|
||||||
|
if match := regexp.MustCompile(`^go\d+\.\d+(?:\.\d+)?`).FindString(newGoVersion); match != "" {
|
||||||
|
newGoVersion = match
|
||||||
|
}
|
||||||
|
versionUpdated := metadata.Version != newVersion
|
||||||
|
goVersionUpdated := metadata.GoVersion != newGoVersion
|
||||||
|
if !(versionUpdated || goVersionUpdated) {
|
||||||
|
log.Info("version not changed")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if versionUpdated {
|
||||||
|
log.Info("updated version from ", metadata.Version, " to ", newVersion)
|
||||||
|
}
|
||||||
|
if goVersionUpdated {
|
||||||
|
log.Info("updated Go version from ", metadata.GoVersion, " to ", newGoVersion)
|
||||||
|
}
|
||||||
|
if flagRunInCI && !flagRunNightly {
|
||||||
|
log.Fatal("version changed, commit changes first.")
|
||||||
|
}
|
||||||
|
metadata.Version = newVersion
|
||||||
|
metadata.GoVersion = newGoVersion
|
||||||
|
outputFile := common.Must1(os.Create(versionPath))
|
||||||
|
encoder := json.NewEncoder(outputFile)
|
||||||
|
encoder.SetIndent("", " ")
|
||||||
|
common.Must(encoder.Encode(metadata))
|
||||||
|
common.Must(outputFile.Close())
|
||||||
|
}
|
||||||
+4
-1
@@ -10,6 +10,7 @@ import (
|
|||||||
"github.com/sagernet/sing-box/experimental/deprecated"
|
"github.com/sagernet/sing-box/experimental/deprecated"
|
||||||
"github.com/sagernet/sing-box/include"
|
"github.com/sagernet/sing-box/include"
|
||||||
"github.com/sagernet/sing-box/log"
|
"github.com/sagernet/sing-box/log"
|
||||||
|
"github.com/sagernet/sing/common"
|
||||||
"github.com/sagernet/sing/service"
|
"github.com/sagernet/sing/service"
|
||||||
"github.com/sagernet/sing/service/filemanager"
|
"github.com/sagernet/sing/service/filemanager"
|
||||||
|
|
||||||
@@ -52,7 +53,9 @@ func preRun(cmd *cobra.Command, args []string) {
|
|||||||
globalCtx = filemanager.WithDefault(globalCtx, "", "", sudoUID, sudoGID)
|
globalCtx = filemanager.WithDefault(globalCtx, "", "", sudoUID, sudoGID)
|
||||||
}
|
}
|
||||||
if disableColor {
|
if disableColor {
|
||||||
log.SetStdLogger(log.NewDefaultFactory(context.Background(), log.Formatter{BaseTime: time.Now(), DisableColors: true}, os.Stderr, "", nil, false).Logger())
|
logFactory := log.NewDefaultFactory(context.Background(), log.Formatter{BaseTime: time.Now(), DisableColors: true}, os.Stderr, "", nil, false)
|
||||||
|
common.Must(logFactory.Start())
|
||||||
|
log.SetStdLogger(logFactory.Logger())
|
||||||
}
|
}
|
||||||
if workingDir != "" {
|
if workingDir != "" {
|
||||||
_, err := os.Stat(workingDir)
|
_, err := os.Stat(workingDir)
|
||||||
|
|||||||
@@ -0,0 +1,107 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/sagernet/sing-box/daemon"
|
||||||
|
"github.com/sagernet/sing-box/log"
|
||||||
|
"github.com/sagernet/sing/common"
|
||||||
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
"google.golang.org/grpc"
|
||||||
|
"google.golang.org/grpc/codes"
|
||||||
|
"google.golang.org/grpc/status"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
commandAPIFlagURL string
|
||||||
|
commandAPIFlagSecret string
|
||||||
|
commandAPIServerURL string
|
||||||
|
)
|
||||||
|
|
||||||
|
var commandAPI = &cobra.Command{
|
||||||
|
Use: "api <command>",
|
||||||
|
Short: "API service client",
|
||||||
|
DisableFlagParsing: true,
|
||||||
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
err := runAPI(args)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||||
|
targetCommand, remainingArgs, err := commandAPIRoot.Find(args)
|
||||||
|
if err != nil || len(remainingArgs) > 0 {
|
||||||
|
return nil, cobra.ShellCompDirectiveNoFileComp
|
||||||
|
}
|
||||||
|
return common.Map(common.Filter(targetCommand.Commands(), func(it *cobra.Command) bool {
|
||||||
|
return it.IsAvailableCommand() && strings.HasPrefix(it.Name(), toComplete)
|
||||||
|
}), func(it *cobra.Command) string {
|
||||||
|
return it.Name() + "\t" + it.Short
|
||||||
|
}), cobra.ShellCompDirectiveNoFileComp
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
var commandAPIRoot = &cobra.Command{
|
||||||
|
Use: "api",
|
||||||
|
Short: "API service client",
|
||||||
|
SilenceUsage: true,
|
||||||
|
SilenceErrors: true,
|
||||||
|
CompletionOptions: cobra.CompletionOptions{DisableDefaultCmd: true},
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
commandAPIRoot.PersistentFlags().StringVar(&commandAPIFlagURL, "url", "", "API service URL (default: $BOX_API_URL)")
|
||||||
|
commandAPIRoot.PersistentFlags().StringVar(&commandAPIFlagSecret, "secret", "", "API service secret (default: $BOX_API_SECRET)")
|
||||||
|
mainCommand.AddCommand(commandAPI)
|
||||||
|
}
|
||||||
|
|
||||||
|
func runAPI(args []string) error {
|
||||||
|
commandAPIRoot.SetArgs(append([]string{}, args...))
|
||||||
|
err := commandAPIRoot.Execute()
|
||||||
|
if err == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
grpcStatus, isStatus := status.FromError(err)
|
||||||
|
if !isStatus {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
switch grpcStatus.Code() {
|
||||||
|
case codes.Unavailable:
|
||||||
|
return E.New("failed to connect to API service at ", commandAPIServerURL, ": ", grpcStatus.Message())
|
||||||
|
case codes.Unknown:
|
||||||
|
return E.New(grpcStatus.Message())
|
||||||
|
case codes.Unimplemented:
|
||||||
|
return E.New(grpcStatus.Code().String(), ": ", grpcStatus.Message(), " (client API version ", daemon.APIVersion, ")")
|
||||||
|
default:
|
||||||
|
return E.New(grpcStatus.Code().String(), ": ", grpcStatus.Message())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func createAPIClient() (*grpc.ClientConn, daemon.StartedServiceClient, error) {
|
||||||
|
serverURL := commandAPIFlagURL
|
||||||
|
if serverURL == "" {
|
||||||
|
serverURL = os.Getenv("BOX_API_URL")
|
||||||
|
}
|
||||||
|
if serverURL == "" {
|
||||||
|
return nil, nil, E.New("missing API service URL, set --url or BOX_API_URL")
|
||||||
|
}
|
||||||
|
if !strings.Contains(serverURL, "://") {
|
||||||
|
serverURL = "http://" + serverURL
|
||||||
|
}
|
||||||
|
commandAPIServerURL = serverURL
|
||||||
|
secret := commandAPIFlagSecret
|
||||||
|
if secret == "" {
|
||||||
|
secret = os.Getenv("BOX_API_SECRET")
|
||||||
|
}
|
||||||
|
clientConn, err := daemon.NewRemoteClient(daemon.RemoteClientOptions{
|
||||||
|
ServerURL: serverURL,
|
||||||
|
Secret: secret,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
return clientConn, daemon.NewStartedServiceClient(clientConn), nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/sagernet/sing-box/daemon"
|
||||||
|
"github.com/sagernet/sing/common"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
var commandAPIConnection = &cobra.Command{
|
||||||
|
Use: "connection",
|
||||||
|
Short: "Manage connections",
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
commandAPIRoot.AddCommand(commandAPIConnection)
|
||||||
|
}
|
||||||
|
|
||||||
|
func fetchConnections(client daemon.StartedServiceClient) ([]*daemon.Connection, error) {
|
||||||
|
stream, err := client.SubscribeConnections(globalCtx, &daemon.SubscribeConnectionsRequest{Interval: int64(time.Second)})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
events, err := stream.Recv()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
connections := common.FilterNotNil(common.Map(events.GetEvents(), func(it *daemon.ConnectionEvent) *daemon.Connection {
|
||||||
|
return it.GetConnection()
|
||||||
|
}))
|
||||||
|
common.SortBy(connections, func(it *daemon.Connection) int64 {
|
||||||
|
return it.GetCreatedAt()
|
||||||
|
})
|
||||||
|
return connections, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/sagernet/sing-box/daemon"
|
||||||
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
"google.golang.org/protobuf/types/known/emptypb"
|
||||||
|
)
|
||||||
|
|
||||||
|
var commandAPIConnectionCloseFlagAll bool
|
||||||
|
|
||||||
|
var commandAPIConnectionClose = &cobra.Command{
|
||||||
|
Use: "close <id>",
|
||||||
|
Short: "Close connections",
|
||||||
|
Long: "Close connections.\n\nThe id must be a full UUID; the service reports success for an unknown or already closed connection.",
|
||||||
|
Args: cobra.MaximumNArgs(1),
|
||||||
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
|
return runAPIConnectionClose(args)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
commandAPIConnectionClose.Flags().BoolVar(&commandAPIConnectionCloseFlagAll, "all", false, "Close all connections")
|
||||||
|
commandAPIConnection.AddCommand(commandAPIConnectionClose)
|
||||||
|
}
|
||||||
|
|
||||||
|
func runAPIConnectionClose(args []string) error {
|
||||||
|
if commandAPIConnectionCloseFlagAll {
|
||||||
|
if len(args) > 0 {
|
||||||
|
return E.New("--all takes no connection id")
|
||||||
|
}
|
||||||
|
} else if len(args) == 0 {
|
||||||
|
return E.New("missing connection id")
|
||||||
|
}
|
||||||
|
clientConn, client, err := createAPIClient()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer clientConn.Close()
|
||||||
|
if commandAPIConnectionCloseFlagAll {
|
||||||
|
_, err = client.CloseAllConnections(globalCtx, &emptypb.Empty{})
|
||||||
|
} else {
|
||||||
|
_, err = client.CloseConnection(globalCtx, &daemon.CloseConnectionRequest{Id: args[0]})
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
@@ -0,0 +1,201 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"slices"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/sagernet/sing-box/daemon"
|
||||||
|
"github.com/sagernet/sing/common"
|
||||||
|
"github.com/sagernet/sing/common/byteformats"
|
||||||
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
var commandAPIConnectionListFlagColumns []string
|
||||||
|
|
||||||
|
type connectionRate struct {
|
||||||
|
uplink int64
|
||||||
|
downlink int64
|
||||||
|
}
|
||||||
|
|
||||||
|
type connectionColumn struct {
|
||||||
|
header string
|
||||||
|
value func(connection *daemon.Connection, rates map[string]connectionRate) string
|
||||||
|
}
|
||||||
|
|
||||||
|
var connectionColumnNames = []string{
|
||||||
|
"id", "network", "source", "destination", "inbound", "outbound",
|
||||||
|
"chain", "rule", "protocol", "user", "process", "created", "rate", "total",
|
||||||
|
}
|
||||||
|
|
||||||
|
var connectionColumns = map[string]connectionColumn{
|
||||||
|
"id": {"ID", func(connection *daemon.Connection, _ map[string]connectionRate) string {
|
||||||
|
return connection.GetId()
|
||||||
|
}},
|
||||||
|
"network": {"NETWORK", func(connection *daemon.Connection, _ map[string]connectionRate) string {
|
||||||
|
return connection.GetNetwork()
|
||||||
|
}},
|
||||||
|
"source": {"SOURCE", func(connection *daemon.Connection, _ map[string]connectionRate) string {
|
||||||
|
return connection.GetSource()
|
||||||
|
}},
|
||||||
|
"destination": {"DESTINATION", func(connection *daemon.Connection, _ map[string]connectionRate) string {
|
||||||
|
return connectionDestination(connection)
|
||||||
|
}},
|
||||||
|
"inbound": {"INBOUND", func(connection *daemon.Connection, _ map[string]connectionRate) string {
|
||||||
|
if connection.GetInbound() == "" {
|
||||||
|
return connection.GetInboundType()
|
||||||
|
}
|
||||||
|
return connection.GetInboundType() + "/" + connection.GetInbound()
|
||||||
|
}},
|
||||||
|
"outbound": {"OUTBOUND", func(connection *daemon.Connection, _ map[string]connectionRate) string {
|
||||||
|
return connection.GetOutbound()
|
||||||
|
}},
|
||||||
|
"chain": {"CHAIN", func(connection *daemon.Connection, _ map[string]connectionRate) string {
|
||||||
|
chain := slices.Clone(connection.GetChainList())
|
||||||
|
slices.Reverse(chain)
|
||||||
|
return strings.Join(chain, "/")
|
||||||
|
}},
|
||||||
|
"rule": {"RULE", func(connection *daemon.Connection, _ map[string]connectionRate) string {
|
||||||
|
return connection.GetRule()
|
||||||
|
}},
|
||||||
|
"protocol": {"PROTOCOL", func(connection *daemon.Connection, _ map[string]connectionRate) string {
|
||||||
|
return connection.GetProtocol()
|
||||||
|
}},
|
||||||
|
"user": {"USER", func(connection *daemon.Connection, _ map[string]connectionRate) string {
|
||||||
|
return connection.GetUser()
|
||||||
|
}},
|
||||||
|
"process": {"PROCESS", func(connection *daemon.Connection, _ map[string]connectionRate) string {
|
||||||
|
processInfo := connection.GetProcessInfo()
|
||||||
|
if processInfo.GetProcessPath() != "" {
|
||||||
|
return processInfo.GetProcessPath()
|
||||||
|
}
|
||||||
|
if len(processInfo.GetPackageNames()) > 0 {
|
||||||
|
return processInfo.GetPackageNames()[0]
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}},
|
||||||
|
"created": {"CREATED", func(connection *daemon.Connection, _ map[string]connectionRate) string {
|
||||||
|
return formatConnectionTime(connection.GetCreatedAt())
|
||||||
|
}},
|
||||||
|
"rate": {"RATE", func(connection *daemon.Connection, rates map[string]connectionRate) string {
|
||||||
|
rate, found := rates[connection.GetId()]
|
||||||
|
if !found || (rate.uplink == 0 && rate.downlink == 0) {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return "↑" + byteformats.FormatBytes(uint64(rate.uplink)) + "/s ↓" + byteformats.FormatBytes(uint64(rate.downlink)) + "/s"
|
||||||
|
}},
|
||||||
|
"total": {"TOTAL", func(connection *daemon.Connection, _ map[string]connectionRate) string {
|
||||||
|
return "↑" + byteformats.FormatBytes(uint64(connection.GetUplinkTotal())) + " ↓" + byteformats.FormatBytes(uint64(connection.GetDownlinkTotal()))
|
||||||
|
}},
|
||||||
|
}
|
||||||
|
|
||||||
|
var commandAPIConnectionList = &cobra.Command{
|
||||||
|
Use: "list",
|
||||||
|
Short: "List open connections",
|
||||||
|
Args: cobra.NoArgs,
|
||||||
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
|
return runAPIConnectionList()
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
commandAPIConnectionList.Flags().StringSliceVar(
|
||||||
|
&commandAPIConnectionListFlagColumns,
|
||||||
|
"columns",
|
||||||
|
[]string{"id", "network", "destination", "inbound", "outbound", "total"},
|
||||||
|
"Columns to display (available: "+strings.Join(connectionColumnNames, ", ")+")",
|
||||||
|
)
|
||||||
|
commandAPIConnection.AddCommand(commandAPIConnectionList)
|
||||||
|
}
|
||||||
|
|
||||||
|
func runAPIConnectionList() error {
|
||||||
|
columns := make([]connectionColumn, 0, len(commandAPIConnectionListFlagColumns))
|
||||||
|
sampleRates := false
|
||||||
|
for _, name := range commandAPIConnectionListFlagColumns {
|
||||||
|
column, found := connectionColumns[name]
|
||||||
|
if !found {
|
||||||
|
return E.New("unknown column: ", name, ", available: ", strings.Join(connectionColumnNames, ", "))
|
||||||
|
}
|
||||||
|
if name == "rate" {
|
||||||
|
sampleRates = true
|
||||||
|
}
|
||||||
|
columns = append(columns, column)
|
||||||
|
}
|
||||||
|
clientConn, client, err := createAPIClient()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer clientConn.Close()
|
||||||
|
var (
|
||||||
|
connections []*daemon.Connection
|
||||||
|
rates map[string]connectionRate
|
||||||
|
)
|
||||||
|
if sampleRates {
|
||||||
|
connections, rates, err = fetchConnectionsAndRates(client)
|
||||||
|
} else {
|
||||||
|
connections, err = fetchConnections(client)
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
table := tableWriter{
|
||||||
|
header: common.Map(columns, func(it connectionColumn) string {
|
||||||
|
return it.header
|
||||||
|
}),
|
||||||
|
emptyMessage: "no connections",
|
||||||
|
}
|
||||||
|
for _, connection := range connections {
|
||||||
|
if connection.GetClosedAt() != 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
table.addRow(common.Map(columns, func(it connectionColumn) string {
|
||||||
|
return it.value(connection, rates)
|
||||||
|
})...)
|
||||||
|
}
|
||||||
|
table.flush()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func connectionDestination(connection *daemon.Connection) string {
|
||||||
|
destination := connection.GetDestination()
|
||||||
|
domain := connection.GetDomain()
|
||||||
|
if domain == "" {
|
||||||
|
return destination
|
||||||
|
}
|
||||||
|
portIndex := strings.LastIndex(destination, ":")
|
||||||
|
if portIndex == -1 {
|
||||||
|
return domain
|
||||||
|
}
|
||||||
|
return domain + destination[portIndex:]
|
||||||
|
}
|
||||||
|
|
||||||
|
func fetchConnectionsAndRates(client daemon.StartedServiceClient) ([]*daemon.Connection, map[string]connectionRate, error) {
|
||||||
|
stream, err := client.SubscribeConnections(globalCtx, &daemon.SubscribeConnectionsRequest{Interval: int64(time.Second)})
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
initialEvents, err := stream.Recv()
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
connections := common.FilterNotNil(common.Map(initialEvents.GetEvents(), func(it *daemon.ConnectionEvent) *daemon.Connection {
|
||||||
|
return it.GetConnection()
|
||||||
|
}))
|
||||||
|
common.SortBy(connections, func(it *daemon.Connection) int64 {
|
||||||
|
return it.GetCreatedAt()
|
||||||
|
})
|
||||||
|
updateEvents, err := stream.Recv()
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
rates := make(map[string]connectionRate, len(updateEvents.GetEvents()))
|
||||||
|
for _, event := range updateEvents.GetEvents() {
|
||||||
|
rates[event.GetId()] = connectionRate{
|
||||||
|
uplink: event.GetUplinkDelta(),
|
||||||
|
downlink: event.GetDownlinkDelta(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return connections, rates, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/sagernet/sing-box/daemon"
|
||||||
|
"github.com/sagernet/sing/common"
|
||||||
|
"github.com/sagernet/sing/common/byteformats"
|
||||||
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
|
F "github.com/sagernet/sing/common/format"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
var commandAPIConnectionShow = &cobra.Command{
|
||||||
|
Use: "show <id>",
|
||||||
|
Short: "Print connection details",
|
||||||
|
Args: cobra.ExactArgs(1),
|
||||||
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
|
return runAPIConnectionShow(args[0])
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
commandAPIConnection.AddCommand(commandAPIConnectionShow)
|
||||||
|
}
|
||||||
|
|
||||||
|
func runAPIConnectionShow(connectionID string) error {
|
||||||
|
clientConn, client, err := createAPIClient()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer clientConn.Close()
|
||||||
|
connections, err := fetchConnections(client)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
connection := common.Find(connections, func(it *daemon.Connection) bool {
|
||||||
|
return it.GetId() == connectionID
|
||||||
|
})
|
||||||
|
if connection == nil {
|
||||||
|
return E.New("connection not found: ", connectionID)
|
||||||
|
}
|
||||||
|
state := "open"
|
||||||
|
if connection.GetClosedAt() != 0 {
|
||||||
|
state = "closed"
|
||||||
|
}
|
||||||
|
var ipVersion string
|
||||||
|
if connection.GetIpVersion() != 0 {
|
||||||
|
ipVersion = F.ToString(connection.GetIpVersion())
|
||||||
|
}
|
||||||
|
inbound := connection.GetInboundType()
|
||||||
|
if connection.GetInbound() != "" {
|
||||||
|
inbound = connection.GetInboundType() + "/" + connection.GetInbound()
|
||||||
|
}
|
||||||
|
outbound := connection.GetOutbound()
|
||||||
|
if outbound != "" && connection.GetOutboundType() != "" {
|
||||||
|
outbound = F.ToString(outbound, " (", connection.GetOutboundType(), ")")
|
||||||
|
}
|
||||||
|
var block blockWriter
|
||||||
|
block.addLine("ID", connection.GetId())
|
||||||
|
block.addLine("State", state)
|
||||||
|
block.addLine("Created", formatConnectionTime(connection.GetCreatedAt()))
|
||||||
|
block.addLine("Closed", formatConnectionTime(connection.GetClosedAt()))
|
||||||
|
block.addLine("Network", connection.GetNetwork())
|
||||||
|
block.addLine("IP version", ipVersion)
|
||||||
|
block.addLine("Protocol", connection.GetProtocol())
|
||||||
|
block.addLine("Inbound", inbound)
|
||||||
|
block.addLine("Source", connection.GetSource())
|
||||||
|
block.addLine("Destination", connection.GetDestination())
|
||||||
|
block.addLine("Domain", connection.GetDomain())
|
||||||
|
block.addLine("User", connection.GetUser())
|
||||||
|
block.addLine("Process", formatProcessInfo(connection.GetProcessInfo()))
|
||||||
|
block.addLine("Rule", connection.GetRule())
|
||||||
|
block.addLine("Outbound", outbound)
|
||||||
|
block.addLine("Chain", strings.Join(connection.GetChainList(), " <- "))
|
||||||
|
block.addLine("From outbound", connection.GetFromOutbound())
|
||||||
|
block.addLine("Uplink", byteformats.FormatBytes(uint64(connection.GetUplinkTotal())))
|
||||||
|
block.addLine("Downlink", byteformats.FormatBytes(uint64(connection.GetDownlinkTotal())))
|
||||||
|
block.flush()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func formatConnectionTime(timestamp int64) string {
|
||||||
|
if timestamp == 0 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return time.UnixMilli(timestamp).Local().Format(time.RFC3339)
|
||||||
|
}
|
||||||
|
|
||||||
|
func formatProcessInfo(processInfo *daemon.ProcessInfo) string {
|
||||||
|
if processInfo == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
var process string
|
||||||
|
if processInfo.GetProcessPath() != "" {
|
||||||
|
process = processInfo.GetProcessPath()
|
||||||
|
} else if len(processInfo.GetPackageNames()) > 0 {
|
||||||
|
process = processInfo.GetPackageNames()[0]
|
||||||
|
}
|
||||||
|
if process == "" {
|
||||||
|
if processInfo.GetUserId() != -1 {
|
||||||
|
process = F.ToString(processInfo.GetUserId())
|
||||||
|
}
|
||||||
|
} else if processInfo.GetUserName() != "" {
|
||||||
|
process = F.ToString(process, " (", processInfo.GetUserName(), ")")
|
||||||
|
} else if processInfo.GetUserId() != -1 {
|
||||||
|
process = F.ToString(process, " (", processInfo.GetUserId(), ")")
|
||||||
|
}
|
||||||
|
return process
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/sagernet/sing-box/daemon"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
"google.golang.org/protobuf/types/known/emptypb"
|
||||||
|
)
|
||||||
|
|
||||||
|
var commandAPIGroup = &cobra.Command{
|
||||||
|
Use: "group",
|
||||||
|
Short: "Manage outbound groups",
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
commandAPIRoot.AddCommand(commandAPIGroup)
|
||||||
|
}
|
||||||
|
|
||||||
|
func fetchGroups(client daemon.StartedServiceClient) ([]*daemon.Group, error) {
|
||||||
|
stream, err := client.SubscribeGroups(globalCtx, &emptypb.Empty{})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
groups, err := stream.Recv()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return groups.GetGroup(), nil
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user