mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-07 06:09:42 +00:00
Compare commits
1067 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
436a3e7f54 | ||
|
|
7015bad905 | ||
|
|
cf8665748b | ||
|
|
1b8da90cbb | ||
|
|
6012585067 | ||
|
|
f162876600 | ||
|
|
6555ae5b0a | ||
|
|
f5af059ef4 | ||
|
|
cb8651ec68 | ||
|
|
7c0b0a4e3e | ||
|
|
880d1a7ccd | ||
|
|
744b25190a | ||
|
|
3792bb4928 | ||
|
|
9049902ced | ||
|
|
5f93dc72fd | ||
|
|
09dadd7e01 | ||
|
|
60b92f98db | ||
|
|
97f315d488 | ||
|
|
f3676d7f18 | ||
|
|
742dbdb68a | ||
|
|
2d59c968ca | ||
|
|
ad22247c9e | ||
|
|
f38920c338 | ||
|
|
8f90b21a5d | ||
|
|
ff0e6813c6 | ||
|
|
fa5e4d57fd | ||
|
|
876973f071 | ||
|
|
b994af9209 | ||
|
|
1f6cde652e | ||
|
|
3bf6db1c08 | ||
|
|
e70ffc9d7c | ||
|
|
065cfe3b9d | ||
|
|
def9873a70 | ||
|
|
618aa26454 | ||
|
|
924a7bc533 | ||
|
|
ef85277a1b | ||
|
|
876375f2c3 | ||
|
|
f70ee480ba | ||
|
|
6d88c3ab05 | ||
|
|
57c969b0ed | ||
|
|
ae58a7007b | ||
|
|
11c924bbe7 | ||
|
|
8bab4f60ef | ||
|
|
bef9a54f4a | ||
|
|
288b19c3f7 | ||
|
|
40f7e9d33e | ||
|
|
fab53dda66 | ||
|
|
a4e8bf9857 | ||
|
|
2cdf84cdab | ||
|
|
fbe83f729d | ||
|
|
4371a084ec | ||
|
|
d13f58088a | ||
|
|
f75bef7c03 | ||
|
|
3d7e93a688 | ||
|
|
a4dda304d2 | ||
|
|
124c3ef2d7 | ||
|
|
c3a2fca76a | ||
|
|
b60ebfe1c6 | ||
|
|
1d7639b3f4 | ||
|
|
2d972752ff | ||
|
|
616f0b2a21 | ||
|
|
94659ba890 | ||
|
|
d65bc068de | ||
|
|
1ca0354cf2 | ||
|
|
b1fcd4d27b | ||
|
|
74aa07eba8 | ||
|
|
d1a98212ee | ||
|
|
75a31c79ae | ||
|
|
da0b36cb91 | ||
|
|
aa206d034d | ||
|
|
765ab60753 | ||
|
|
44e4ec573d | ||
|
|
0ed793d6d0 | ||
|
|
272e25ff07 | ||
|
|
63127ab181 | ||
|
|
004f3532a0 | ||
|
|
abe1af7b4f | ||
|
|
01df1647bc | ||
|
|
9d8eaf0ccb | ||
|
|
7e4c33d27e | ||
|
|
c164601acf | ||
|
|
3b32da4f5c | ||
|
|
1bc3de8df4 | ||
|
|
374e0cbbc3 | ||
|
|
313921da56 | ||
|
|
2d0e219197 | ||
|
|
dc64d1738a | ||
|
|
89e8d99294 | ||
|
|
66a238045f | ||
|
|
33b82b5669 | ||
|
|
f59d509b15 | ||
|
|
6966539b86 | ||
|
|
0e5dc15005 | ||
|
|
a74f685a5d | ||
|
|
05c7aacfa5 | ||
|
|
ace80c29e7 | ||
|
|
bfb1380dd2 | ||
|
|
ea19802d3f | ||
|
|
fef4f13b8f | ||
|
|
c4fc0f4ecf | ||
|
|
ba3acdac75 | ||
|
|
aad2d68edb | ||
|
|
9e5935aea5 | ||
|
|
129b4a2135 | ||
|
|
82649ab2a7 | ||
|
|
1ba5d25819 | ||
|
|
daa3f8699b | ||
|
|
df7fda9e0c | ||
|
|
484f69f16b | ||
|
|
7c8280934a | ||
|
|
85902b358a | ||
|
|
5931cb59ab | ||
|
|
fd73aab7d0 | ||
|
|
d13fbe5549 | ||
|
|
ed4c00e4f4 | ||
|
|
07282ec39f | ||
|
|
2d998aba43 | ||
|
|
2e0019c8c8 | ||
|
|
96e9608036 | ||
|
|
9d5bb1b2b6 | ||
|
|
67dab9b6d2 | ||
|
|
6fc5f88a3b | ||
|
|
e0cec79ad6 | ||
|
|
1a9e11d86d | ||
|
|
1235d18d67 | ||
|
|
8f25b66760 | ||
|
|
2bc0850b0f | ||
|
|
29176dd9bf | ||
|
|
aedcd1bcc0 | ||
|
|
b1262d54de | ||
|
|
bc4a97774f | ||
|
|
ee3cd44f97 | ||
|
|
726bd0d63b | ||
|
|
ce9640773c | ||
|
|
7ce92118e4 | ||
|
|
e12c5fe007 | ||
|
|
86ff0d86db | ||
|
|
b4236b04c6 | ||
|
|
d34dc397e8 | ||
|
|
f2e4d5f06c | ||
|
|
da7e2f2580 | ||
|
|
e07a20a771 | ||
|
|
ae1b1da342 | ||
|
|
a61d7fe115 | ||
|
|
b4d1e89696 | ||
|
|
a0d90717c3 | ||
|
|
5c2f1f36e8 | ||
|
|
0b084956e6 | ||
|
|
8c61e7d227 | ||
|
|
d7342586a6 | ||
|
|
242e3d007c | ||
|
|
d4b6485102 | ||
|
|
370ab6307a | ||
|
|
83b10fba62 | ||
|
|
1921bce4c7 | ||
|
|
669fb62a54 | ||
|
|
1a5920ee47 | ||
|
|
9c6e3ff1d7 | ||
|
|
ca78601ada | ||
|
|
2edce12759 | ||
|
|
ccc604c0f4 | ||
|
|
d3bf8c2417 | ||
|
|
dc774f0f94 | ||
|
|
f2059947bf | ||
|
|
eccd5b6ff0 | ||
|
|
776dc7ec52 | ||
|
|
082c4f1104 | ||
|
|
06a7e181cd | ||
|
|
bf91e16b5d | ||
|
|
65945b3462 | ||
|
|
31f0c35077 | ||
|
|
fc2dc9a019 | ||
|
|
04645aacc4 | ||
|
|
c91a8711e3 | ||
|
|
7373dae026 | ||
|
|
ca3b819151 | ||
|
|
ba79b94e06 | ||
|
|
bfc3acb834 | ||
|
|
ac67cd7f9a | ||
|
|
9a2c6a7619 | ||
|
|
3100d4f902 | ||
|
|
aace200899 | ||
|
|
a843165cb4 | ||
|
|
36473e3889 | ||
|
|
e2fcab34b7 | ||
|
|
abdf92c084 | ||
|
|
32fc6482cc | ||
|
|
ce14ea6fe5 | ||
|
|
2f57013e02 | ||
|
|
ad84944d20 | ||
|
|
0ab95b1b87 | ||
|
|
58153c3579 | ||
|
|
746f53ba07 | ||
|
|
ff971563db | ||
|
|
242fb7db14 | ||
|
|
ad36738f57 | ||
|
|
c833b16544 | ||
|
|
1c5b350c2b | ||
|
|
9301e39af7 | ||
|
|
86e3b977e4 | ||
|
|
bc330ff0ea | ||
|
|
771480e368 | ||
|
|
c875ff923a | ||
|
|
3dfb44de31 | ||
|
|
2266c3877c | ||
|
|
f4486bc075 | ||
|
|
0436a65baa | ||
|
|
30d6bd144b | ||
|
|
d8381e9486 | ||
|
|
feaecbe177 | ||
|
|
85d796f906 | ||
|
|
0a3af12ee9 | ||
|
|
3925540517 | ||
|
|
3b630fe546 | ||
|
|
c69c4ae8a0 | ||
|
|
b4369470cb | ||
|
|
4a44b18b97 | ||
|
|
2bd6daeb8d | ||
|
|
1ae98b7fe1 | ||
|
|
44ca315c75 | ||
|
|
af20b13c7a | ||
|
|
1f6be38145 | ||
|
|
8b3a7486c7 | ||
|
|
62cd9fffa3 | ||
|
|
7e874eaa7c | ||
|
|
1c7780a423 | ||
|
|
07b77443dd | ||
|
|
4ba1be2dc0 | ||
|
|
6362a7bba5 | ||
|
|
1740715c00 | ||
|
|
21501cbf81 | ||
|
|
d5f3d6111e | ||
|
|
bd04f92087 | ||
|
|
942b2b05e7 | ||
|
|
b8064b9b4b | ||
|
|
f94d03465a | ||
|
|
4e7aafeec1 | ||
|
|
d820b8036e | ||
|
|
3907c17cf5 | ||
|
|
b12fa97a38 | ||
|
|
b9b431e82d | ||
|
|
9f2a2e44a3 | ||
|
|
aaf6c1ea8b | ||
|
|
b2f0278180 | ||
|
|
530eba1b91 | ||
|
|
812d312a9e | ||
|
|
5d256e1d80 | ||
|
|
d02a0c9b3a | ||
|
|
bdbd060229 | ||
|
|
bf04962994 | ||
|
|
33f2ddb696 | ||
|
|
e444519889 | ||
|
|
a47aa8c282 | ||
|
|
0c29aeb9be | ||
|
|
2b4a91cc80 | ||
|
|
9ffc4155dd | ||
|
|
979282a0d4 | ||
|
|
c63818f355 | ||
|
|
c400372a79 | ||
|
|
56f3bdd746 | ||
|
|
cc0367b079 | ||
|
|
e41bbcb2bb | ||
|
|
b35f43d79e | ||
|
|
e9f11e204e | ||
|
|
1b63c9f6ad | ||
|
|
21d99e355c | ||
|
|
f0adbcd5e1 | ||
|
|
bfcf3cfbf1 | ||
|
|
ef5495bfb2 | ||
|
|
c93ee0d65d | ||
|
|
db3e48a81a | ||
|
|
d9b87e877d | ||
|
|
b6175132eb | ||
|
|
57d6c7a3b3 | ||
|
|
d65a282e9d | ||
|
|
801ecaa41c | ||
|
|
49bf735c22 | ||
|
|
cb55944ff6 | ||
|
|
9c225f8d77 | ||
|
|
365fce922c | ||
|
|
fbfc5ecda3 | ||
|
|
4001f48a28 | ||
|
|
22124c25d1 | ||
|
|
17f5bcbd1c | ||
|
|
b7ebb3ea3d | ||
|
|
387830e07a | ||
|
|
da94d40738 | ||
|
|
417b5ed6cc | ||
|
|
005581ef62 | ||
|
|
050390c5c4 | ||
|
|
2648f1ba89 | ||
|
|
d9d31521f9 | ||
|
|
8e24d1b909 | ||
|
|
36fc0daa12 | ||
|
|
44d3854a13 | ||
|
|
1dbc35f13d | ||
|
|
11691fb44a | ||
|
|
acc5592f59 | ||
|
|
614921276e | ||
|
|
3f45a11f12 | ||
|
|
e3464add50 | ||
|
|
18bb4a71c2 | ||
|
|
85e9da82b0 | ||
|
|
99d046ca11 | ||
|
|
0b372a344c | ||
|
|
ffa0f0afd9 | ||
|
|
e21dac21c8 | ||
|
|
0108745065 | ||
|
|
e2a1cd12c3 | ||
|
|
f6ff232106 | ||
|
|
b0c690d836 | ||
|
|
7246624983 | ||
|
|
471c46ad8e | ||
|
|
59032d515b | ||
|
|
d218c9a983 | ||
|
|
243f6e755b | ||
|
|
67b76809ea | ||
|
|
77231bfc6c | ||
|
|
e614226926 | ||
|
|
65e15d74fc | ||
|
|
7ceb81cc83 | ||
|
|
d3f7eea0a3 | ||
|
|
c2f13a1496 | ||
|
|
faae2709d9 | ||
|
|
d595006d1f | ||
|
|
a8d23b5439 | ||
|
|
cfda807057 | ||
|
|
c601a2986f | ||
|
|
8483464aab | ||
|
|
dca69e9b6e | ||
|
|
9450dc84da | ||
|
|
3a2724ec58 | ||
|
|
ee84291997 | ||
|
|
fd9229c467 | ||
|
|
ac5a4fe70f | ||
|
|
873b4f3178 | ||
|
|
beb5d26e6d | ||
|
|
221b7cbf76 | ||
|
|
7d34f1e883 | ||
|
|
208707c00b | ||
|
|
cb41c04551 | ||
|
|
730c6aff11 | ||
|
|
3d40c7603d | ||
|
|
dec7a9a01c | ||
|
|
5f42888b61 | ||
|
|
489c38ec5b | ||
|
|
949fc47f31 | ||
|
|
4d85079372 | ||
|
|
335f9394a5 | ||
|
|
f939a7b349 | ||
|
|
09fdb068d2 | ||
|
|
024c29b180 | ||
|
|
2b0d1a2190 | ||
|
|
d0d71c93af | ||
|
|
da1e52357f | ||
|
|
a05a54b38e | ||
|
|
a0685d804d | ||
|
|
954781262c | ||
|
|
0777bad2c3 | ||
|
|
3159b06988 | ||
|
|
e7ff6fbffc | ||
|
|
6fec92c012 | ||
|
|
e50abbb250 | ||
|
|
8e25226574 | ||
|
|
9636d82b37 | ||
|
|
c3aa6b9cda | ||
|
|
3ef8b3dcbb | ||
|
|
c41554109b | ||
|
|
67b94d3533 | ||
|
|
d52c0633c8 | ||
|
|
4e4c117023 | ||
|
|
cb0d30cf42 | ||
|
|
2d65402ced | ||
|
|
e15b2cc5d6 | ||
|
|
c024905d56 | ||
|
|
6f17624742 | ||
|
|
6f2e6ed887 | ||
|
|
5f1e66d64b | ||
|
|
1f31fdc257 | ||
|
|
df9965e129 | ||
|
|
61e9c31f0d | ||
|
|
a0b35ebd3e | ||
|
|
951ec567c7 | ||
|
|
31494267e5 | ||
|
|
70e4cbc023 | ||
|
|
8d903a09e2 | ||
|
|
63451fb781 | ||
|
|
1e609acb03 | ||
|
|
69194118df | ||
|
|
0f309377ec | ||
|
|
49a19a52c8 | ||
|
|
1a39f7e5c6 | ||
|
|
a5fed64f38 | ||
|
|
79858d4372 | ||
|
|
61897ae16c | ||
|
|
5e0a8ed232 | ||
|
|
5993cc857a | ||
|
|
6a0174293e | ||
|
|
44bb8f6f16 | ||
|
|
a33cad4b70 | ||
|
|
0639cce784 | ||
|
|
a8f227f759 | ||
|
|
f077836bf5 | ||
|
|
6d7847f2df | ||
|
|
221c14cf0e | ||
|
|
6735b2686b | ||
|
|
55ff6beb7d | ||
|
|
4ae41513ac | ||
|
|
438a225487 | ||
|
|
e135696530 | ||
|
|
9135772f89 | ||
|
|
0dc212d97c | ||
|
|
45e8d5c50e | ||
|
|
37ec90c436 | ||
|
|
010541197c | ||
|
|
bdb918cdb3 | ||
|
|
64c986ebbb | ||
|
|
a4c4bf4b58 | ||
|
|
60b1b2ca4a | ||
|
|
8e0f1de25a | ||
|
|
dba6d68108 | ||
|
|
d226834eef | ||
|
|
2facf14443 | ||
|
|
6bd44f0e4b | ||
|
|
1dcb878796 | ||
|
|
0e0169d22b | ||
|
|
50c8a84037 | ||
|
|
1975adc48f | ||
|
|
71564f0d10 | ||
|
|
5a32082624 | ||
|
|
45aa78d953 | ||
|
|
86e8614934 | ||
|
|
ead89c767a | ||
|
|
8bae4975fb | ||
|
|
7a5146ea74 | ||
|
|
9633c247f0 | ||
|
|
78640532e1 | ||
|
|
46ee427ee3 | ||
|
|
0c2b0081b5 | ||
|
|
f133a7f9fd | ||
|
|
a6c9ee446a | ||
|
|
153aaa6d21 | ||
|
|
e5901dad91 | ||
|
|
9318388007 | ||
|
|
bdd75e1171 | ||
|
|
7d22ddd710 | ||
|
|
7e82c8e279 | ||
|
|
db6a0e6ad9 | ||
|
|
648d035a0f | ||
|
|
7ebf2f010c | ||
|
|
3db4421aa7 | ||
|
|
9fb59e128b | ||
|
|
c7c6e5917a | ||
|
|
7b418b3adf | ||
|
|
1c8d662e30 | ||
|
|
d4bfeab36c | ||
|
|
e1b1032df9 | ||
|
|
329439d0ae | ||
|
|
0b1cfb2102 | ||
|
|
1e4d2fd053 | ||
|
|
716378bd6b | ||
|
|
de48d3aaec | ||
|
|
b5b195e628 | ||
|
|
23be4c01df | ||
|
|
86782f3479 | ||
|
|
a96c205830 | ||
|
|
9274881c18 | ||
|
|
24c5f07153 | ||
|
|
789ff702ac | ||
|
|
9b6facf3b0 | ||
|
|
d503190647 | ||
|
|
c4d9c03930 | ||
|
|
d7d70b707f | ||
|
|
dbe1e3f577 | ||
|
|
bb7f03857c | ||
|
|
53b43353eb | ||
|
|
b197556447 | ||
|
|
42d4781a96 | ||
|
|
d991cc3b96 | ||
|
|
4d48d35ad7 | ||
|
|
b7ba8f8e93 | ||
|
|
dff510c181 | ||
|
|
1eead0e885 | ||
|
|
e301387896 | ||
|
|
c49e544781 | ||
|
|
d48db501e0 | ||
|
|
ec4e17f75c | ||
|
|
17e69e67b1 | ||
|
|
c4f9f7da06 | ||
|
|
c367476036 | ||
|
|
f5712c4198 | ||
|
|
1aa0da3382 | ||
|
|
27d69894d4 | ||
|
|
7133a07f38 | ||
|
|
627d8cfe69 | ||
|
|
16b992d705 | ||
|
|
3d9c844dca | ||
|
|
c0de9455bb | ||
|
|
65e1871cd7 | ||
|
|
0a431594f8 | ||
|
|
7b22ef4270 | ||
|
|
f77a58b2dc | ||
|
|
142a138cfc | ||
|
|
e6fdf5ad8d | ||
|
|
5700e18257 | ||
|
|
50a77fedca | ||
|
|
51e3d5f7bc | ||
|
|
7f859978dd | ||
|
|
d8134e8a21 | ||
|
|
614d91e0b1 | ||
|
|
30067fc7d7 | ||
|
|
ec29597dbd | ||
|
|
ad211a63f3 | ||
|
|
6b596bd05f | ||
|
|
510b85fd23 | ||
|
|
e3c8f3fd6f | ||
|
|
f9175db28e | ||
|
|
f4798d05e7 | ||
|
|
a2a0f62135 | ||
|
|
d923f0e01b | ||
|
|
2fc16ee13d | ||
|
|
152e579f7e | ||
|
|
90914bb2de | ||
|
|
95fa835191 | ||
|
|
4e37df26a3 | ||
|
|
5e606573b1 | ||
|
|
b3974cb52a | ||
|
|
b7c206c44b | ||
|
|
49c1e47736 | ||
|
|
4e1319d874 | ||
|
|
a9436aa9af | ||
|
|
d503f07564 | ||
|
|
aa7750bfd3 | ||
|
|
8872d1f389 | ||
|
|
f21af4068f | ||
|
|
f4ca6bbb52 | ||
|
|
869d0156ce | ||
|
|
744e893dce | ||
|
|
fe9ac10f02 | ||
|
|
6fb80f226a | ||
|
|
ff19bab800 | ||
|
|
962c2160c7 | ||
|
|
168da33d8b | ||
|
|
b6b25dc9f3 | ||
|
|
3ca17fdc03 | ||
|
|
2249708097 | ||
|
|
2fcaa7d260 | ||
|
|
f3b0e57a54 | ||
|
|
5da92437a1 | ||
|
|
b5bc05ac2b | ||
|
|
45145fa50a | ||
|
|
dd8200e8b0 | ||
|
|
2f56547d5f | ||
|
|
82bdcfbbcb | ||
|
|
0e38e43315 | ||
|
|
63746be4d5 | ||
|
|
ee73ee365f | ||
|
|
3c53479864 | ||
|
|
4adc741de3 | ||
|
|
64da62dbe6 | ||
|
|
dd9b5faa5c | ||
|
|
51d018acc6 | ||
|
|
5eec580727 | ||
|
|
1e9a53da3f | ||
|
|
8dae044600 | ||
|
|
2d3fad2cdb | ||
|
|
a59a8f62ca | ||
|
|
35cfa7d9fb | ||
|
|
c6ccb373a2 | ||
|
|
b6368170ed | ||
|
|
35e8424293 | ||
|
|
e969d58689 | ||
|
|
ae20e3aa95 | ||
|
|
de4cb74173 | ||
|
|
4f0da87a7a | ||
|
|
97f0347715 | ||
|
|
2ffe62ba41 | ||
|
|
fe1724e7e6 | ||
|
|
2ac2da41cf | ||
|
|
ed574f9d79 | ||
|
|
e0cb26bd9e | ||
|
|
1893127e84 | ||
|
|
b02c9fb118 | ||
|
|
bca0809918 | ||
|
|
00db527377 | ||
|
|
2c6e041ae2 | ||
|
|
a0d6c654cc | ||
|
|
5115c27e72 | ||
|
|
d09c3ccb2d | ||
|
|
5c308026ac | ||
|
|
91919c6d64 | ||
|
|
7168738835 | ||
|
|
9c9b723cf5 | ||
|
|
50450923df | ||
|
|
f392edd66c | ||
|
|
24b48e5d50 | ||
|
|
47f384a0e0 | ||
|
|
88594887f9 | ||
|
|
32e2f0b1fa | ||
|
|
09ed57ad42 | ||
|
|
53a6162b0c | ||
|
|
694d851cdb | ||
|
|
8e53c30a00 | ||
|
|
63e807b0b4 | ||
|
|
012f22cc47 | ||
|
|
9d891ab5dd | ||
|
|
d0e78be867 | ||
|
|
cbedebc9dd | ||
|
|
969f9aa436 | ||
|
|
b982be5ff5 | ||
|
|
2d154ee640 | ||
|
|
49810eb153 | ||
|
|
85b88b8749 | ||
|
|
239c8b5172 | ||
|
|
8c800dc178 | ||
|
|
cdd068d99a | ||
|
|
48fa10b080 | ||
|
|
a1dbec0fcb | ||
|
|
abe668f1c3 | ||
|
|
77440c235d | ||
|
|
fd1ee48dbe | ||
|
|
205e807b66 | ||
|
|
34295adb05 | ||
|
|
7c212bef63 | ||
|
|
76f95644b7 | ||
|
|
928b90d5bc | ||
|
|
09c6c2a4f3 | ||
|
|
2b2bd733e9 | ||
|
|
0d2d7e5e71 | ||
|
|
6142e93252 | ||
|
|
ccec3376ba | ||
|
|
f497a74ec4 | ||
|
|
0e666e7d6a | ||
|
|
f498fabd27 | ||
|
|
8b49a55442 | ||
|
|
a26eb942a9 | ||
|
|
eabcafa516 | ||
|
|
6cc388c1bc | ||
|
|
62e39ddfbd | ||
|
|
80373623cd | ||
|
|
451c3945f0 | ||
|
|
00cb15d9b4 | ||
|
|
67dd59125e | ||
|
|
b6800dd125 | ||
|
|
dc9da69509 | ||
|
|
d7d964bf57 | ||
|
|
bcfe44db54 | ||
|
|
376bf6ba72 | ||
|
|
f651baab25 | ||
|
|
61752e2aab | ||
|
|
b7d3fd959e | ||
|
|
7ac05f8487 | ||
|
|
5cfc574f9a | ||
|
|
4f70822b13 | ||
|
|
0007f304d0 | ||
|
|
4afef91359 | ||
|
|
815b6db0bf | ||
|
|
433d3bf582 | ||
|
|
a335841509 | ||
|
|
26ad793d82 | ||
|
|
5337aa10f7 | ||
|
|
9f79bdae9b | ||
|
|
db84be2488 | ||
|
|
599ec62bb0 | ||
|
|
19a88300c6 | ||
|
|
b5d55e1ffb | ||
|
|
521fb83e38 | ||
|
|
553d59c32b | ||
|
|
9ed58e5186 | ||
|
|
36eaaa748c | ||
|
|
4d7b86ca26 | ||
|
|
5faf84c732 | ||
|
|
d7b819267f | ||
|
|
7417867d0f | ||
|
|
8d74905257 | ||
|
|
c38298c06e | ||
|
|
3100d587d1 | ||
|
|
ba849d0300 | ||
|
|
95df3e4b39 | ||
|
|
72492e33a0 | ||
|
|
934f1269f5 | ||
|
|
e6956d9bb0 | ||
|
|
2877900233 | ||
|
|
df1aa52e08 | ||
|
|
5fa2485a7d | ||
|
|
29f0e10411 | ||
|
|
39300a5bbf | ||
|
|
35d6268675 | ||
|
|
0abb871f3f | ||
|
|
704fca969f | ||
|
|
95debf8c80 | ||
|
|
dd94b77b2a | ||
|
|
6cfe4fa580 | ||
|
|
515c086099 | ||
|
|
34ce06ac17 | ||
|
|
a104c9881e | ||
|
|
c3e3c091cc | ||
|
|
651240113c | ||
|
|
77189bf8e9 | ||
|
|
60fd3a4542 | ||
|
|
c66f9c8d6d | ||
|
|
569088eaca | ||
|
|
a7e8dd04fe | ||
|
|
dfdd76a1bb | ||
|
|
28aac6f93b | ||
|
|
c2f47119ce | ||
|
|
d6b1d0d4fb | ||
|
|
03a861745b | ||
|
|
9a7aed20e9 | ||
|
|
b7f17d4cb1 | ||
|
|
2497c3d187 | ||
|
|
f7a084969a | ||
|
|
2900bc26a5 | ||
|
|
2334c56a96 | ||
|
|
90a5d02bf6 | ||
|
|
81d9626da9 | ||
|
|
44a2549b81 | ||
|
|
a2b8d468bc | ||
|
|
d523f0cadd | ||
|
|
99116ff097 | ||
|
|
3939ca9eb4 | ||
|
|
b5aa67b491 | ||
|
|
e42efec220 | ||
|
|
9d06aa2f6a | ||
|
|
80765a797b | ||
|
|
0b5509a1ed | ||
|
|
478d7b4a83 | ||
|
|
9d3b38141a | ||
|
|
ab3a4d902e | ||
|
|
5eab5f2437 | ||
|
|
80f632c19a | ||
|
|
6e4f18543d | ||
|
|
54586c9076 | ||
|
|
351c899807 | ||
|
|
fe45d431d7 | ||
|
|
488c2f6d05 | ||
|
|
75ab0909b3 | ||
|
|
8f82d563c1 | ||
|
|
9bbce5dba6 | ||
|
|
099adab9ed | ||
|
|
c8cbf425ac | ||
|
|
ad9c11cd92 | ||
|
|
3872c2a3f5 | ||
|
|
e6a09b49c9 | ||
|
|
db107602bd | ||
|
|
a6558a61a7 | ||
|
|
254d2b82b3 | ||
|
|
2c9fa2f738 | ||
|
|
97d9795fc9 | ||
|
|
54071b0e5d | ||
|
|
925e8316c7 | ||
|
|
99e1b74023 | ||
|
|
7d68ccca53 | ||
|
|
a090114066 | ||
|
|
a204841abb | ||
|
|
cc451809cc | ||
|
|
a605e4bab6 | ||
|
|
3f0534134d | ||
|
|
3acfb129cd | ||
|
|
6ccef66920 | ||
|
|
e9fa4e94a6 | ||
|
|
fecc0c4640 | ||
|
|
b759294975 | ||
|
|
a23e845c03 | ||
|
|
cb8373e487 | ||
|
|
8e919ddc8e | ||
|
|
832a9ab6b5 | ||
|
|
13732ac333 | ||
|
|
3e932a55f4 | ||
|
|
74e8610ec9 | ||
|
|
089a60ded6 | ||
|
|
c8eeefe194 | ||
|
|
85eeba14c1 | ||
|
|
f6f45eab39 | ||
|
|
a74065f775 | ||
|
|
48d02f7e09 | ||
|
|
e60549f8df | ||
|
|
41f4f4713e | ||
|
|
213a292fd5 | ||
|
|
79630e844b | ||
|
|
1c9e46dbb3 | ||
|
|
0a299284f8 | ||
|
|
347a5f7346 | ||
|
|
c6a903572c | ||
|
|
14f0d6d26b | ||
|
|
485f105555 | ||
|
|
686c0b776f | ||
|
|
828862ea49 | ||
|
|
c4dffa4dc8 | ||
|
|
3c1906e3d4 | ||
|
|
7147a3694c | ||
|
|
64707dbb22 | ||
|
|
554e8eeef3 | ||
|
|
5e10549543 | ||
|
|
685f45bd76 | ||
|
|
61d84dd4c1 | ||
|
|
4d10593bb1 | ||
|
|
fbb8903774 | ||
|
|
e8cac91bb7 | ||
|
|
7328ffa036 | ||
|
|
a03e828317 | ||
|
|
93d4dc70cf | ||
|
|
8e3d16e9fb | ||
|
|
07405e57b9 | ||
|
|
354c9187db | ||
|
|
af33df3004 | ||
|
|
78bfde237f | ||
|
|
7b9033d678 | ||
|
|
f784cfad46 | ||
|
|
e40c139ff1 | ||
|
|
edf4f7695d | ||
|
|
60ec03237e | ||
|
|
a91641e427 | ||
|
|
5c3992018f | ||
|
|
f5b682619f | ||
|
|
743fa745b7 | ||
|
|
39400fd381 | ||
|
|
5299ac35a6 | ||
|
|
ef76ed394c | ||
|
|
1472637de7 | ||
|
|
3b8baa85a3 | ||
|
|
73921b1024 | ||
|
|
ece140f18c | ||
|
|
5e42947fbd | ||
|
|
1bfb9b02f5 | ||
|
|
16a14c2b76 | ||
|
|
f6199c6c17 | ||
|
|
d7e7f06e88 | ||
|
|
4c4e856a1a | ||
|
|
07bbbbaf61 | ||
|
|
3236827781 | ||
|
|
0be664cc3d | ||
|
|
6cc6849ccc | ||
|
|
5d5cd71714 | ||
|
|
d248343517 | ||
|
|
64d800427f | ||
|
|
c4c896a833 | ||
|
|
b6b5bb3f75 | ||
|
|
5d69bb7383 | ||
|
|
76e222079a | ||
|
|
73abb9278d | ||
|
|
8fd843e7ce | ||
|
|
6a497a23d9 | ||
|
|
3ac74e1091 | ||
|
|
ef0fb48f1f | ||
|
|
414ef2bc3d | ||
|
|
ea791309ad | ||
|
|
706da6e431 | ||
|
|
ed116e7cea | ||
|
|
5b56f4007b | ||
|
|
e2071542bf | ||
|
|
cdb217b774 | ||
|
|
079798940b | ||
|
|
f1c24689bf | ||
|
|
1f9cf6ed7c | ||
|
|
43f218410f | ||
|
|
3fd9d5f641 | ||
|
|
f5ab8f2062 | ||
|
|
8774a8fbc2 | ||
|
|
6f4f0f03d2 | ||
|
|
00b5fdce03 | ||
|
|
baee6a0d91 | ||
|
|
ff44bcc489 | ||
|
|
c797ac4268 | ||
|
|
d22a76d4d1 | ||
|
|
a6642e0ebc | ||
|
|
3d4d260a34 | ||
|
|
8e4b9da97d | ||
|
|
2be80ba30f | ||
|
|
2e44c88d6c | ||
|
|
21eb1ce6c9 | ||
|
|
cdfd411df7 | ||
|
|
a6149ca90c | ||
|
|
642435486c | ||
|
|
fc84d6c4b7 | ||
|
|
aa4bddd6ec | ||
|
|
8ec12a1b65 | ||
|
|
0fbf552e95 | ||
|
|
09b1b120d7 | ||
|
|
557244bc3f | ||
|
|
24c5ed1cff | ||
|
|
32e55ebd0c | ||
|
|
ea3070d02b | ||
|
|
9aaba49a9f | ||
|
|
9b64be07a9 | ||
|
|
42c3c28ea7 | ||
|
|
9e9236badb | ||
|
|
560ebcec8d | ||
|
|
9b1fe4338b | ||
|
|
9188e3ad3f | ||
|
|
af65af5be9 | ||
|
|
2f0115c300 | ||
|
|
0646461342 | ||
|
|
ec30ec0996 | ||
|
|
cdecb7a43c | ||
|
|
aa9c1b66a0 | ||
|
|
846eac29dc | ||
|
|
0f9e3c5b33 | ||
|
|
aa27746982 | ||
|
|
d8a4954bf1 | ||
|
|
d40a029dae | ||
|
|
96d961c393 | ||
|
|
7b6814e32d | ||
|
|
6fee2d3536 | ||
|
|
636fc633d4 | ||
|
|
72a239838e | ||
|
|
a463dbc5fb | ||
|
|
016ae3b9e9 | ||
|
|
7d0d421724 | ||
|
|
83b5856a19 | ||
|
|
f617b27110 | ||
|
|
a91a0263cf | ||
|
|
80ffe13f3e | ||
|
|
1eb726c9bb | ||
|
|
1fa3ba8b42 | ||
|
|
b6bfd66a49 | ||
|
|
1be0e7ddaa | ||
|
|
2cac9b03ff | ||
|
|
f5f4190803 | ||
|
|
a14d554947 | ||
|
|
6d9e5147b5 | ||
|
|
841452cb9e | ||
|
|
9c76368dbc | ||
|
|
bd5122c6ea | ||
|
|
6643258618 | ||
|
|
bc3f02cb6b | ||
|
|
d848ae332a | ||
|
|
08ddc98303 | ||
|
|
a3344c4290 | ||
|
|
22c1ce3ea5 | ||
|
|
afb14e6782 | ||
|
|
e177363377 | ||
|
|
ce213934c9 | ||
|
|
af286ec52e | ||
|
|
f7f2b7607b | ||
|
|
60a282826c | ||
|
|
3eba599aec | ||
|
|
74d876f145 | ||
|
|
d7609f119c | ||
|
|
65c2c7d80b | ||
|
|
468a32a819 | ||
|
|
b89cf73ae2 | ||
|
|
9cf43dea1a | ||
|
|
670ffe2078 | ||
|
|
884cf756ed | ||
|
|
e44ba54857 | ||
|
|
3712749a94 | ||
|
|
6569c4aa03 | ||
|
|
d6b2b3c996 | ||
|
|
06c7900ece | ||
|
|
52a6a12a9a | ||
|
|
e647603dce | ||
|
|
dadf6174ba | ||
|
|
84de7675c4 | ||
|
|
6311a80d0e | ||
|
|
9504e69598 | ||
|
|
5398b651f7 | ||
|
|
b5596c4596 | ||
|
|
fdcea5537c | ||
|
|
8ca8bc810d | ||
|
|
8f909b051f | ||
|
|
90f2b2d249 | ||
|
|
f74b27c58c | ||
|
|
3f091f4748 | ||
|
|
d84c9ad611 | ||
|
|
e55e15693d | ||
|
|
c54e6bafdb | ||
|
|
2e56c4895d | ||
|
|
bce4224d6e | ||
|
|
812e2814bc | ||
|
|
7cd17f8e1f | ||
|
|
6193b06708 | ||
|
|
12af68bdb5 | ||
|
|
881f7e9062 | ||
|
|
1db4076bbd | ||
|
|
1933e44719 | ||
|
|
25441cb650 | ||
|
|
bc755ac32f | ||
|
|
1fa34be52a | ||
|
|
f7a6d57855 | ||
|
|
8a987af244 | ||
|
|
65cbb06080 | ||
|
|
979ea9c252 | ||
|
|
aa1f4ee72a | ||
|
|
74ce485b73 | ||
|
|
165e6508f8 | ||
|
|
c7af2889fa | ||
|
|
5ab3390434 | ||
|
|
67f60f1889 | ||
|
|
985a468d0f | ||
|
|
34dc6fbdc1 | ||
|
|
b57152cc25 | ||
|
|
dc9562e430 | ||
|
|
05689fe183 | ||
|
|
8f6f95211e | ||
|
|
f30b6c9e6e | ||
|
|
12ac7d6a00 | ||
|
|
10251a6447 | ||
|
|
089cbbc20a | ||
|
|
95ab68acd1 | ||
|
|
abc4f6c70b | ||
|
|
8fc3a1f9c9 | ||
|
|
5c3d0fc02c | ||
|
|
7efb47fed4 | ||
|
|
7692332f0e | ||
|
|
ef6db64e9f | ||
|
|
e68f1dbc99 | ||
|
|
0c9ebc36d4 | ||
|
|
fcd6eb7801 | ||
|
|
328c2182c2 | ||
|
|
08706f5dfb | ||
|
|
d49f165f0d | ||
|
|
cf0fc3a4a9 | ||
|
|
72c8fd257c | ||
|
|
fa620e41a4 | ||
|
|
b07f851ce7 | ||
|
|
16b3108719 | ||
|
|
f385c624c7 | ||
|
|
f7e9975192 | ||
|
|
cde989b59d | ||
|
|
c0e263abd3 | ||
|
|
79c0c11e80 | ||
|
|
ca671551c8 | ||
|
|
42ed312384 | ||
|
|
0e9074aaba | ||
|
|
7c1961d4ef | ||
|
|
71e57717c2 | ||
|
|
8a549b83a2 | ||
|
|
d7081c5f23 | ||
|
|
588d64a30b | ||
|
|
8335bdf3d4 | ||
|
|
85394f2438 | ||
|
|
42b556574f | ||
|
|
f34e65ad9e | ||
|
|
51352a6819 | ||
|
|
d9887ec370 | ||
|
|
c994950aaf | ||
|
|
a26ed6fe6c | ||
|
|
a12a7e73f9 | ||
|
|
779228857e | ||
|
|
8d0b696d33 | ||
|
|
23ae220aa7 | ||
|
|
b7940e0002 | ||
|
|
b3fd8bd0ae | ||
|
|
bffeb237de | ||
|
|
23e3602ea1 | ||
|
|
34cfd205f6 | ||
|
|
df3da8be7a | ||
|
|
940243f45e | ||
|
|
75d6599143 | ||
|
|
929a27a5ac | ||
|
|
82ddee2104 | ||
|
|
a141678119 | ||
|
|
96d109af81 | ||
|
|
a309eb9f3c | ||
|
|
d034dab265 | ||
|
|
883a035e5c | ||
|
|
a2e84e5a1e | ||
|
|
d148898ad7 | ||
|
|
36cf622979 | ||
|
|
5e31e533e2 | ||
|
|
5ecd04dd4f | ||
|
|
fb26e78ecc | ||
|
|
4c687036c4 | ||
|
|
73b6338f62 | ||
|
|
8490e7ca7c | ||
|
|
fb229d4064 |
20
.github/workflows/build-freebsd.yml
vendored
Normal file
20
.github/workflows/build-freebsd.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
name: Build on FreeBSD
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: macos-latest
|
||||||
|
name: with UPnP
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Test in FreeBSD
|
||||||
|
id: test
|
||||||
|
uses: vmactions/freebsd-vm@v0.1.2
|
||||||
|
with:
|
||||||
|
usesh: true
|
||||||
|
prepare: pkg install -y devel/cmake devel/gmake devel/boost-libs security/openssl net/miniupnpc
|
||||||
|
run: |
|
||||||
|
cd build
|
||||||
|
cmake -DWITH_UPNP=ON -DCMAKE_BUILD_TYPE=Release .
|
||||||
|
gmake -j2
|
||||||
20
.github/workflows/build-osx.yml
vendored
Normal file
20
.github/workflows/build-osx.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
name: Build on OSX
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: With USE_UPNP=${{ matrix.with_upnp }}
|
||||||
|
runs-on: macOS-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: true
|
||||||
|
matrix:
|
||||||
|
with_upnp: ['yes', 'no']
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: install packages
|
||||||
|
run: |
|
||||||
|
brew update
|
||||||
|
brew install boost miniupnpc openssl@1.1
|
||||||
|
- name: build application
|
||||||
|
run: make HOMEBREW=1 USE_UPNP=${{ matrix.with_upnp }} PREFIX=$GITHUB_WORKSPACE/output -j3
|
||||||
35
.github/workflows/build-windows.yml
vendored
Normal file
35
.github/workflows/build-windows.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
name: Build on Windows
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: msys2 {0}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Building for ${{ matrix.arch }}
|
||||||
|
runs-on: windows-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: true
|
||||||
|
matrix:
|
||||||
|
include: [
|
||||||
|
{ msystem: MINGW64, arch: x86_64 },
|
||||||
|
{ msystem: MINGW32, arch: i686 }
|
||||||
|
]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Setup MSYS2
|
||||||
|
uses: msys2/setup-msys2@v2
|
||||||
|
with:
|
||||||
|
msystem: ${{ matrix.msystem }}
|
||||||
|
install: base-devel mingw-w64-${{ matrix.arch }}-gcc mingw-w64-${{ matrix.arch }}-boost mingw-w64-${{ matrix.arch }}-openssl mingw-w64-${{ matrix.arch }}-miniupnpc
|
||||||
|
update: true
|
||||||
|
- name: build application
|
||||||
|
run: |
|
||||||
|
mkdir -p obj/Win32 obj/libi2pd obj/libi2pd_client obj/daemon
|
||||||
|
make USE_UPNP=yes DEBUG=no -j3
|
||||||
|
- name: Upload artifacts
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
path: i2pd.exe
|
||||||
21
.github/workflows/build.yml
vendored
Normal file
21
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
name: Build on Ubuntu
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: With USE_UPNP=${{ matrix.with_upnp }}
|
||||||
|
runs-on: ubuntu-16.04
|
||||||
|
strategy:
|
||||||
|
fail-fast: true
|
||||||
|
matrix:
|
||||||
|
with_upnp: ['yes', 'no']
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: install packages
|
||||||
|
run: |
|
||||||
|
sudo add-apt-repository ppa:mhier/libboost-latest
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install build-essential libboost1.74-dev libminiupnpc-dev libssl-dev zlib1g-dev
|
||||||
|
- name: build application
|
||||||
|
run: make USE_UPNP=${{ matrix.with_upnp }} -j3
|
||||||
11
.gitignore
vendored
11
.gitignore
vendored
@@ -3,11 +3,12 @@
|
|||||||
router.info
|
router.info
|
||||||
router.keys
|
router.keys
|
||||||
i2p
|
i2p
|
||||||
libi2pd.so
|
|
||||||
netDb
|
netDb
|
||||||
/i2pd
|
/i2pd
|
||||||
/libi2pd.a
|
/libi2pd.a
|
||||||
/libi2pdclient.a
|
/libi2pdclient.a
|
||||||
|
/libi2pd.so
|
||||||
|
/libi2pdclient.so
|
||||||
*.exe
|
*.exe
|
||||||
|
|
||||||
|
|
||||||
@@ -258,9 +259,15 @@ build/Makefile
|
|||||||
|
|
||||||
# qt
|
# qt
|
||||||
|
|
||||||
qt/i2pd_qt/*.ui.autosave
|
qt/i2pd_qt/*.autosave
|
||||||
qt/i2pd_qt/*.ui.bk*
|
qt/i2pd_qt/*.ui.bk*
|
||||||
qt/i2pd_qt/*.ui_*
|
qt/i2pd_qt/*.ui_*
|
||||||
|
|
||||||
#unknown android stuff
|
#unknown android stuff
|
||||||
android/libs/
|
android/libs/
|
||||||
|
|
||||||
|
#various logs
|
||||||
|
*LOGS/
|
||||||
|
|
||||||
|
qt/build-*.sh*
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ cache:
|
|||||||
os:
|
os:
|
||||||
- linux
|
- linux
|
||||||
#- osx
|
#- osx
|
||||||
dist: trusty
|
dist: xenial
|
||||||
sudo: required
|
sudo: required
|
||||||
compiler:
|
compiler:
|
||||||
- g++
|
- g++
|
||||||
|
|||||||
329
ChangeLog
329
ChangeLog
@@ -1,6 +1,335 @@
|
|||||||
# for this file format description,
|
# for this file format description,
|
||||||
# see https://github.com/olivierlacan/keep-a-changelog
|
# see https://github.com/olivierlacan/keep-a-changelog
|
||||||
|
|
||||||
|
## [2.37.0] - 2021-03-15
|
||||||
|
### Added
|
||||||
|
- Address registration line for reg.i2p and stats.i2p through the web console
|
||||||
|
- "4" and "6" caps for addresses without published IP address
|
||||||
|
- Mesh and Proxy network statuses
|
||||||
|
- Symmetric NAT network status error
|
||||||
|
- Bind server tunnel connection to specified address
|
||||||
|
- lookuplocal BOB extended command
|
||||||
|
- address4 and address6 parameters to bind outgoing connections to
|
||||||
|
- Rekey of low-bandwidth routers to ECIES
|
||||||
|
- Popup notification windows when unable to parse config for Windows
|
||||||
|
### Changed
|
||||||
|
- Floodfills with "U" cap are not ignored anymore
|
||||||
|
- Check transports reachability between tunnel peers and between router and floodfill
|
||||||
|
- NTCP2 and reseed HTTP proxy support authorization now
|
||||||
|
- Show actual IP addresses for proxy connections
|
||||||
|
- Publish and handle SSU addreses without host
|
||||||
|
- Outbound tunnel endpoint must be ipv4 compatible
|
||||||
|
- Logging optimization
|
||||||
|
- Removed Windows service
|
||||||
|
### Fixed
|
||||||
|
- Incoming SSU session terminates after 5 seconds
|
||||||
|
- Outgoing NTCP2 ipv4 session even if ipv4 is disabled
|
||||||
|
- No incoming Yggdrasil connection if connected through NTCP2 proxy
|
||||||
|
- Race condition between tunnel build and floodfill requests decryption for ECIES routers
|
||||||
|
- Numeric bandwidth limitation
|
||||||
|
- Yggdrasil for Android
|
||||||
|
|
||||||
|
## [2.36.0] - 2021-02-15
|
||||||
|
### Added
|
||||||
|
- Encrypted lookup and publications to ECIES-x25519 floodfiils
|
||||||
|
- Yggdrasil transports and reseeds
|
||||||
|
- Dump addressbook in hosts.txt format
|
||||||
|
- Request RouterInfo through exploratory tunnels if direct connection to fllodfill is not possible
|
||||||
|
- Threads naming
|
||||||
|
- Check if public x25519 key is valid
|
||||||
|
- ECIES-X25519-AEAD-Ratchet for shared local destination
|
||||||
|
- LeaseSet creation timeout for I2CP session
|
||||||
|
- Resend RouterInfo after some interval for longer NTCP2 sessions
|
||||||
|
- Select reachable router of inbound tunnel gateway
|
||||||
|
- Reseed if no compatible routers in netdb
|
||||||
|
- Refresh on swipe in Android webconsole
|
||||||
|
### Changed
|
||||||
|
- reg.i2p for default addressbook instead inr.i2p
|
||||||
|
- ECIES-x25519 (crypto type 4) for new routers
|
||||||
|
- Try to connect to all compatible addresses from peer's RouterInfo
|
||||||
|
- Replace LeaseSet completely if store type changes
|
||||||
|
- Try ECIES-X25519-AEAD-Ratchet tag before ElGamal
|
||||||
|
- Don't detach ECIES-X25519-AEAD-Ratchet session from destination immediately
|
||||||
|
- Viewport and styles on error in HTTP proxy
|
||||||
|
- Don't create notification when Windows taskbar restarted
|
||||||
|
- Cumulative SSU ACK bitfields
|
||||||
|
- limit tunnel length to 8 hops
|
||||||
|
- Limit tunnels quantity to 16
|
||||||
|
### Fixed
|
||||||
|
- Handling chunked HTTP response in addressbook
|
||||||
|
- Missing ECIES-X25519-AEAD-Ratchet tags for multiple streams with the same destination
|
||||||
|
- Correct NAME for NAMING REPLY in SAM
|
||||||
|
- SSU crash on termination
|
||||||
|
- Offline signature length for stream close packet
|
||||||
|
- Don't send updated LeaseSet through a terminated session
|
||||||
|
- Decryption of follow-on ECIES-X25519-AEAD-Ratchet NSR messages
|
||||||
|
- Non-confirmed LeaseSet is resent too late for ECIES-X25519-AEAD-Ratchet session
|
||||||
|
|
||||||
|
## [2.35.0] - 2020-11-30
|
||||||
|
### Added
|
||||||
|
- ECIES-x25519 routers
|
||||||
|
- Random intro keys for SSU
|
||||||
|
- Graceful shutdown timer for windows
|
||||||
|
- Send queue for I2CP messages
|
||||||
|
- Update DSA router keys to EdDSA
|
||||||
|
- TCP_QUICKACK for NTCP2 sockets on Linux
|
||||||
|
### Changed
|
||||||
|
- Exclude floodfills with DSA signatures and < 0.9.28
|
||||||
|
- Random intervals between tunnel tests and manage for tunnel pools
|
||||||
|
- Don't replace an addressbook record by one with DSA signature
|
||||||
|
- Publish RouterInfo after update
|
||||||
|
- Create paired inbound tunnels if no inbound tunnels yet
|
||||||
|
- Reseed servers list
|
||||||
|
### Fixed
|
||||||
|
- Transient signature length, if different from identity
|
||||||
|
- Terminate I2CP session if destroyed
|
||||||
|
- RouterInfo publishing confirmation
|
||||||
|
- Check if ECIES-X25519-AEAD-Ratchet session expired before generating more tags
|
||||||
|
- Correct block size for delivery type local for ECIES-X25519-AEAD-Ratchet
|
||||||
|
|
||||||
|
## [2.34.0] - 2020-10-27
|
||||||
|
### Added
|
||||||
|
- Ping responses for streaming
|
||||||
|
- STREAM FORWARD for SAM
|
||||||
|
- Tunnels through ECIES-x25519 routers
|
||||||
|
- Single thread for I2CP
|
||||||
|
- Shared transient destination between proxies
|
||||||
|
- Database lookups from ECIES destinations with ratchets response
|
||||||
|
- Handle WebDAV HTTP methods
|
||||||
|
- Don't try to connect or build tunnels if offline
|
||||||
|
- Validate IP when trying connect to remote peer
|
||||||
|
- Handle ICMP responses and WinAPI errors for SSU
|
||||||
|
### Changed
|
||||||
|
- Removed NTCP
|
||||||
|
- Dropped gcc 4.7 support
|
||||||
|
- Encyption type 0,4 by default for client tunnels
|
||||||
|
- Stripped out some HTTP header for HTTP server response
|
||||||
|
- HTTP 1.1 addressbook requests
|
||||||
|
- Set LeaseSet type to 3 for ratchets if not specified
|
||||||
|
- Handle SSU v4 and v6 messages in one thread
|
||||||
|
- Eliminate DH keys thread
|
||||||
|
### Fixed
|
||||||
|
- Random crashes on I2CP session disconnect
|
||||||
|
- Stream through racthets hangs if first SYN was not acked
|
||||||
|
- Check "Last-Modified" instead "If-Modified-Since" for addressbook reponse
|
||||||
|
- Trim behind ECIESx25519 tags
|
||||||
|
- Few bugs with Android main activity
|
||||||
|
- QT visual and layout issues
|
||||||
|
|
||||||
|
## [2.33.0] - 2020-08-24
|
||||||
|
### Added
|
||||||
|
- Shared transient addresses
|
||||||
|
- crypto.ratchet.inboundTags paramater
|
||||||
|
- Multiple encryption keys through I2CP
|
||||||
|
- Pre-calculated x25519 ephemeral keys
|
||||||
|
- Change datagram routing path if nothing comes back in 10 seconds
|
||||||
|
- Shared routing path for datagram session
|
||||||
|
### Changed
|
||||||
|
- UDP tunnels send mix of repliable and raw datagrams in bulk
|
||||||
|
- Encrypt SSU packet again upon resend
|
||||||
|
- Start new tunnel message if remaining buffer is too small
|
||||||
|
- Use LeaseSet2 for ECIES-X25519-AEAD-Ratchet automatically
|
||||||
|
- Save new ECIES-X25519-AEAD-Ratchet session with NSR tagset
|
||||||
|
- Generate random padding lengths for ECIES-X25519-AEAD-Ratchet in bulk
|
||||||
|
- Webconsole layout
|
||||||
|
- Reseed servers list
|
||||||
|
### Fixed
|
||||||
|
- Don't connect through terminated SAM destination
|
||||||
|
- Differentiate UDP server sessions by port
|
||||||
|
- ECIES-X25519-AEAD-Ratchet through I2CP
|
||||||
|
- Don't save invalid address to AddressBook
|
||||||
|
- ECDSA signatures names in SAM
|
||||||
|
- AppArmor profile
|
||||||
|
|
||||||
|
## [2.32.1] - 2020-06-02
|
||||||
|
### Added
|
||||||
|
- Read explicit peers in tunnels config
|
||||||
|
### Fixed
|
||||||
|
- Generation of tags for detached sessions
|
||||||
|
- Non-updating LeaseSet1
|
||||||
|
- Start when deprecated websocket options present in i2pd.conf
|
||||||
|
|
||||||
|
## [2.32.0] - 2020-05-25
|
||||||
|
### Added
|
||||||
|
- Multiple encryption types for local destinations
|
||||||
|
- Next key and tagset for ECIES-X25519-AEAD-Ratchet
|
||||||
|
- NTCP2 through SOCKS proxy
|
||||||
|
- Throw error message if any port to bind is occupied
|
||||||
|
- gzip parameter for UDP tunnels
|
||||||
|
- Show ECIES-X25519-AEAD-Ratchet sessions and tags on the web console
|
||||||
|
- Simplified implementation of gzip for no compression mode
|
||||||
|
- Allow ECIES-X25519-AEAD-Ratchet session restart after 2 minutes
|
||||||
|
- Added logrotate config for rpm package
|
||||||
|
### Changed
|
||||||
|
- Select peers for client tunnels among routers >= 0.9.36
|
||||||
|
- Check ECIES flag for encrypted lookup reply
|
||||||
|
- Streaming MTU size 1812 for ECIES-X25519-AEAD-Ratchet
|
||||||
|
- Don't calculate checksum for Data message send through ECIES-X25519-AEAD-Ratchet
|
||||||
|
- Catch network connectivity status for Windows
|
||||||
|
- Stop as soon as no more transit tunnels during graceful shutdown for Android
|
||||||
|
- RouterInfo gzip compression level depends on size
|
||||||
|
- Send response to received datagram from ECIES-X25519-AEAD-Ratchet session
|
||||||
|
- Update webconsole functional
|
||||||
|
- Increased max transit tunnels limit
|
||||||
|
- Reseeds list
|
||||||
|
- Dropped windows support in cmake
|
||||||
|
### Fixed
|
||||||
|
- Correct timestamp check for LeaseSet2
|
||||||
|
- Encrypted leaseset without authentication
|
||||||
|
- Change SOCKS proxy connection response for clients without socks5h support (#1336)
|
||||||
|
|
||||||
|
## [2.31.0] - 2020-04-10
|
||||||
|
### Added
|
||||||
|
- NTCP2 through HTTP proxy
|
||||||
|
- Publish LeaseSet2 for I2CP destinations
|
||||||
|
- Show status page on main activity for android
|
||||||
|
- Handle ECIESFlag in DatabaseLookup at floodfill
|
||||||
|
- C++17 features for eligible compilers
|
||||||
|
### Changed
|
||||||
|
- Droped Websockets and Lua support
|
||||||
|
- Send DeliveryStatusMsg for LeaseSet for ECIES-X25519-AEAD-Ratchet
|
||||||
|
- Keep sending new session reply until established for ECIES-X25519-AEAD-Ratchet
|
||||||
|
- Updated SSU log messages
|
||||||
|
- Reopen SSU socket on exception
|
||||||
|
- Security hardening headers in web console
|
||||||
|
- Various web console changes
|
||||||
|
- Various QT changes
|
||||||
|
### Fixed
|
||||||
|
- NTCP2 socket descriptors leak
|
||||||
|
- Race condition with router's identity in transport sessions
|
||||||
|
- Not terminated streams remain forever
|
||||||
|
|
||||||
|
## [2.30.0] - 2020-02-25
|
||||||
|
### Added
|
||||||
|
- Single threaded SAM
|
||||||
|
- Experimental support of ECIES-X25519-AEAD-Ratchet crypto type
|
||||||
|
### Changed
|
||||||
|
- Minimal MTU size is 1280 for ipv6
|
||||||
|
- Use unordered_map instead map for destination's sessions and tags list
|
||||||
|
- Use std::shuffle instead std::random_shuffle
|
||||||
|
- SAM is single threaded by default
|
||||||
|
- Reseeds list
|
||||||
|
### Fixed
|
||||||
|
- Correct termination of streaming destination
|
||||||
|
- Extra ',' in RouterInfo response in I2PControl
|
||||||
|
- SAM crash on session termination
|
||||||
|
- Storage for Android 10
|
||||||
|
|
||||||
|
## [2.29.0] - 2019-10-21
|
||||||
|
### Added
|
||||||
|
- Client auth flag for b33 address
|
||||||
|
### Changed
|
||||||
|
- Remove incoming NTCP2 session from pending list when established
|
||||||
|
- Handle errors for NTCP2 SessionConfrimed send
|
||||||
|
### Fixed
|
||||||
|
- Failure to start on Windows XP
|
||||||
|
- SAM crash if invalid lookup address
|
||||||
|
- Possible crash when UPnP enabled on shutdown
|
||||||
|
|
||||||
|
## [2.28.0] - 2019-08-27
|
||||||
|
### Added
|
||||||
|
- RAW datagrams in SAM
|
||||||
|
- Publishing encrypted LeaseSet2 with DH or PSH authentication
|
||||||
|
- Ability to disable battery optimization for Android
|
||||||
|
- Transport Network ID Check
|
||||||
|
### Changed
|
||||||
|
- Set and handle published encrypted flag for LeaseSet2
|
||||||
|
### Fixed
|
||||||
|
- ReceiveID changes in the same stream
|
||||||
|
- "\r\n" command terminator in SAM
|
||||||
|
- Addressbook lines with signatures
|
||||||
|
|
||||||
|
## [2.27.0] - 2019-07-03
|
||||||
|
### Added
|
||||||
|
- Support of PSK and DH authentication for encrypted LeaseSet2
|
||||||
|
### Changed
|
||||||
|
- Uptime is based on monotonic timer
|
||||||
|
### Fixed
|
||||||
|
- BOB status command response
|
||||||
|
- Correct NTCP2 port if NTCP is disabled
|
||||||
|
- Flood encrypted LeaseSet2 with store hash
|
||||||
|
|
||||||
|
## [2.26.0] - 2019-06-07
|
||||||
|
### Added
|
||||||
|
- HTTP method "PROPFIND"
|
||||||
|
- Detection of external ipv6 address through the SSU
|
||||||
|
- NTCP2 publishing depends on network status
|
||||||
|
### Changed
|
||||||
|
- ntcp is disabled by default, ntcp2 is published by default
|
||||||
|
- Response to BOB's "list" command
|
||||||
|
- ipv6 address is not longer NTCP's local endpoint's address
|
||||||
|
- Reseeds list
|
||||||
|
- HTTP_REFERER stripping in httpproxy (#823)
|
||||||
|
### Fixed
|
||||||
|
- Check and handle incorrect BOB input
|
||||||
|
- Ignore introducers for NTCP or NTCP2 addresses
|
||||||
|
- RouterInfo check from NTCP2
|
||||||
|
|
||||||
|
## [2.25.0] - 2019-05-09
|
||||||
|
### Added
|
||||||
|
- Create, publish and handle encrypted LeaseSet2
|
||||||
|
- Support of b33 addresses
|
||||||
|
- RedDSA key blinding
|
||||||
|
- .b32.i2p addresses in jump links
|
||||||
|
- ntcp2.addressv6 parameter
|
||||||
|
### Changed
|
||||||
|
- Allow HTTP headers without value
|
||||||
|
- Set data directory from external storage path for Android
|
||||||
|
- addresshelper support is configurable per tunnel
|
||||||
|
- gradlew script for android build
|
||||||
|
### Fixed
|
||||||
|
- Deletion of expired encrypted LeaseSet2 on floodfills
|
||||||
|
- ipv6 fallback address
|
||||||
|
- SSU incoming packets routing
|
||||||
|
|
||||||
|
## [2.24.0] - 2019-03-21
|
||||||
|
### Added
|
||||||
|
- Support of transient keys for LeaseSet2
|
||||||
|
- Support of encrypted LeaseSet2
|
||||||
|
- Recognize signature type 11 (RedDSA)
|
||||||
|
- Support websocket connections over HTTP proxy
|
||||||
|
- Ability to disable full addressbook persist
|
||||||
|
### Changed
|
||||||
|
- Don't load peer profiles if non-persistant
|
||||||
|
- REUSE_ADDR for ipv6 acceptors
|
||||||
|
- Reset eTags if addressbook can't be loaded
|
||||||
|
### Fixed
|
||||||
|
- Build with boost 1.70
|
||||||
|
- Filter out unspecified addresses from RouterInfo
|
||||||
|
- Check floodfill status change
|
||||||
|
- Correct SAM response for invalid key
|
||||||
|
- SAM crash on termination for Windows
|
||||||
|
- Race condition for publishing
|
||||||
|
|
||||||
|
## [2.23.0] - 2019-01-21
|
||||||
|
### Added
|
||||||
|
- Standard LeaseSet2 support
|
||||||
|
- Ability to adjust timestamps through the NTP
|
||||||
|
- Ability to disable peer profile persist
|
||||||
|
- Request permission for android >= 6
|
||||||
|
- Initial addressbook to android assets
|
||||||
|
- Cancel graceful shutdown for android
|
||||||
|
- Russian translation for android
|
||||||
|
### Changed
|
||||||
|
- Chacha20 and Poly1305 implementation
|
||||||
|
- Eliminate extra copy of NTCP2 send buffers
|
||||||
|
- Extract content of tunnel.d from assets on android
|
||||||
|
- Removed name resolvers from transports
|
||||||
|
- Update reseed certificates
|
||||||
|
### Fixed
|
||||||
|
- LeaseSet published content verification
|
||||||
|
- Exclude invalid LeaseSets from the list on a floodfill
|
||||||
|
- Build for OpenWrt with openssl 1.1.1
|
||||||
|
|
||||||
|
## [2.22.0] - 2018-11-09
|
||||||
|
### Added
|
||||||
|
- Multiple tunnel config files from tunnels.d folder
|
||||||
|
### Changed
|
||||||
|
- Fetch own RouterInfo upon SessionRequest for NTCP2
|
||||||
|
- Faster XOR between AES blocks for non AVX capable CPUs
|
||||||
|
### Fixed
|
||||||
|
- Fixed NTCP2 termination send
|
||||||
|
|
||||||
## [2.21.1] - 2018-10-22
|
## [2.21.1] - 2018-10-22
|
||||||
### Changed
|
### Changed
|
||||||
- cost=13 for unpublished NTCP2 address
|
- cost=13 for unpublished NTCP2 address
|
||||||
|
|||||||
2
LICENSE
2
LICENSE
@@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2013-2015, The PurpleI2P Project
|
Copyright (c) 2013-2020, The PurpleI2P Project
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
|
|||||||
46
Makefile
46
Makefile
@@ -4,17 +4,15 @@ ARLIB := libi2pd.a
|
|||||||
SHLIB_CLIENT := libi2pdclient.so
|
SHLIB_CLIENT := libi2pdclient.so
|
||||||
ARLIB_CLIENT := libi2pdclient.a
|
ARLIB_CLIENT := libi2pdclient.a
|
||||||
I2PD := i2pd
|
I2PD := i2pd
|
||||||
GREP := grep
|
|
||||||
DEPS := obj/make.dep
|
|
||||||
|
|
||||||
LIB_SRC_DIR := libi2pd
|
LIB_SRC_DIR := libi2pd
|
||||||
LIB_CLIENT_SRC_DIR := libi2pd_client
|
LIB_CLIENT_SRC_DIR := libi2pd_client
|
||||||
DAEMON_SRC_DIR := daemon
|
DAEMON_SRC_DIR := daemon
|
||||||
|
|
||||||
|
# import source files lists
|
||||||
include filelist.mk
|
include filelist.mk
|
||||||
|
|
||||||
USE_AESNI := yes
|
USE_AESNI := yes
|
||||||
USE_AVX := yes
|
|
||||||
USE_STATIC := no
|
USE_STATIC := no
|
||||||
USE_MESHNET := no
|
USE_MESHNET := no
|
||||||
USE_UPNP := no
|
USE_UPNP := no
|
||||||
@@ -27,10 +25,6 @@ else
|
|||||||
LD_DEBUG = -s
|
LD_DEBUG = -s
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(WEBSOCKETS),1)
|
|
||||||
NEEDED_CXXFLAGS += -DWITH_EVENTS
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq (, $(findstring darwin, $(SYS)))
|
ifneq (, $(findstring darwin, $(SYS)))
|
||||||
DAEMON_SRC += $(DAEMON_SRC_DIR)/UnixDaemon.cpp
|
DAEMON_SRC += $(DAEMON_SRC_DIR)/UnixDaemon.cpp
|
||||||
ifeq ($(HOMEBREW),1)
|
ifeq ($(HOMEBREW),1)
|
||||||
@@ -45,17 +39,22 @@ else ifneq (, $(findstring freebsd, $(SYS))$(findstring openbsd, $(SYS)))
|
|||||||
DAEMON_SRC += $(DAEMON_SRC_DIR)/UnixDaemon.cpp
|
DAEMON_SRC += $(DAEMON_SRC_DIR)/UnixDaemon.cpp
|
||||||
include Makefile.bsd
|
include Makefile.bsd
|
||||||
else ifneq (, $(findstring mingw, $(SYS))$(findstring cygwin, $(SYS)))
|
else ifneq (, $(findstring mingw, $(SYS))$(findstring cygwin, $(SYS)))
|
||||||
DAEMON_SRC += Win32/DaemonWin32.cpp Win32/Win32Service.cpp Win32/Win32App.cpp
|
DAEMON_SRC += Win32/DaemonWin32.cpp Win32/Win32App.cpp Win32/Win32NetState.cpp
|
||||||
include Makefile.mingw
|
include Makefile.mingw
|
||||||
else # not supported
|
else # not supported
|
||||||
$(error Not supported platform)
|
$(error Not supported platform)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(USE_MESHNET),yes)
|
ifeq ($(USE_MESHNET),yes)
|
||||||
NEEDED_CXXFLAGS += -DMESHNET
|
NEEDED_CXXFLAGS += -DMESHNET
|
||||||
endif
|
endif
|
||||||
|
|
||||||
NEEDED_CXXFLAGS += -I$(LIB_SRC_DIR) -I$(LIB_CLIENT_SRC_DIR)
|
NEEDED_CXXFLAGS += -MMD -MP -I$(LIB_SRC_DIR) -I$(LIB_CLIENT_SRC_DIR)
|
||||||
|
|
||||||
|
LIB_OBJS += $(patsubst %.cpp,obj/%.o,$(LIB_SRC))
|
||||||
|
LIB_CLIENT_OBJS += $(patsubst %.cpp,obj/%.o,$(LIB_CLIENT_SRC))
|
||||||
|
DAEMON_OBJS += $(patsubst %.cpp,obj/%.o,$(DAEMON_SRC))
|
||||||
|
DEPS += $(LIB_OBJS:.o=.d) $(LIB_CLIENT_OBJS:.o=.d) $(DAEMON_OBJS:.o=.d)
|
||||||
|
|
||||||
all: mk_obj_dir $(ARLIB) $(ARLIB_CLIENT) $(I2PD)
|
all: mk_obj_dir $(ARLIB) $(ARLIB_CLIENT) $(I2PD)
|
||||||
|
|
||||||
@@ -67,6 +66,7 @@ mk_obj_dir:
|
|||||||
@mkdir -p obj/$(DAEMON_SRC_DIR)
|
@mkdir -p obj/$(DAEMON_SRC_DIR)
|
||||||
|
|
||||||
api: mk_obj_dir $(SHLIB) $(ARLIB)
|
api: mk_obj_dir $(SHLIB) $(ARLIB)
|
||||||
|
client: mk_obj_dir $(SHLIB_CLIENT) $(ARLIB_CLIENT)
|
||||||
api_client: mk_obj_dir $(SHLIB) $(ARLIB) $(SHLIB_CLIENT) $(ARLIB_CLIENT)
|
api_client: mk_obj_dir $(SHLIB) $(ARLIB) $(SHLIB_CLIENT) $(ARLIB_CLIENT)
|
||||||
|
|
||||||
## NOTE: The NEEDED_CXXFLAGS are here so that CXXFLAGS can be specified at build time
|
## NOTE: The NEEDED_CXXFLAGS are here so that CXXFLAGS can be specified at build time
|
||||||
@@ -76,32 +76,29 @@ api_client: mk_obj_dir $(SHLIB) $(ARLIB) $(SHLIB_CLIENT) $(ARLIB_CLIENT)
|
|||||||
## -std=c++11. If you want to remove this variable please do so in a way that allows setting
|
## -std=c++11. If you want to remove this variable please do so in a way that allows setting
|
||||||
## custom FLAGS to work at build-time.
|
## custom FLAGS to work at build-time.
|
||||||
|
|
||||||
deps: mk_obj_dir
|
|
||||||
$(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) -MM *.cpp > $(DEPS)
|
|
||||||
@sed -i -e '/\.o:/ s/^/obj\//' $(DEPS)
|
|
||||||
|
|
||||||
obj/%.o: %.cpp
|
obj/%.o: %.cpp
|
||||||
$(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) $(CPU_FLAGS) -c -o $@ $<
|
$(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
# '-' is 'ignore if missing' on first run
|
# '-' is 'ignore if missing' on first run
|
||||||
-include $(DEPS)
|
-include $(DEPS)
|
||||||
|
|
||||||
DAEMON_OBJS += $(patsubst %.cpp,obj/%.o,$(DAEMON_SRC))
|
|
||||||
$(I2PD): $(DAEMON_OBJS) $(ARLIB) $(ARLIB_CLIENT)
|
$(I2PD): $(DAEMON_OBJS) $(ARLIB) $(ARLIB_CLIENT)
|
||||||
$(CXX) -o $@ $^ $(LDFLAGS) $(LDLIBS)
|
$(CXX) -o $@ $(LDFLAGS) $^ $(LDLIBS)
|
||||||
|
|
||||||
$(SHLIB): $(patsubst %.cpp,obj/%.o,$(LIB_SRC))
|
$(SHLIB): $(LIB_OBJS)
|
||||||
ifneq ($(USE_STATIC),yes)
|
ifneq ($(USE_STATIC),yes)
|
||||||
$(CXX) $(LDFLAGS) $(LDLIBS) -shared -o $@ $^
|
$(CXX) $(LDFLAGS) -shared -o $@ $^ $(LDLIBS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(SHLIB_CLIENT): $(patsubst %.cpp,obj/%.o,$(LIB_CLIENT_SRC))
|
$(SHLIB_CLIENT): $(LIB_CLIENT_OBJS)
|
||||||
$(CXX) $(LDFLAGS) $(LDLIBS) -shared -o $@ $^
|
ifneq ($(USE_STATIC),yes)
|
||||||
|
$(CXX) $(LDFLAGS) -shared -o $@ $^ $(LDLIBS) $(SHLIB)
|
||||||
|
endif
|
||||||
|
|
||||||
$(ARLIB): $(patsubst %.cpp,obj/%.o,$(LIB_SRC))
|
$(ARLIB): $(LIB_OBJS)
|
||||||
$(AR) -r $@ $^
|
$(AR) -r $@ $^
|
||||||
|
|
||||||
$(ARLIB_CLIENT): $(patsubst %.cpp,obj/%.o,$(LIB_CLIENT_SRC))
|
$(ARLIB_CLIENT): $(LIB_CLIENT_OBJS)
|
||||||
$(AR) -r $@ $^
|
$(AR) -r $@ $^
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@@ -127,11 +124,12 @@ doxygen:
|
|||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
.PHONY: deps
|
|
||||||
.PHONY: doxygen
|
.PHONY: doxygen
|
||||||
.PHONY: dist
|
.PHONY: dist
|
||||||
.PHONY: last-dist
|
.PHONY: last-dist
|
||||||
.PHONY: api
|
.PHONY: api
|
||||||
.PHONY: api_client
|
.PHONY: api_client
|
||||||
|
.PHONY: client
|
||||||
.PHONY: mk_obj_dir
|
.PHONY: mk_obj_dir
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
|
.PHONY: strip
|
||||||
|
|||||||
@@ -35,10 +35,7 @@ endif
|
|||||||
# Seems like all recent Mac's have AES-NI, after firmware upgrade 2.2
|
# Seems like all recent Mac's have AES-NI, after firmware upgrade 2.2
|
||||||
# Found no good way to detect it from command line. TODO: Might be some osx sysinfo magic
|
# Found no good way to detect it from command line. TODO: Might be some osx sysinfo magic
|
||||||
ifeq ($(USE_AESNI),yes)
|
ifeq ($(USE_AESNI),yes)
|
||||||
CXXFLAGS += -maes
|
CXXFLAGS += -D__AES__ -maes
|
||||||
endif
|
|
||||||
ifeq ($(USE_AVX),1)
|
|
||||||
CXXFLAGS += -mavx
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# set defaults instead redefine
|
# set defaults instead redefine
|
||||||
CXXFLAGS ?= ${CXX_DEBUG} -Wall -Wextra -Wno-unused-parameter -pedantic -Wno-misleading-indentation
|
CXXFLAGS ?= ${CXX_DEBUG} -Wall -Wextra -Wno-unused-parameter -pedantic -Wno-psabi
|
||||||
LDFLAGS ?= ${LD_DEBUG}
|
LDFLAGS ?= ${LD_DEBUG}
|
||||||
|
|
||||||
## NOTE: The NEEDED_CXXFLAGS are here so that custom CXXFLAGS can be specified at build time
|
## NOTE: The NEEDED_CXXFLAGS are here so that custom CXXFLAGS can be specified at build time
|
||||||
@@ -15,15 +15,13 @@ ifeq ($(shell expr match $(CXX) 'clang'),5)
|
|||||||
NEEDED_CXXFLAGS += -std=c++11
|
NEEDED_CXXFLAGS += -std=c++11
|
||||||
else ifeq ($(shell expr match ${CXXVER} "4\.[0-9][0-9]"),4) # gcc >= 4.10
|
else ifeq ($(shell expr match ${CXXVER} "4\.[0-9][0-9]"),4) # gcc >= 4.10
|
||||||
NEEDED_CXXFLAGS += -std=c++11
|
NEEDED_CXXFLAGS += -std=c++11
|
||||||
else ifeq ($(shell expr match ${CXXVER} "4\.[7-9]"),3) # >= 4.7
|
else ifeq ($(shell expr match ${CXXVER} "4\.[8-9]"),3) # gcc 4.8 - 4.9
|
||||||
NEEDED_CXXFLAGS += -std=c++11 -D_GLIBCXX_USE_NANOSLEEP=1
|
NEEDED_CXXFLAGS += -std=c++11 -D_GLIBCXX_USE_NANOSLEEP=1
|
||||||
else ifeq ($(shell expr match ${CXXVER} "4\.6"),3) # = 4.6
|
else ifeq ($(shell expr match ${CXXVER} "[5-6]"),1) # gcc 5 - 6
|
||||||
NEEDED_CXXFLAGS += -std=c++0x
|
|
||||||
else ifeq ($(shell expr match ${CXXVER} "[5-7]\.[0-9]"),3) # gcc >= 5.0
|
|
||||||
NEEDED_CXXFLAGS += -std=c++11
|
NEEDED_CXXFLAGS += -std=c++11
|
||||||
LDLIBS = -latomic
|
LDLIBS = -latomic
|
||||||
else ifeq ($(shell expr match ${CXXVER} "[7-8]"),1) # gcc 7 ubuntu or gcc 8 arch
|
else ifeq ($(shell expr match ${CXXVER} "[1,7-9]"),1) # gcc >= 7
|
||||||
NEEDED_CXXFLAGS += -std=c++11
|
NEEDED_CXXFLAGS += -std=c++17
|
||||||
LDLIBS = -latomic
|
LDLIBS = -latomic
|
||||||
else # not supported
|
else # not supported
|
||||||
$(error Compiler too old)
|
$(error Compiler too old)
|
||||||
@@ -35,7 +33,7 @@ ifeq ($(USE_STATIC),yes)
|
|||||||
# NOTE: on glibc you will get this warning:
|
# NOTE: on glibc you will get this warning:
|
||||||
# Using 'getaddrinfo' in statically linked applications requires at runtime
|
# Using 'getaddrinfo' in statically linked applications requires at runtime
|
||||||
# the shared libraries from the glibc version used for linking
|
# the shared libraries from the glibc version used for linking
|
||||||
LIBDIR := /usr/lib
|
LIBDIR := /usr/lib/$(SYS)
|
||||||
LDLIBS += $(LIBDIR)/libboost_system.a
|
LDLIBS += $(LIBDIR)/libboost_system.a
|
||||||
LDLIBS += $(LIBDIR)/libboost_date_time.a
|
LDLIBS += $(LIBDIR)/libboost_date_time.a
|
||||||
LDLIBS += $(LIBDIR)/libboost_filesystem.a
|
LDLIBS += $(LIBDIR)/libboost_filesystem.a
|
||||||
@@ -43,37 +41,24 @@ ifeq ($(USE_STATIC),yes)
|
|||||||
LDLIBS += $(LIBDIR)/libssl.a
|
LDLIBS += $(LIBDIR)/libssl.a
|
||||||
LDLIBS += $(LIBDIR)/libcrypto.a
|
LDLIBS += $(LIBDIR)/libcrypto.a
|
||||||
LDLIBS += $(LIBDIR)/libz.a
|
LDLIBS += $(LIBDIR)/libz.a
|
||||||
LDLIBS += -lpthread -static-libstdc++ -static-libgcc -lrt -ldl
|
ifeq ($(USE_UPNP),yes)
|
||||||
USE_AESNI := no
|
LDLIBS += $(LIBDIR)/libminiupnpc.a
|
||||||
|
endif
|
||||||
|
LDLIBS += -lpthread -ldl
|
||||||
else
|
else
|
||||||
LDLIBS += -lcrypto -lssl -lz -lboost_system -lboost_date_time -lboost_filesystem -lboost_program_options -lpthread
|
LDLIBS += -lcrypto -lssl -lz -lboost_system -lboost_date_time -lboost_filesystem -lboost_program_options -lpthread
|
||||||
endif
|
|
||||||
|
|
||||||
# UPNP Support (miniupnpc 1.5 and higher)
|
|
||||||
ifeq ($(USE_UPNP),yes)
|
ifeq ($(USE_UPNP),yes)
|
||||||
CXXFLAGS += -DUSE_UPNP
|
|
||||||
ifeq ($(USE_STATIC),yes)
|
|
||||||
LDLIBS += $(LIBDIR)/libminiupnpc.a
|
|
||||||
else
|
|
||||||
LDLIBS += -lminiupnpc
|
LDLIBS += -lminiupnpc
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(USE_AESNI),yes)
|
# UPNP Support (miniupnpc 1.5 and higher)
|
||||||
#check if AES-NI is supported by CPU
|
ifeq ($(USE_UPNP),yes)
|
||||||
ifneq ($(shell $(GREP) -c aes /proc/cpuinfo),0)
|
NEEDED_CXXFLAGS += -DUSE_UPNP
|
||||||
machine := $(shell uname -m)
|
|
||||||
ifeq ($(machine), aarch64)
|
|
||||||
CXXFLAGS += -DARM64AES
|
|
||||||
else
|
|
||||||
CPU_FLAGS += -maes
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(USE_AVX),yes)
|
ifeq ($(USE_AESNI),yes)
|
||||||
#check if AVX supported by CPU
|
ifneq (, $(findstring i386, $(SYS))$(findstring i686, $(SYS))$(findstring x86_64, $(SYS))) # only x86-based CPU supports that
|
||||||
ifneq ($(shell $(GREP) -c avx /proc/cpuinfo),0)
|
NEEDED_CXXFLAGS += -D__AES__ -maes
|
||||||
CPU_FLAGS += -mavx
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -1,11 +1,24 @@
|
|||||||
USE_WIN32_APP=yes
|
# Build application with GUI (tray, main window)
|
||||||
CXX = g++
|
USE_WIN32_APP := yes
|
||||||
|
|
||||||
WINDRES = windres
|
WINDRES = windres
|
||||||
CXXFLAGS := ${CXX_DEBUG} -D_MT -DWIN32 -D_WINDOWS -DWIN32_LEAN_AND_MEAN
|
|
||||||
NEEDED_CXXFLAGS = -std=c++11
|
CXXFLAGS := $(CXX_DEBUG) -D_MT -DWIN32_LEAN_AND_MEAN -fPIC -msse
|
||||||
|
INCFLAGS = -I$(DAEMON_SRC_DIR) -IWin32
|
||||||
|
LDFLAGS := ${LD_DEBUG} -Wl,-Bstatic -static-libgcc
|
||||||
|
|
||||||
|
# detect proper flag for c++11 support by compilers
|
||||||
|
CXXVER := $(shell $(CXX) -dumpversion)
|
||||||
|
ifeq ($(shell expr match ${CXXVER} "[4]\.[7-9]\|4\.1[0-9]\|[5-6]"),4) # gcc 4.7 - 6
|
||||||
|
NEEDED_CXXFLAGS += -std=c++11
|
||||||
|
else ifeq ($(shell expr match ${CXXVER} "[1,7-9]"),1) # gcc >= 7
|
||||||
|
NEEDED_CXXFLAGS += -std=c++17
|
||||||
|
else # not supported
|
||||||
|
$(error Compiler too old)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Boost libraries suffix
|
||||||
BOOST_SUFFIX = -mt
|
BOOST_SUFFIX = -mt
|
||||||
INCFLAGS = -Idaemon -I.
|
|
||||||
LDFLAGS := ${LD_DEBUG} -Wl,-Bstatic -static-libgcc -static-libstdc++
|
|
||||||
|
|
||||||
# UPNP Support
|
# UPNP Support
|
||||||
ifeq ($(USE_UPNP),yes)
|
ifeq ($(USE_UPNP),yes)
|
||||||
@@ -25,25 +38,23 @@ LDLIBS += \
|
|||||||
-lws2_32 \
|
-lws2_32 \
|
||||||
-lgdi32 \
|
-lgdi32 \
|
||||||
-liphlpapi \
|
-liphlpapi \
|
||||||
-lstdc++ \
|
-lole32 \
|
||||||
|
-luuid \
|
||||||
-lpthread
|
-lpthread
|
||||||
|
|
||||||
ifeq ($(USE_WIN32_APP), yes)
|
ifeq ($(USE_WIN32_APP), yes)
|
||||||
CXXFLAGS += -DWIN32_APP
|
NEEDED_CXXFLAGS += -DWIN32_APP
|
||||||
LDFLAGS += -mwindows
|
LDFLAGS += -mwindows
|
||||||
DAEMON_RC += Win32/Resource.rc
|
DAEMON_RC += Win32/Resource.rc
|
||||||
DAEMON_OBJS += $(patsubst %.rc,obj/%.o,$(DAEMON_RC))
|
DAEMON_OBJS += $(patsubst %.rc,obj/%.o,$(DAEMON_RC))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# don't change following line to ifeq ($(USE_AESNI),yes) !!!
|
ifeq ($(USE_WINXP_FLAGS), yes)
|
||||||
ifeq ($(USE_AESNI),1)
|
NEEDED_CXXFLAGS += -DWINVER=0x0501 -D_WIN32_WINNT=0x0501
|
||||||
CPU_FLAGS += -maes
|
|
||||||
else
|
|
||||||
CPU_FLAGS += -msse
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(USE_AVX),1)
|
ifeq ($(USE_AESNI),yes)
|
||||||
CPU_FLAGS += -mavx
|
NEEDED_CXXFLAGS += -D__AES__ -maes
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(USE_ASLR),yes)
|
ifeq ($(USE_ASLR),yes)
|
||||||
|
|||||||
11
Makefile.osx
11
Makefile.osx
@@ -2,6 +2,9 @@ CXX = clang++
|
|||||||
CXXFLAGS := ${CXX_DEBUG} -Wall -std=c++11 -DMAC_OSX
|
CXXFLAGS := ${CXX_DEBUG} -Wall -std=c++11 -DMAC_OSX
|
||||||
INCFLAGS = -I/usr/local/include
|
INCFLAGS = -I/usr/local/include
|
||||||
LDFLAGS := -Wl,-rpath,/usr/local/lib -L/usr/local/lib
|
LDFLAGS := -Wl,-rpath,/usr/local/lib -L/usr/local/lib
|
||||||
|
LDFLAGS += -Wl,-dead_strip
|
||||||
|
LDFLAGS += -Wl,-dead_strip_dylibs
|
||||||
|
LDFLAGS += -Wl,-bind_at_load
|
||||||
|
|
||||||
ifeq ($(USE_STATIC),yes)
|
ifeq ($(USE_STATIC),yes)
|
||||||
LDLIBS = -lz /usr/local/lib/libcrypto.a /usr/local/lib/libssl.a /usr/local/lib/libboost_system.a /usr/local/lib/libboost_date_time.a /usr/local/lib/libboost_filesystem.a /usr/local/lib/libboost_program_options.a -lpthread
|
LDLIBS = -lz /usr/local/lib/libcrypto.a /usr/local/lib/libssl.a /usr/local/lib/libboost_system.a /usr/local/lib/libboost_date_time.a /usr/local/lib/libboost_filesystem.a /usr/local/lib/libboost_program_options.a -lpthread
|
||||||
@@ -19,12 +22,8 @@ ifeq ($(USE_UPNP),yes)
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(USE_AESNI),1)
|
ifeq ($(USE_AESNI),yes)
|
||||||
CXXFLAGS += -maes
|
CXXFLAGS += -D__AES__ -maes
|
||||||
else
|
else
|
||||||
CXXFLAGS += -msse
|
CXXFLAGS += -msse
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(USE_AVX),1)
|
|
||||||
CXXFLAGS += -mavx
|
|
||||||
endif
|
|
||||||
|
|||||||
30
README.md
30
README.md
@@ -1,3 +1,11 @@
|
|||||||
|
[](https://github.com/PurpleI2P/i2pd/releases/latest)
|
||||||
|
[](https://snapcraft.io/i2pd)
|
||||||
|
[](https://github.com/PurpleI2P/i2pd/blob/openssl/LICENSE)
|
||||||
|
[](https://repology.org/project/i2pd/versions)
|
||||||
|
[](https://hub.docker.com/r/purplei2p/i2pd)
|
||||||
|
|
||||||
|
*note: i2pd for Android can be found in [i2pd-android](https://github.com/PurpleI2P/i2pd-android) repository and with Qt GUI in [i2pd-qt](https://github.com/PurpleI2P/i2pd-qt) repository*
|
||||||
|
|
||||||
i2pd
|
i2pd
|
||||||
====
|
====
|
||||||
|
|
||||||
@@ -38,11 +46,17 @@ Resources
|
|||||||
Installing
|
Installing
|
||||||
----------
|
----------
|
||||||
|
|
||||||
The easiest way to install i2pd is by using
|
The easiest way to install i2pd is by using precompiled packages and binaries.
|
||||||
[precompiled binaries](https://github.com/PurpleI2P/i2pd/releases/latest).
|
You can fetch most of them on [release](https://github.com/PurpleI2P/i2pd/releases/latest) page.
|
||||||
|
Please see [documentation](https://i2pd.readthedocs.io/en/latest/user-guide/install/) for more info.
|
||||||
|
|
||||||
|
Building
|
||||||
|
--------
|
||||||
See [documentation](https://i2pd.readthedocs.io/en/latest/) for how to build
|
See [documentation](https://i2pd.readthedocs.io/en/latest/) for how to build
|
||||||
i2pd from source on your OS.
|
i2pd from source on your OS.
|
||||||
|
|
||||||
|
note: i2pd with Qt GUI can be found in [i2pd-qt](https://github.com/PurpleI2P/i2pd-qt) repository and for android in [i2pd-android](https://github.com/PurpleI2P/i2pd-android) repository.
|
||||||
|
|
||||||
|
|
||||||
Build instructions:
|
Build instructions:
|
||||||
|
|
||||||
@@ -54,11 +68,13 @@ Build instructions:
|
|||||||
|
|
||||||
**Supported systems:**
|
**Supported systems:**
|
||||||
|
|
||||||
* GNU/Linux x86/x64 - [](https://travis-ci.org/PurpleI2P/i2pd)
|
* GNU/Linux - [](https://travis-ci.org/PurpleI2P/i2pd)
|
||||||
* Windows - [](https://ci.appveyor.com/project/PurpleI2P/i2pd)
|
* CentOS / Fedora / Mageia - [](https://copr.fedorainfracloud.org/coprs/supervillain/i2pd/package/i2pd-git/)
|
||||||
* Mac OS X - [](https://travis-ci.org/PurpleI2P/i2pd)
|
* Alpine, ArchLinux, openSUSE, Gentoo, Debian, Ubuntu, etc.
|
||||||
* CentOS / Fedora - [](https://copr.fedorainfracloud.org/coprs/supervillain/i2pd/package/i2pd-git/)
|
* Windows - [](https://ci.appveyor.com/project/PurpleI2P/i2pd)
|
||||||
* Docker image - [](https://hub.docker.com/r/meeh/i2pd/builds/)
|
* Mac OS X - [](https://travis-ci.org/PurpleI2P/i2pd)
|
||||||
|
* Docker image - [](https://hub.docker.com/r/purplei2p/i2pd/builds/)
|
||||||
|
* Snap
|
||||||
* FreeBSD
|
* FreeBSD
|
||||||
* Android
|
* Android
|
||||||
* iOS
|
* iOS
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013-2020, The PurpleI2P Project
|
||||||
|
*
|
||||||
|
* This file is part of Purple i2pd project and licensed under BSD3
|
||||||
|
*
|
||||||
|
* See full license text in LICENSE file at top of project tree
|
||||||
|
*/
|
||||||
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <clocale>
|
#include <clocale>
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
@@ -6,9 +14,9 @@
|
|||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "Win32/Win32Service.h"
|
|
||||||
#ifdef WIN32_APP
|
#ifdef WIN32_APP
|
||||||
#include "Win32/Win32App.h"
|
#include <windows.h>
|
||||||
|
#include "Win32App.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace i2p
|
namespace i2p
|
||||||
@@ -23,43 +31,14 @@ namespace util
|
|||||||
setlocale(LC_ALL, "Russian");
|
setlocale(LC_ALL, "Russian");
|
||||||
setlocale(LC_TIME, "C");
|
setlocale(LC_TIME, "C");
|
||||||
|
|
||||||
|
i2p::log::SetThrowFunction ([](const std::string& s)
|
||||||
|
{
|
||||||
|
MessageBox(0, TEXT(s.c_str ()), TEXT("i2pd"), MB_ICONERROR | MB_TASKMODAL | MB_OK );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
if (!Daemon_Singleton::init(argc, argv))
|
if (!Daemon_Singleton::init(argc, argv))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string serviceControl; i2p::config::GetOption("svcctl", serviceControl);
|
|
||||||
if (serviceControl == "install")
|
|
||||||
{
|
|
||||||
LogPrint(eLogInfo, "WinSVC: installing ", SERVICE_NAME, " as service");
|
|
||||||
InstallService(
|
|
||||||
SERVICE_NAME, // Name of service
|
|
||||||
SERVICE_DISPLAY_NAME, // Name to display
|
|
||||||
SERVICE_START_TYPE, // Service start type
|
|
||||||
SERVICE_DEPENDENCIES, // Dependencies
|
|
||||||
SERVICE_ACCOUNT, // Service running account
|
|
||||||
SERVICE_PASSWORD // Password of the account
|
|
||||||
);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else if (serviceControl == "remove")
|
|
||||||
{
|
|
||||||
LogPrint(eLogInfo, "WinSVC: uninstalling ", SERVICE_NAME, " service");
|
|
||||||
UninstallService(SERVICE_NAME);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isDaemon)
|
|
||||||
{
|
|
||||||
LogPrint(eLogDebug, "Daemon: running as service");
|
|
||||||
I2PService service(SERVICE_NAME);
|
|
||||||
if (!I2PService::Run(service))
|
|
||||||
{
|
|
||||||
LogPrint(eLogError, "Daemon: Service failed to run w/err 0x%08lx\n", GetLastError());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
LogPrint(eLogDebug, "Daemon: running as user");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,9 +51,6 @@ namespace util
|
|||||||
setlocale(LC_TIME, "C");
|
setlocale(LC_TIME, "C");
|
||||||
#ifdef WIN32_APP
|
#ifdef WIN32_APP
|
||||||
if (!i2p::win32::StartWin32App ()) return false;
|
if (!i2p::win32::StartWin32App ()) return false;
|
||||||
|
|
||||||
// override log
|
|
||||||
i2p::config::SetOption("log", std::string ("file"));
|
|
||||||
#endif
|
#endif
|
||||||
bool ret = Daemon_Singleton::start();
|
bool ret = Daemon_Singleton::start();
|
||||||
if (ret && i2p::log::Logger().GetLogType() == eLogFile)
|
if (ret && i2p::log::Logger().GetLogType() == eLogFile)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ BEGIN
|
|||||||
VALUE "FileDescription", "C++ I2P daemon"
|
VALUE "FileDescription", "C++ I2P daemon"
|
||||||
VALUE "FileVersion", I2PD_VERSION
|
VALUE "FileVersion", I2PD_VERSION
|
||||||
VALUE "InternalName", CODENAME
|
VALUE "InternalName", CODENAME
|
||||||
VALUE "LegalCopyright", "Copyright (C) 2013-2017, The PurpleI2P Project"
|
VALUE "LegalCopyright", "Copyright (C) 2013-2020, The PurpleI2P Project"
|
||||||
VALUE "OriginalFilename", "i2pd"
|
VALUE "OriginalFilename", "i2pd"
|
||||||
VALUE "ProductName", "Purple I2P"
|
VALUE "ProductName", "Purple I2P"
|
||||||
VALUE "ProductVersion", I2P_VERSION
|
VALUE "ProductVersion", I2P_VERSION
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013-2020, The PurpleI2P Project
|
||||||
|
*
|
||||||
|
* This file is part of Purple i2pd project and licensed under BSD3
|
||||||
|
*
|
||||||
|
* See full license text in LICENSE file at top of project tree
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
@@ -11,11 +20,7 @@
|
|||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "Daemon.h"
|
#include "Daemon.h"
|
||||||
#include "Win32App.h"
|
#include "Win32App.h"
|
||||||
#include <stdio.h>
|
#include "Win32NetState.h"
|
||||||
|
|
||||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
|
||||||
#define snprintf _snprintf
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ID_ABOUT 2000
|
#define ID_ABOUT 2000
|
||||||
#define ID_EXIT 2001
|
#define ID_EXIT 2001
|
||||||
@@ -24,17 +29,22 @@
|
|||||||
#define ID_GRACEFUL_SHUTDOWN 2004
|
#define ID_GRACEFUL_SHUTDOWN 2004
|
||||||
#define ID_STOP_GRACEFUL_SHUTDOWN 2005
|
#define ID_STOP_GRACEFUL_SHUTDOWN 2005
|
||||||
#define ID_RELOAD 2006
|
#define ID_RELOAD 2006
|
||||||
|
#define ID_ACCEPT_TRANSIT 2007
|
||||||
|
#define ID_DECLINE_TRANSIT 2008
|
||||||
|
|
||||||
#define ID_TRAY_ICON 2050
|
#define ID_TRAY_ICON 2050
|
||||||
#define WM_TRAYICON (WM_USER + 1)
|
#define WM_TRAYICON (WM_USER + 1)
|
||||||
|
|
||||||
#define IDT_GRACEFUL_SHUTDOWN_TIMER 2100
|
#define IDT_GRACEFUL_SHUTDOWN_TIMER 2100
|
||||||
#define FRAME_UPDATE_TIMER 2101
|
#define FRAME_UPDATE_TIMER 2101
|
||||||
|
#define IDT_GRACEFUL_TUNNELCHECK_TIMER 2102
|
||||||
|
|
||||||
namespace i2p
|
namespace i2p
|
||||||
{
|
{
|
||||||
namespace win32
|
namespace win32
|
||||||
{
|
{
|
||||||
|
DWORD g_GracefulShutdownEndtime = 0;
|
||||||
|
|
||||||
static void ShowPopupMenu (HWND hWnd, POINT *curpos, int wDefaultItem)
|
static void ShowPopupMenu (HWND hWnd, POINT *curpos, int wDefaultItem)
|
||||||
{
|
{
|
||||||
HMENU hPopup = CreatePopupMenu();
|
HMENU hPopup = CreatePopupMenu();
|
||||||
@@ -42,11 +52,17 @@ namespace win32
|
|||||||
InsertMenu (hPopup, -1, MF_BYPOSITION | MF_STRING, ID_APP, "Show app");
|
InsertMenu (hPopup, -1, MF_BYPOSITION | MF_STRING, ID_APP, "Show app");
|
||||||
InsertMenu (hPopup, -1, MF_BYPOSITION | MF_STRING, ID_ABOUT, "&About...");
|
InsertMenu (hPopup, -1, MF_BYPOSITION | MF_STRING, ID_ABOUT, "&About...");
|
||||||
InsertMenu (hPopup, -1, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
|
InsertMenu (hPopup, -1, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
|
||||||
InsertMenu (hPopup, -1, MF_BYPOSITION | MF_STRING, ID_RELOAD, "&Reload configs");
|
if(!i2p::context.AcceptsTunnels())
|
||||||
|
InsertMenu (hPopup, -1,
|
||||||
|
i2p::util::DaemonWin32::Instance ().isGraceful ? MF_BYPOSITION | MF_STRING | MF_GRAYED : MF_BYPOSITION | MF_STRING,
|
||||||
|
ID_ACCEPT_TRANSIT, "Accept &transit");
|
||||||
|
else
|
||||||
|
InsertMenu (hPopup, -1, MF_BYPOSITION | MF_STRING, ID_DECLINE_TRANSIT, "Decline &transit");
|
||||||
|
InsertMenu (hPopup, -1, MF_BYPOSITION | MF_STRING, ID_RELOAD, "&Reload tunnels config");
|
||||||
if (!i2p::util::DaemonWin32::Instance ().isGraceful)
|
if (!i2p::util::DaemonWin32::Instance ().isGraceful)
|
||||||
InsertMenu (hPopup, -1, MF_BYPOSITION | MF_STRING, ID_GRACEFUL_SHUTDOWN, "&Graceful shutdown");
|
InsertMenu (hPopup, -1, MF_BYPOSITION | MF_STRING, ID_GRACEFUL_SHUTDOWN, "&Graceful shutdown");
|
||||||
else
|
else
|
||||||
InsertMenu (hPopup, -1, MF_BYPOSITION | MF_STRING, ID_STOP_GRACEFUL_SHUTDOWN, "&Stop graceful shutdown");
|
InsertMenu (hPopup, -1, MF_BYPOSITION | MF_STRING, ID_STOP_GRACEFUL_SHUTDOWN, "Stop &graceful shutdown");
|
||||||
InsertMenu (hPopup, -1, MF_BYPOSITION | MF_STRING, ID_EXIT, "E&xit");
|
InsertMenu (hPopup, -1, MF_BYPOSITION | MF_STRING, ID_EXIT, "E&xit");
|
||||||
SetMenuDefaultItem (hPopup, ID_CONSOLE, FALSE);
|
SetMenuDefaultItem (hPopup, ID_CONSOLE, FALSE);
|
||||||
SendMessage (hWnd, WM_INITMENUPOPUP, (WPARAM)hPopup, 0);
|
SendMessage (hWnd, WM_INITMENUPOPUP, (WPARAM)hPopup, 0);
|
||||||
@@ -64,18 +80,19 @@ namespace win32
|
|||||||
DestroyMenu(hPopup);
|
DestroyMenu(hPopup);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AddTrayIcon (HWND hWnd)
|
static void AddTrayIcon (HWND hWnd, bool notify = false)
|
||||||
{
|
{
|
||||||
NOTIFYICONDATA nid;
|
NOTIFYICONDATA nid;
|
||||||
memset(&nid, 0, sizeof(nid));
|
memset(&nid, 0, sizeof(nid));
|
||||||
nid.cbSize = sizeof(nid);
|
nid.cbSize = sizeof(nid);
|
||||||
nid.hWnd = hWnd;
|
nid.hWnd = hWnd;
|
||||||
nid.uID = ID_TRAY_ICON;
|
nid.uID = ID_TRAY_ICON;
|
||||||
|
nid.uFlags = notify ? NIF_ICON | NIF_MESSAGE | NIF_TIP | NIF_INFO : NIF_ICON | NIF_MESSAGE | NIF_TIP;
|
||||||
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP | NIF_INFO;
|
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP | NIF_INFO;
|
||||||
nid.uCallbackMessage = WM_TRAYICON;
|
nid.uCallbackMessage = WM_TRAYICON;
|
||||||
nid.hIcon = LoadIcon (GetModuleHandle(NULL), MAKEINTRESOURCE (MAINICON));
|
nid.hIcon = LoadIcon (GetModuleHandle(NULL), MAKEINTRESOURCE (MAINICON));
|
||||||
strcpy (nid.szTip, "i2pd");
|
strcpy (nid.szTip, "i2pd");
|
||||||
strcpy (nid.szInfo, "i2pd is starting");
|
if (notify) strcpy (nid.szInfo, "i2pd is starting");
|
||||||
Shell_NotifyIcon(NIM_ADD, &nid );
|
Shell_NotifyIcon(NIM_ADD, &nid );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,7 +165,13 @@ namespace win32
|
|||||||
s << "; ";
|
s << "; ";
|
||||||
s << "Success Rate: " << i2p::tunnel::tunnels.GetTunnelCreationSuccessRate() << "%\n";
|
s << "Success Rate: " << i2p::tunnel::tunnels.GetTunnelCreationSuccessRate() << "%\n";
|
||||||
s << "Uptime: "; ShowUptime(s, i2p::context.GetUptime ());
|
s << "Uptime: "; ShowUptime(s, i2p::context.GetUptime ());
|
||||||
s << "\n";
|
if (g_GracefulShutdownEndtime != 0)
|
||||||
|
{
|
||||||
|
DWORD GracefulTimeLeft = (g_GracefulShutdownEndtime - GetTickCount()) / 1000;
|
||||||
|
s << "Graceful shutdown, time left: "; ShowUptime(s, GracefulTimeLeft);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
s << "\n";
|
||||||
s << "Inbound: " << i2p::transport::transports.GetInBandwidth() / 1024 << " KiB/s; ";
|
s << "Inbound: " << i2p::transport::transports.GetInBandwidth() / 1024 << " KiB/s; ";
|
||||||
s << "Outbound: " << i2p::transport::transports.GetOutBandwidth() / 1024 << " KiB/s\n";
|
s << "Outbound: " << i2p::transport::transports.GetOutBandwidth() / 1024 << " KiB/s\n";
|
||||||
s << "Received: "; ShowTransfered (s, i2p::transport::transports.GetTotalReceivedBytes());
|
s << "Received: "; ShowTransfered (s, i2p::transport::transports.GetTotalReceivedBytes());
|
||||||
@@ -166,11 +189,14 @@ namespace win32
|
|||||||
|
|
||||||
static LRESULT CALLBACK WndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
static LRESULT CALLBACK WndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
static UINT s_uTaskbarRestart;
|
||||||
|
|
||||||
switch (uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
case WM_CREATE:
|
case WM_CREATE:
|
||||||
{
|
{
|
||||||
AddTrayIcon (hWnd);
|
s_uTaskbarRestart = RegisterWindowMessage(TEXT("TaskbarCreated"));
|
||||||
|
AddTrayIcon (hWnd, true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
@@ -178,6 +204,7 @@ namespace win32
|
|||||||
RemoveTrayIcon (hWnd);
|
RemoveTrayIcon (hWnd);
|
||||||
KillTimer (hWnd, FRAME_UPDATE_TIMER);
|
KillTimer (hWnd, FRAME_UPDATE_TIMER);
|
||||||
KillTimer (hWnd, IDT_GRACEFUL_SHUTDOWN_TIMER);
|
KillTimer (hWnd, IDT_GRACEFUL_SHUTDOWN_TIMER);
|
||||||
|
KillTimer (hWnd, IDT_GRACEFUL_TUNNELCHECK_TIMER);
|
||||||
PostQuitMessage (0);
|
PostQuitMessage (0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -197,10 +224,28 @@ namespace win32
|
|||||||
PostMessage (hWnd, WM_CLOSE, 0, 0);
|
PostMessage (hWnd, WM_CLOSE, 0, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
case ID_ACCEPT_TRANSIT:
|
||||||
|
{
|
||||||
|
i2p::context.SetAcceptsTunnels (true);
|
||||||
|
std::stringstream text;
|
||||||
|
text << "I2Pd now accept transit tunnels";
|
||||||
|
MessageBox( hWnd, TEXT(text.str ().c_str ()), TEXT("i2pd"), MB_ICONINFORMATION | MB_OK );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case ID_DECLINE_TRANSIT:
|
||||||
|
{
|
||||||
|
i2p::context.SetAcceptsTunnels (false);
|
||||||
|
std::stringstream text;
|
||||||
|
text << "I2Pd now decline new transit tunnels";
|
||||||
|
MessageBox( hWnd, TEXT(text.str ().c_str ()), TEXT("i2pd"), MB_ICONINFORMATION | MB_OK );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
case ID_GRACEFUL_SHUTDOWN:
|
case ID_GRACEFUL_SHUTDOWN:
|
||||||
{
|
{
|
||||||
i2p::context.SetAcceptsTunnels (false);
|
i2p::context.SetAcceptsTunnels (false);
|
||||||
SetTimer (hWnd, IDT_GRACEFUL_SHUTDOWN_TIMER, 10*60*1000, nullptr); // 10 minutes
|
SetTimer (hWnd, IDT_GRACEFUL_SHUTDOWN_TIMER, 10*60*1000, nullptr); // 10 minutes
|
||||||
|
SetTimer (hWnd, IDT_GRACEFUL_TUNNELCHECK_TIMER, 1000, nullptr); // check tunnels every second
|
||||||
|
g_GracefulShutdownEndtime = GetTickCount() + 10*60*1000;
|
||||||
i2p::util::DaemonWin32::Instance ().isGraceful = true;
|
i2p::util::DaemonWin32::Instance ().isGraceful = true;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -208,6 +253,8 @@ namespace win32
|
|||||||
{
|
{
|
||||||
i2p::context.SetAcceptsTunnels (true);
|
i2p::context.SetAcceptsTunnels (true);
|
||||||
KillTimer (hWnd, IDT_GRACEFUL_SHUTDOWN_TIMER);
|
KillTimer (hWnd, IDT_GRACEFUL_SHUTDOWN_TIMER);
|
||||||
|
KillTimer (hWnd, IDT_GRACEFUL_TUNNELCHECK_TIMER);
|
||||||
|
g_GracefulShutdownEndtime = 0;
|
||||||
i2p::util::DaemonWin32::Instance ().isGraceful = false;
|
i2p::util::DaemonWin32::Instance ().isGraceful = false;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -223,7 +270,7 @@ namespace win32
|
|||||||
{
|
{
|
||||||
char buf[30];
|
char buf[30];
|
||||||
std::string httpAddr; i2p::config::GetOption("http.address", httpAddr);
|
std::string httpAddr; i2p::config::GetOption("http.address", httpAddr);
|
||||||
uint16_t httpPort; i2p::config::GetOption("http.port", httpPort);
|
uint16_t httpPort; i2p::config::GetOption("http.port", httpPort);
|
||||||
snprintf(buf, 30, "http://%s:%d", httpAddr.c_str(), httpPort);
|
snprintf(buf, 30, "http://%s:%d", httpAddr.c_str(), httpPort);
|
||||||
ShellExecute(NULL, "open", buf, NULL, NULL, SW_SHOWNORMAL);
|
ShellExecute(NULL, "open", buf, NULL, NULL, SW_SHOWNORMAL);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -290,14 +337,27 @@ namespace win32
|
|||||||
}
|
}
|
||||||
case WM_TIMER:
|
case WM_TIMER:
|
||||||
{
|
{
|
||||||
if (wParam == IDT_GRACEFUL_SHUTDOWN_TIMER)
|
switch(wParam)
|
||||||
{
|
{
|
||||||
PostMessage (hWnd, WM_CLOSE, 0, 0); // exit
|
case IDT_GRACEFUL_SHUTDOWN_TIMER:
|
||||||
return 0;
|
{
|
||||||
}
|
g_GracefulShutdownEndtime = 0;
|
||||||
if (wParam == FRAME_UPDATE_TIMER)
|
PostMessage (hWnd, WM_CLOSE, 0, 0); // exit
|
||||||
{
|
return 0;
|
||||||
InvalidateRect(hWnd, NULL, TRUE);
|
}
|
||||||
|
case IDT_GRACEFUL_TUNNELCHECK_TIMER:
|
||||||
|
{
|
||||||
|
if (i2p::tunnel::tunnels.CountTransitTunnels() == 0)
|
||||||
|
PostMessage (hWnd, WM_CLOSE, 0, 0);
|
||||||
|
else
|
||||||
|
SetTimer (hWnd, IDT_GRACEFUL_TUNNELCHECK_TIMER, 1000, nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case FRAME_UPDATE_TIMER:
|
||||||
|
{
|
||||||
|
InvalidateRect(hWnd, NULL, TRUE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -318,6 +378,12 @@ namespace win32
|
|||||||
EndPaint(hWnd, &ps);
|
EndPaint(hWnd, &ps);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
if (uMsg == s_uTaskbarRestart)
|
||||||
|
AddTrayIcon (hWnd, false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return DefWindowProc( hWnd, uMsg, wParam, lParam);
|
return DefWindowProc( hWnd, uMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
@@ -352,6 +418,7 @@ namespace win32
|
|||||||
MessageBox(NULL, "Failed to create main window", TEXT("Warning!"), MB_ICONERROR | MB_OK | MB_TOPMOST);
|
MessageBox(NULL, "Failed to create main window", TEXT("Warning!"), MB_ICONERROR | MB_OK | MB_TOPMOST);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
SubscribeToEvents();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -371,6 +438,7 @@ namespace win32
|
|||||||
HWND hWnd = FindWindow (I2PD_WIN32_CLASSNAME, TEXT("i2pd"));
|
HWND hWnd = FindWindow (I2PD_WIN32_CLASSNAME, TEXT("i2pd"));
|
||||||
if (hWnd)
|
if (hWnd)
|
||||||
PostMessage (hWnd, WM_COMMAND, MAKEWPARAM(ID_EXIT, 0), 0);
|
PostMessage (hWnd, WM_COMMAND, MAKEWPARAM(ID_EXIT, 0), 0);
|
||||||
|
// UnSubscribeFromEvents(); // TODO: understand why unsubscribing crashes app
|
||||||
UnregisterClass (I2PD_WIN32_CLASSNAME, GetModuleHandle(NULL));
|
UnregisterClass (I2PD_WIN32_CLASSNAME, GetModuleHandle(NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -389,6 +457,5 @@ namespace win32
|
|||||||
PostMessage (hWnd, WM_COMMAND, MAKEWPARAM(ID_STOP_GRACEFUL_SHUTDOWN, 0), 0);
|
PostMessage (hWnd, WM_COMMAND, MAKEWPARAM(ID_STOP_GRACEFUL_SHUTDOWN, 0), 0);
|
||||||
return hWnd;
|
return hWnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013-2020, The PurpleI2P Project
|
||||||
|
*
|
||||||
|
* This file is part of Purple i2pd project and licensed under BSD3
|
||||||
|
*
|
||||||
|
* See full license text in LICENSE file at top of project tree
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef WIN32APP_H__
|
#ifndef WIN32APP_H__
|
||||||
#define WIN32APP_H__
|
#define WIN32APP_H__
|
||||||
|
|
||||||
@@ -7,6 +15,8 @@ namespace i2p
|
|||||||
{
|
{
|
||||||
namespace win32
|
namespace win32
|
||||||
{
|
{
|
||||||
|
extern DWORD g_GracefulShutdownEndtime;
|
||||||
|
|
||||||
bool StartWin32App ();
|
bool StartWin32App ();
|
||||||
void StopWin32App ();
|
void StopWin32App ();
|
||||||
int RunWin32App ();
|
int RunWin32App ();
|
||||||
|
|||||||
86
Win32/Win32NetState.cpp
Normal file
86
Win32/Win32NetState.cpp
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013-2020, The PurpleI2P Project
|
||||||
|
*
|
||||||
|
* This file is part of Purple i2pd project and licensed under BSD3
|
||||||
|
*
|
||||||
|
* See full license text in LICENSE file at top of project tree
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if WINVER != 0x0501 // supported since Vista
|
||||||
|
#include "Win32NetState.h"
|
||||||
|
#include <windows.h>
|
||||||
|
#include "Log.h"
|
||||||
|
|
||||||
|
IUnknown *pUnknown = nullptr;
|
||||||
|
INetworkListManager *pNetworkListManager = nullptr;
|
||||||
|
IConnectionPointContainer *pCPContainer = nullptr;
|
||||||
|
IConnectionPoint *pConnectPoint = nullptr;
|
||||||
|
DWORD Cookie = 0;
|
||||||
|
|
||||||
|
void SubscribeToEvents()
|
||||||
|
{
|
||||||
|
LogPrint(eLogInfo, "NetState: Trying to subscribe to NetworkListManagerEvents");
|
||||||
|
CoInitialize(NULL);
|
||||||
|
|
||||||
|
HRESULT Result = CoCreateInstance(CLSID_NetworkListManager, NULL, CLSCTX_ALL, IID_IUnknown, (void **)&pUnknown);
|
||||||
|
if (SUCCEEDED(Result))
|
||||||
|
{
|
||||||
|
Result = pUnknown->QueryInterface(IID_INetworkListManager, (void **)&pNetworkListManager);
|
||||||
|
if (SUCCEEDED(Result))
|
||||||
|
{
|
||||||
|
VARIANT_BOOL IsConnect = VARIANT_FALSE;
|
||||||
|
Result = pNetworkListManager->IsConnectedToInternet(&IsConnect);
|
||||||
|
if (SUCCEEDED(Result)) {
|
||||||
|
i2p::transport::transports.SetOnline (true);
|
||||||
|
LogPrint(eLogInfo, "NetState: current state: ", IsConnect == VARIANT_TRUE ? "connected" : "disconnected");
|
||||||
|
}
|
||||||
|
|
||||||
|
Result = pNetworkListManager->QueryInterface(IID_IConnectionPointContainer, (void **)&pCPContainer);
|
||||||
|
if (SUCCEEDED(Result))
|
||||||
|
{
|
||||||
|
Result = pCPContainer->FindConnectionPoint(IID_INetworkListManagerEvents, &pConnectPoint);
|
||||||
|
if(SUCCEEDED(Result))
|
||||||
|
{
|
||||||
|
CNetworkListManagerEvent *NetEvent = new CNetworkListManagerEvent;
|
||||||
|
Result = pConnectPoint->Advise((IUnknown *)NetEvent, &Cookie);
|
||||||
|
if (SUCCEEDED(Result))
|
||||||
|
LogPrint(eLogInfo, "NetState: Successfully subscribed to NetworkListManagerEvent messages");
|
||||||
|
else
|
||||||
|
LogPrint(eLogError, "NetState: Unable to subscribe to NetworkListManagerEvent messages");
|
||||||
|
} else
|
||||||
|
LogPrint(eLogError, "NetState: Unable to find interface connection point");
|
||||||
|
} else
|
||||||
|
LogPrint(eLogError, "NetState: Unable to query NetworkListManager interface");
|
||||||
|
} else
|
||||||
|
LogPrint(eLogError, "NetState: Unable to query global interface");
|
||||||
|
} else
|
||||||
|
LogPrint(eLogError, "NetState: Unable to create INetworkListManager interface");
|
||||||
|
}
|
||||||
|
|
||||||
|
void UnSubscribeFromEvents()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (pConnectPoint) {
|
||||||
|
pConnectPoint->Unadvise(Cookie);
|
||||||
|
pConnectPoint->Release();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pCPContainer)
|
||||||
|
pCPContainer->Release();
|
||||||
|
|
||||||
|
if (pNetworkListManager)
|
||||||
|
pNetworkListManager->Release();
|
||||||
|
|
||||||
|
if (pUnknown)
|
||||||
|
pUnknown->Release();
|
||||||
|
|
||||||
|
CoUninitialize();
|
||||||
|
}
|
||||||
|
catch (std::exception& ex)
|
||||||
|
{
|
||||||
|
LogPrint (eLogError, "NetState: received exception: ", ex.what ());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // WINVER
|
||||||
94
Win32/Win32NetState.h
Normal file
94
Win32/Win32NetState.h
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013-2020, The PurpleI2P Project
|
||||||
|
*
|
||||||
|
* This file is part of Purple i2pd project and licensed under BSD3
|
||||||
|
*
|
||||||
|
* See full license text in LICENSE file at top of project tree
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef WIN_32_NETSTATE_H__
|
||||||
|
#define WIN_32_NETSTATE_H__
|
||||||
|
|
||||||
|
#if WINVER != 0x0501 // supported since Vista
|
||||||
|
#include <netlistmgr.h>
|
||||||
|
#include <ocidl.h>
|
||||||
|
#include "Log.h"
|
||||||
|
#include "Transports.h"
|
||||||
|
|
||||||
|
class CNetworkListManagerEvent : public INetworkListManagerEvents
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CNetworkListManagerEvent() : m_ref(1) { }
|
||||||
|
~CNetworkListManagerEvent() { }
|
||||||
|
|
||||||
|
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject)
|
||||||
|
{
|
||||||
|
HRESULT Result = S_OK;
|
||||||
|
if (IsEqualIID(riid, IID_IUnknown)) {
|
||||||
|
*ppvObject = (IUnknown *)this;
|
||||||
|
} else if (IsEqualIID(riid ,IID_INetworkListManagerEvents)) {
|
||||||
|
*ppvObject = (INetworkListManagerEvents *)this;
|
||||||
|
} else {
|
||||||
|
Result = E_NOINTERFACE;
|
||||||
|
}
|
||||||
|
AddRef();
|
||||||
|
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG STDMETHODCALLTYPE AddRef()
|
||||||
|
{
|
||||||
|
return (ULONG)InterlockedIncrement(&m_ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG STDMETHODCALLTYPE Release()
|
||||||
|
{
|
||||||
|
LONG Result = InterlockedDecrement(&m_ref);
|
||||||
|
if (Result == 0)
|
||||||
|
delete this;
|
||||||
|
return (ULONG)Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual HRESULT STDMETHODCALLTYPE ConnectivityChanged(NLM_CONNECTIVITY newConnectivity)
|
||||||
|
{
|
||||||
|
if (newConnectivity == NLM_CONNECTIVITY_DISCONNECTED) {
|
||||||
|
i2p::transport::transports.SetOnline (false);
|
||||||
|
LogPrint(eLogInfo, "NetState: disconnected from network");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (((int)newConnectivity & (int)NLM_CONNECTIVITY_IPV4_INTERNET) != 0) {
|
||||||
|
i2p::transport::transports.SetOnline (true);
|
||||||
|
LogPrint(eLogInfo, "NetState: connected to internet with IPv4 capability");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (((int)newConnectivity & (int)NLM_CONNECTIVITY_IPV6_INTERNET) != 0) {
|
||||||
|
i2p::transport::transports.SetOnline (true);
|
||||||
|
LogPrint(eLogInfo, "NetState: connected to internet with IPv6 capability");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
(((int)newConnectivity & (int)NLM_CONNECTIVITY_IPV4_INTERNET) == 0) &&
|
||||||
|
(((int)newConnectivity & (int)NLM_CONNECTIVITY_IPV6_INTERNET) == 0)
|
||||||
|
) {
|
||||||
|
i2p::transport::transports.SetOnline (false);
|
||||||
|
LogPrint(eLogInfo, "NetState: connected without internet access");
|
||||||
|
}
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
LONG m_ref;
|
||||||
|
};
|
||||||
|
|
||||||
|
void SubscribeToEvents();
|
||||||
|
void UnSubscribeFromEvents();
|
||||||
|
|
||||||
|
#else // WINVER == 0x0501
|
||||||
|
|
||||||
|
void SubscribeToEvents() { }
|
||||||
|
void UnSubscribeFromEvents() { }
|
||||||
|
|
||||||
|
#endif // WINVER
|
||||||
|
#endif
|
||||||
@@ -1,405 +0,0 @@
|
|||||||
#ifdef _WIN32
|
|
||||||
#define _CRT_SECURE_NO_WARNINGS // to use freopen
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "Win32Service.h"
|
|
||||||
#include <assert.h>
|
|
||||||
#include <strsafe.h>
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
#include "Daemon.h"
|
|
||||||
#include "Log.h"
|
|
||||||
|
|
||||||
I2PService *I2PService::s_service = NULL;
|
|
||||||
|
|
||||||
BOOL I2PService::isService()
|
|
||||||
{
|
|
||||||
BOOL bIsService = FALSE;
|
|
||||||
HWINSTA hWinStation = GetProcessWindowStation();
|
|
||||||
if (hWinStation != NULL)
|
|
||||||
{
|
|
||||||
USEROBJECTFLAGS uof = { 0 };
|
|
||||||
if (GetUserObjectInformation(hWinStation, UOI_FLAGS, &uof, sizeof(USEROBJECTFLAGS), NULL) && ((uof.dwFlags & WSF_VISIBLE) == 0))
|
|
||||||
{
|
|
||||||
bIsService = TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return bIsService;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL I2PService::Run(I2PService &service)
|
|
||||||
{
|
|
||||||
s_service = &service;
|
|
||||||
SERVICE_TABLE_ENTRY serviceTable[] =
|
|
||||||
{
|
|
||||||
{ service.m_name, ServiceMain },
|
|
||||||
{ NULL, NULL }
|
|
||||||
};
|
|
||||||
return StartServiceCtrlDispatcher(serviceTable);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WINAPI I2PService::ServiceMain(DWORD dwArgc, PSTR *pszArgv)
|
|
||||||
{
|
|
||||||
assert(s_service != NULL);
|
|
||||||
s_service->m_statusHandle = RegisterServiceCtrlHandler(
|
|
||||||
s_service->m_name, ServiceCtrlHandler);
|
|
||||||
if (s_service->m_statusHandle == NULL)
|
|
||||||
{
|
|
||||||
throw GetLastError();
|
|
||||||
}
|
|
||||||
s_service->Start(dwArgc, pszArgv);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void WINAPI I2PService::ServiceCtrlHandler(DWORD dwCtrl)
|
|
||||||
{
|
|
||||||
switch (dwCtrl)
|
|
||||||
{
|
|
||||||
case SERVICE_CONTROL_STOP: s_service->Stop(); break;
|
|
||||||
case SERVICE_CONTROL_PAUSE: s_service->Pause(); break;
|
|
||||||
case SERVICE_CONTROL_CONTINUE: s_service->Continue(); break;
|
|
||||||
case SERVICE_CONTROL_SHUTDOWN: s_service->Shutdown(); break;
|
|
||||||
case SERVICE_CONTROL_INTERROGATE: break;
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
I2PService::I2PService(PSTR pszServiceName,
|
|
||||||
BOOL fCanStop,
|
|
||||||
BOOL fCanShutdown,
|
|
||||||
BOOL fCanPauseContinue)
|
|
||||||
{
|
|
||||||
m_name = (pszServiceName == NULL) ? (PSTR)"" : pszServiceName;
|
|
||||||
m_statusHandle = NULL;
|
|
||||||
m_status.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
|
|
||||||
m_status.dwCurrentState = SERVICE_START_PENDING;
|
|
||||||
|
|
||||||
DWORD dwControlsAccepted = 0;
|
|
||||||
if (fCanStop)
|
|
||||||
dwControlsAccepted |= SERVICE_ACCEPT_STOP;
|
|
||||||
if (fCanShutdown)
|
|
||||||
dwControlsAccepted |= SERVICE_ACCEPT_SHUTDOWN;
|
|
||||||
if (fCanPauseContinue)
|
|
||||||
dwControlsAccepted |= SERVICE_ACCEPT_PAUSE_CONTINUE;
|
|
||||||
|
|
||||||
m_status.dwControlsAccepted = dwControlsAccepted;
|
|
||||||
m_status.dwWin32ExitCode = NO_ERROR;
|
|
||||||
m_status.dwServiceSpecificExitCode = 0;
|
|
||||||
m_status.dwCheckPoint = 0;
|
|
||||||
m_status.dwWaitHint = 0;
|
|
||||||
m_fStopping = FALSE;
|
|
||||||
// Create a manual-reset event that is not signaled at first to indicate
|
|
||||||
// the stopped signal of the service.
|
|
||||||
m_hStoppedEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
|
|
||||||
if (m_hStoppedEvent == NULL)
|
|
||||||
{
|
|
||||||
throw GetLastError();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
I2PService::~I2PService(void)
|
|
||||||
{
|
|
||||||
if (m_hStoppedEvent)
|
|
||||||
{
|
|
||||||
CloseHandle(m_hStoppedEvent);
|
|
||||||
m_hStoppedEvent = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void I2PService::Start(DWORD dwArgc, PSTR *pszArgv)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
SetServiceStatus(SERVICE_START_PENDING);
|
|
||||||
OnStart(dwArgc, pszArgv);
|
|
||||||
SetServiceStatus(SERVICE_RUNNING);
|
|
||||||
}
|
|
||||||
catch (DWORD dwError)
|
|
||||||
{
|
|
||||||
LogPrint(eLogError, "Win32Service Start", dwError);
|
|
||||||
SetServiceStatus(SERVICE_STOPPED, dwError);
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
LogPrint(eLogError, "Win32Service failed to start.", EVENTLOG_ERROR_TYPE);
|
|
||||||
SetServiceStatus(SERVICE_STOPPED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void I2PService::OnStart(DWORD dwArgc, PSTR *pszArgv)
|
|
||||||
{
|
|
||||||
LogPrint(eLogInfo, "Win32Service in OnStart", EVENTLOG_INFORMATION_TYPE);
|
|
||||||
Daemon.start();
|
|
||||||
//i2p::util::config::OptionParser(dwArgc, pszArgv);
|
|
||||||
//i2p::util::filesystem::ReadConfigFile(i2p::util::config::mapArgs, i2p::util::config::mapMultiArgs);
|
|
||||||
//i2p::context.OverrideNTCPAddress(i2p::util::config::GetCharArg("-host", "127.0.0.1"),
|
|
||||||
// i2p::util::config::GetArg("-port", 17070));
|
|
||||||
_worker = new std::thread(std::bind(&I2PService::WorkerThread, this));
|
|
||||||
}
|
|
||||||
|
|
||||||
void I2PService::WorkerThread()
|
|
||||||
{
|
|
||||||
while (!m_fStopping)
|
|
||||||
{
|
|
||||||
::Sleep(1000); // Simulate some lengthy operations.
|
|
||||||
}
|
|
||||||
// Signal the stopped event.
|
|
||||||
SetEvent(m_hStoppedEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
void I2PService::Stop()
|
|
||||||
{
|
|
||||||
DWORD dwOriginalState = m_status.dwCurrentState;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
SetServiceStatus(SERVICE_STOP_PENDING);
|
|
||||||
OnStop();
|
|
||||||
SetServiceStatus(SERVICE_STOPPED);
|
|
||||||
}
|
|
||||||
catch (DWORD dwError)
|
|
||||||
{
|
|
||||||
LogPrint(eLogInfo, "Win32Service Stop", dwError);
|
|
||||||
SetServiceStatus(dwOriginalState);
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
LogPrint(eLogError, "Win32Service failed to stop.", EVENTLOG_ERROR_TYPE);
|
|
||||||
SetServiceStatus(dwOriginalState);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void I2PService::OnStop()
|
|
||||||
{
|
|
||||||
// Log a service stop message to the Application log.
|
|
||||||
LogPrint(eLogInfo, "Win32Service in OnStop", EVENTLOG_INFORMATION_TYPE);
|
|
||||||
Daemon.stop();
|
|
||||||
m_fStopping = TRUE;
|
|
||||||
if (WaitForSingleObject(m_hStoppedEvent, INFINITE) != WAIT_OBJECT_0)
|
|
||||||
{
|
|
||||||
throw GetLastError();
|
|
||||||
}
|
|
||||||
_worker->join();
|
|
||||||
delete _worker;
|
|
||||||
}
|
|
||||||
|
|
||||||
void I2PService::Pause()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
SetServiceStatus(SERVICE_PAUSE_PENDING);
|
|
||||||
OnPause();
|
|
||||||
SetServiceStatus(SERVICE_PAUSED);
|
|
||||||
}
|
|
||||||
catch (DWORD dwError)
|
|
||||||
{
|
|
||||||
LogPrint(eLogError, "Win32Service Pause", dwError);
|
|
||||||
SetServiceStatus(SERVICE_RUNNING);
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
LogPrint(eLogError, "Win32Service failed to pause.", EVENTLOG_ERROR_TYPE);
|
|
||||||
SetServiceStatus(SERVICE_RUNNING);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void I2PService::OnPause()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void I2PService::Continue()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
SetServiceStatus(SERVICE_CONTINUE_PENDING);
|
|
||||||
OnContinue();
|
|
||||||
SetServiceStatus(SERVICE_RUNNING);
|
|
||||||
}
|
|
||||||
catch (DWORD dwError)
|
|
||||||
{
|
|
||||||
LogPrint(eLogError, "Win32Service Continue", dwError);
|
|
||||||
SetServiceStatus(SERVICE_PAUSED);
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
LogPrint(eLogError, "Win32Service failed to resume.", EVENTLOG_ERROR_TYPE);
|
|
||||||
SetServiceStatus(SERVICE_PAUSED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void I2PService::OnContinue()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void I2PService::Shutdown()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
OnShutdown();
|
|
||||||
SetServiceStatus(SERVICE_STOPPED);
|
|
||||||
}
|
|
||||||
catch (DWORD dwError)
|
|
||||||
{
|
|
||||||
LogPrint(eLogError, "Win32Service Shutdown", dwError);
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
LogPrint(eLogError, "Win32Service failed to shut down.", EVENTLOG_ERROR_TYPE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void I2PService::OnShutdown()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void I2PService::SetServiceStatus(DWORD dwCurrentState,
|
|
||||||
DWORD dwWin32ExitCode,
|
|
||||||
DWORD dwWaitHint)
|
|
||||||
{
|
|
||||||
static DWORD dwCheckPoint = 1;
|
|
||||||
m_status.dwCurrentState = dwCurrentState;
|
|
||||||
m_status.dwWin32ExitCode = dwWin32ExitCode;
|
|
||||||
m_status.dwWaitHint = dwWaitHint;
|
|
||||||
m_status.dwCheckPoint =
|
|
||||||
((dwCurrentState == SERVICE_RUNNING) ||
|
|
||||||
(dwCurrentState == SERVICE_STOPPED)) ?
|
|
||||||
0 : dwCheckPoint++;
|
|
||||||
|
|
||||||
::SetServiceStatus(m_statusHandle, &m_status);
|
|
||||||
}
|
|
||||||
|
|
||||||
//*****************************************************************************
|
|
||||||
|
|
||||||
void FreeHandles(SC_HANDLE schSCManager, SC_HANDLE schService)
|
|
||||||
{
|
|
||||||
if (schSCManager)
|
|
||||||
{
|
|
||||||
CloseServiceHandle(schSCManager);
|
|
||||||
schSCManager = NULL;
|
|
||||||
}
|
|
||||||
if (schService)
|
|
||||||
{
|
|
||||||
CloseServiceHandle(schService);
|
|
||||||
schService = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void InstallService(PCSTR pszServiceName, PCSTR pszDisplayName, DWORD dwStartType, PCSTR pszDependencies, PCSTR pszAccount, PCSTR pszPassword)
|
|
||||||
{
|
|
||||||
printf("Try to install Win32Service (%s).\n", pszServiceName);
|
|
||||||
|
|
||||||
char szPath[MAX_PATH];
|
|
||||||
SC_HANDLE schSCManager = NULL;
|
|
||||||
SC_HANDLE schService = NULL;
|
|
||||||
|
|
||||||
if (GetModuleFileName(NULL, szPath, ARRAYSIZE(szPath)) == 0)
|
|
||||||
{
|
|
||||||
printf("GetModuleFileName failed w/err 0x%08lx\n", GetLastError());
|
|
||||||
FreeHandles(schSCManager, schService);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
strncat(szPath, " --daemon", MAX_PATH);
|
|
||||||
|
|
||||||
// Open the local default service control manager database
|
|
||||||
schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT | SC_MANAGER_CREATE_SERVICE);
|
|
||||||
if (schSCManager == NULL)
|
|
||||||
{
|
|
||||||
printf("OpenSCManager failed w/err 0x%08lx\n", GetLastError());
|
|
||||||
FreeHandles(schSCManager, schService);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Install the service into SCM by calling CreateService
|
|
||||||
schService = CreateService(
|
|
||||||
schSCManager, // SCManager database
|
|
||||||
pszServiceName, // Name of service
|
|
||||||
pszDisplayName, // Name to display
|
|
||||||
SERVICE_QUERY_STATUS, // Desired access
|
|
||||||
SERVICE_WIN32_OWN_PROCESS, // Service type
|
|
||||||
dwStartType, // Service start type
|
|
||||||
SERVICE_ERROR_NORMAL, // Error control type
|
|
||||||
szPath, // Service's binary
|
|
||||||
NULL, // No load ordering group
|
|
||||||
NULL, // No tag identifier
|
|
||||||
pszDependencies, // Dependencies
|
|
||||||
pszAccount, // Service running account
|
|
||||||
pszPassword // Password of the account
|
|
||||||
);
|
|
||||||
|
|
||||||
if (schService == NULL)
|
|
||||||
{
|
|
||||||
printf("CreateService failed w/err 0x%08lx\n", GetLastError());
|
|
||||||
FreeHandles(schSCManager, schService);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("Win32Service is installed as %s.\n", pszServiceName);
|
|
||||||
|
|
||||||
// Centralized cleanup for all allocated resources.
|
|
||||||
FreeHandles(schSCManager, schService);
|
|
||||||
}
|
|
||||||
|
|
||||||
void UninstallService(PCSTR pszServiceName)
|
|
||||||
{
|
|
||||||
printf("Try to uninstall Win32Service (%s).\n", pszServiceName);
|
|
||||||
|
|
||||||
SC_HANDLE schSCManager = NULL;
|
|
||||||
SC_HANDLE schService = NULL;
|
|
||||||
SERVICE_STATUS ssSvcStatus = {};
|
|
||||||
|
|
||||||
// Open the local default service control manager database
|
|
||||||
schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT);
|
|
||||||
if (schSCManager == NULL)
|
|
||||||
{
|
|
||||||
printf("OpenSCManager failed w/err 0x%08lx\n", GetLastError());
|
|
||||||
FreeHandles(schSCManager, schService);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Open the service with delete, stop, and query status permissions
|
|
||||||
schService = OpenService(schSCManager, pszServiceName, SERVICE_STOP | SERVICE_QUERY_STATUS | DELETE);
|
|
||||||
if (schService == NULL)
|
|
||||||
{
|
|
||||||
printf("OpenService failed w/err 0x%08lx\n", GetLastError());
|
|
||||||
FreeHandles(schSCManager, schService);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try to stop the service
|
|
||||||
if (ControlService(schService, SERVICE_CONTROL_STOP, &ssSvcStatus))
|
|
||||||
{
|
|
||||||
printf("Stopping %s.\n", pszServiceName);
|
|
||||||
Sleep(1000);
|
|
||||||
|
|
||||||
while (QueryServiceStatus(schService, &ssSvcStatus))
|
|
||||||
{
|
|
||||||
if (ssSvcStatus.dwCurrentState == SERVICE_STOP_PENDING)
|
|
||||||
{
|
|
||||||
printf(".");
|
|
||||||
Sleep(1000);
|
|
||||||
}
|
|
||||||
else break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ssSvcStatus.dwCurrentState == SERVICE_STOPPED)
|
|
||||||
{
|
|
||||||
printf("\n%s is stopped.\n", pszServiceName);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("\n%s failed to stop.\n", pszServiceName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now remove the service by calling DeleteService.
|
|
||||||
if (!DeleteService(schService))
|
|
||||||
{
|
|
||||||
printf("DeleteService failed w/err 0x%08lx\n", GetLastError());
|
|
||||||
FreeHandles(schSCManager, schService);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("%s is removed.\n", pszServiceName);
|
|
||||||
|
|
||||||
// Centralized cleanup for all allocated resources.
|
|
||||||
FreeHandles(schSCManager, schService);
|
|
||||||
}
|
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
#ifndef WIN_32_SERVICE_H__
|
|
||||||
#define WIN_32_SERVICE_H__
|
|
||||||
|
|
||||||
#include <thread>
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
// Internal name of the service
|
|
||||||
#define SERVICE_NAME "i2pdService"
|
|
||||||
|
|
||||||
// Displayed name of the service
|
|
||||||
#define SERVICE_DISPLAY_NAME "i2pd router service"
|
|
||||||
|
|
||||||
// Service start options.
|
|
||||||
#define SERVICE_START_TYPE SERVICE_DEMAND_START
|
|
||||||
|
|
||||||
// List of service dependencies - "dep1\0dep2\0\0"
|
|
||||||
#define SERVICE_DEPENDENCIES ""
|
|
||||||
|
|
||||||
// The name of the account under which the service should run
|
|
||||||
#define SERVICE_ACCOUNT "NT AUTHORITY\\LocalService"
|
|
||||||
|
|
||||||
// The password to the service account name
|
|
||||||
#define SERVICE_PASSWORD NULL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class I2PService
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
I2PService(PSTR pszServiceName,
|
|
||||||
BOOL fCanStop = TRUE,
|
|
||||||
BOOL fCanShutdown = TRUE,
|
|
||||||
BOOL fCanPauseContinue = FALSE);
|
|
||||||
|
|
||||||
virtual ~I2PService(void);
|
|
||||||
|
|
||||||
static BOOL isService();
|
|
||||||
static BOOL Run(I2PService &service);
|
|
||||||
void Stop();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
virtual void OnStart(DWORD dwArgc, PSTR *pszArgv);
|
|
||||||
virtual void OnStop();
|
|
||||||
virtual void OnPause();
|
|
||||||
virtual void OnContinue();
|
|
||||||
virtual void OnShutdown();
|
|
||||||
void SetServiceStatus(DWORD dwCurrentState,
|
|
||||||
DWORD dwWin32ExitCode = NO_ERROR,
|
|
||||||
DWORD dwWaitHint = 0);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
static void WINAPI ServiceMain(DWORD dwArgc, LPSTR *lpszArgv);
|
|
||||||
static void WINAPI ServiceCtrlHandler(DWORD dwCtrl);
|
|
||||||
void WorkerThread();
|
|
||||||
void Start(DWORD dwArgc, PSTR *pszArgv);
|
|
||||||
void Pause();
|
|
||||||
void Continue();
|
|
||||||
void Shutdown();
|
|
||||||
static I2PService* s_service;
|
|
||||||
PSTR m_name;
|
|
||||||
SERVICE_STATUS m_status;
|
|
||||||
SERVICE_STATUS_HANDLE m_statusHandle;
|
|
||||||
|
|
||||||
BOOL m_fStopping;
|
|
||||||
HANDLE m_hStoppedEvent;
|
|
||||||
|
|
||||||
std::thread* _worker;
|
|
||||||
};
|
|
||||||
|
|
||||||
void InstallService(
|
|
||||||
PCSTR pszServiceName,
|
|
||||||
PCSTR pszDisplayName,
|
|
||||||
DWORD dwStartType,
|
|
||||||
PCSTR pszDependencies,
|
|
||||||
PCSTR pszAccount,
|
|
||||||
PCSTR pszPassword
|
|
||||||
);
|
|
||||||
|
|
||||||
void UninstallService(PCSTR pszServiceName);
|
|
||||||
|
|
||||||
#endif // WIN_32_SERVICE_H__
|
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
//{{NO_DEPENDENCIES}}
|
//{{NO_DEPENDENCIES}}
|
||||||
#define MAINICON 101
|
#define MAINICON 101
|
||||||
|
|
||||||
#ifdef APSTUDIO_INVOKED
|
#ifdef APSTUDIO_INVOKED
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 102
|
#define _APS_NEXT_RESOURCE_VALUE 102
|
||||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||||
#define _APS_NEXT_CONTROL_VALUE 1001
|
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||||
#define _APS_NEXT_SYMED_VALUE 101
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,57 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
package="org.purplei2p.i2pd"
|
|
||||||
android:installLocation="auto"
|
|
||||||
android:versionCode="1"
|
|
||||||
android:versionName="2.21.1">
|
|
||||||
|
|
||||||
<uses-sdk
|
|
||||||
android:minSdkVersion="14"
|
|
||||||
android:targetSdkVersion="28" />
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" /> <!-- normal perm, per https://developer.android.com/guide/topics/permissions/normal-permissions.html -->
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
|
||||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <!-- normal perm -->
|
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <!-- required in API 26+ -->
|
|
||||||
<application
|
|
||||||
android:allowBackup="true"
|
|
||||||
android:icon="@drawable/icon"
|
|
||||||
android:label="@string/app_name"
|
|
||||||
android:theme="@android:style/Theme.Holo.Light.DarkActionBar"
|
|
||||||
>
|
|
||||||
<receiver android:name=".NetworkStateChangeReceiver">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".I2PDPermsAskerActivity"
|
|
||||||
android:label="@string/app_name">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.MAIN" />
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
|
||||||
<activity
|
|
||||||
android:name=".I2PDActivity"
|
|
||||||
android:label="@string/app_name" />
|
|
||||||
|
|
||||||
<service
|
|
||||||
android:name=".ForegroundService"
|
|
||||||
android:enabled="true" />
|
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".I2PDPermsExplanationActivity"
|
|
||||||
android:label="@string/title_activity_i2_pdperms_asker_prompt"
|
|
||||||
android:parentActivityName=".I2PDPermsAskerActivity">
|
|
||||||
<meta-data
|
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
|
||||||
android:value="org.purplei2p.i2pd.I2PDPermsAskerActivity" />
|
|
||||||
</activity>
|
|
||||||
</application>
|
|
||||||
|
|
||||||
</manifest>
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../contrib/certificates
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
## Configuration file for a typical i2pd user
|
|
||||||
## See https://i2pd.readthedocs.io/en/latest/user-guide/configuration/
|
|
||||||
## for more options you can use in this file.
|
|
||||||
|
|
||||||
#logfile = /sdcard/i2pd/i2pd.log
|
|
||||||
loglevel = none
|
|
||||||
|
|
||||||
# host = 1.2.3.4
|
|
||||||
# port = 4567
|
|
||||||
|
|
||||||
ipv4 = true
|
|
||||||
ipv6 = false
|
|
||||||
|
|
||||||
# ntcp = true
|
|
||||||
# ntcpproxy = http://127.0.0.1:8118
|
|
||||||
# ssu = true
|
|
||||||
|
|
||||||
bandwidth = L
|
|
||||||
# share = 100
|
|
||||||
|
|
||||||
# notransit = true
|
|
||||||
# floodfill = true
|
|
||||||
|
|
||||||
[ntcp2]
|
|
||||||
enabled = true
|
|
||||||
|
|
||||||
[http]
|
|
||||||
enabled = true
|
|
||||||
address = 127.0.0.1
|
|
||||||
port = 7070
|
|
||||||
# auth = true
|
|
||||||
# user = i2pd
|
|
||||||
# pass = changeme
|
|
||||||
|
|
||||||
[httpproxy]
|
|
||||||
enabled = true
|
|
||||||
address = 127.0.0.1
|
|
||||||
port = 4444
|
|
||||||
# keys = http-proxy-keys.dat
|
|
||||||
# addresshelper = true
|
|
||||||
# outproxy = http://false.i2p
|
|
||||||
## httpproxy section also accepts I2CP parameters, like "inbound.length" etc.
|
|
||||||
|
|
||||||
[socksproxy]
|
|
||||||
enabled = true
|
|
||||||
address = 127.0.0.1
|
|
||||||
port = 4447
|
|
||||||
# keys = socks-proxy-keys.dat
|
|
||||||
# outproxy.enabled = false
|
|
||||||
# outproxy = 127.0.0.1
|
|
||||||
# outproxyport = 9050
|
|
||||||
## socksproxy section also accepts I2CP parameters, like "inbound.length" etc.
|
|
||||||
|
|
||||||
[sam]
|
|
||||||
enabled = false
|
|
||||||
# address = 127.0.0.1
|
|
||||||
# port = 7656
|
|
||||||
|
|
||||||
[precomputation]
|
|
||||||
elgamal = true
|
|
||||||
|
|
||||||
[upnp]
|
|
||||||
enabled = true
|
|
||||||
# name = I2Pd
|
|
||||||
|
|
||||||
[reseed]
|
|
||||||
verify = true
|
|
||||||
## Path to local reseed data file (.su3) for manual reseeding
|
|
||||||
# file = /path/to/i2pseeds.su3
|
|
||||||
## or HTTPS URL to reseed from
|
|
||||||
# file = https://legit-website.com/i2pseeds.su3
|
|
||||||
## Path to local ZIP file or HTTPS URL to reseed from
|
|
||||||
# zipfile = /path/to/netDb.zip
|
|
||||||
## If you run i2pd behind a proxy server, set proxy server for reseeding here
|
|
||||||
## Should be http://address:port or socks://address:port
|
|
||||||
# proxy = http://127.0.0.1:8118
|
|
||||||
## Minimum number of known routers, below which i2pd triggers reseeding. 25 by default
|
|
||||||
# threshold = 25
|
|
||||||
|
|
||||||
[limits]
|
|
||||||
transittunnels = 50
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
http://inr.i2p/export/alive-hosts.txt
|
|
||||||
http://stats.i2p/cgi-bin/newhosts.txt
|
|
||||||
http://i2p-projekt.i2p/hosts.txt
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
[IRC-IRC2P]
|
|
||||||
#type = client
|
|
||||||
#address = 127.0.0.1
|
|
||||||
#port = 6668
|
|
||||||
#destination = irc.postman.i2p
|
|
||||||
#destinationport = 6667
|
|
||||||
#keys = irc-keys.dat
|
|
||||||
|
|
||||||
#[IRC-ILITA]
|
|
||||||
#type = client
|
|
||||||
#address = 127.0.0.1
|
|
||||||
#port = 6669
|
|
||||||
#destination = irc.ilita.i2p
|
|
||||||
#destinationport = 6667
|
|
||||||
#keys = irc-keys.dat
|
|
||||||
|
|
||||||
#[SMTP]
|
|
||||||
#type = client
|
|
||||||
#address = 127.0.0.1
|
|
||||||
#port = 7659
|
|
||||||
#destination = smtp.postman.i2p
|
|
||||||
#destinationport = 25
|
|
||||||
#keys = smtp-keys.dat
|
|
||||||
|
|
||||||
#[POP3]
|
|
||||||
#type = client
|
|
||||||
#address = 127.0.0.1
|
|
||||||
#port = 7660
|
|
||||||
#destination = pop.postman.i2p
|
|
||||||
#destinationport = 110
|
|
||||||
#keys = pop3-keys.dat
|
|
||||||
|
|
||||||
# see more examples at https://i2pd.readthedocs.io/en/latest/user-guide/tunnels/
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
buildscript {
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
jcenter()
|
|
||||||
}
|
|
||||||
dependencies {
|
|
||||||
classpath 'com.android.tools.build:gradle:2.3.3'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
apply plugin: 'com.android.application'
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
jcenter()
|
|
||||||
maven {
|
|
||||||
url 'https://maven.google.com'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compile 'com.android.support:support-compat:28.0.0'
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
|
||||||
compileSdkVersion 28
|
|
||||||
buildToolsVersion "28.0.1"
|
|
||||||
defaultConfig {
|
|
||||||
applicationId "org.purplei2p.i2pd"
|
|
||||||
targetSdkVersion 28
|
|
||||||
minSdkVersion 14
|
|
||||||
versionCode 1
|
|
||||||
versionName "2.21.1"
|
|
||||||
ndk {
|
|
||||||
abiFilters 'armeabi-v7a'
|
|
||||||
abiFilters 'x86'
|
|
||||||
}
|
|
||||||
externalNativeBuild {
|
|
||||||
ndkBuild {
|
|
||||||
arguments "-j4"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sourceSets {
|
|
||||||
main {
|
|
||||||
manifest.srcFile 'AndroidManifest.xml'
|
|
||||||
java.srcDirs = ['src']
|
|
||||||
res.srcDirs = ['res']
|
|
||||||
jniLibs.srcDirs = ['libs']
|
|
||||||
assets.srcDirs = ['assets']
|
|
||||||
}
|
|
||||||
}
|
|
||||||
signingConfigs {
|
|
||||||
orignal {
|
|
||||||
storeFile file("i2pdapk.jks")
|
|
||||||
storePassword "android"
|
|
||||||
keyAlias "i2pdapk"
|
|
||||||
keyPassword "android"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
minifyEnabled true
|
|
||||||
signingConfig signingConfigs.orignal
|
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
externalNativeBuild {
|
|
||||||
ndkBuild {
|
|
||||||
path './jni/Android.mk'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project name="i2pd" default="help">
|
|
||||||
|
|
||||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
|
||||||
It contains the path to the SDK. It should *NOT* be checked into
|
|
||||||
Version Control Systems. -->
|
|
||||||
<property file="local.properties" />
|
|
||||||
|
|
||||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
|
||||||
'android' tool to add properties to it.
|
|
||||||
This is the place to change some Ant specific build properties.
|
|
||||||
Here are some properties you may want to change/update:
|
|
||||||
|
|
||||||
source.dir
|
|
||||||
The name of the source directory. Default is 'src'.
|
|
||||||
out.dir
|
|
||||||
The name of the output directory. Default is 'bin'.
|
|
||||||
|
|
||||||
For other overridable properties, look at the beginning of the rules
|
|
||||||
files in the SDK, at tools/ant/build.xml
|
|
||||||
|
|
||||||
Properties related to the SDK location or the project target should
|
|
||||||
be updated using the 'android' tool with the 'update' action.
|
|
||||||
|
|
||||||
This file is an integral part of the build system for your
|
|
||||||
application and should be checked into Version Control Systems.
|
|
||||||
|
|
||||||
-->
|
|
||||||
<property file="ant.properties" />
|
|
||||||
|
|
||||||
<!-- if sdk.dir was not set from one of the property file, then
|
|
||||||
get it from the ANDROID_HOME env var.
|
|
||||||
This must be done before we load project.properties since
|
|
||||||
the proguard config can use sdk.dir -->
|
|
||||||
<property environment="env" />
|
|
||||||
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
|
|
||||||
<isset property="env.ANDROID_HOME" />
|
|
||||||
</condition>
|
|
||||||
|
|
||||||
<!-- The project.properties file is created and updated by the 'android'
|
|
||||||
tool, as well as ADT.
|
|
||||||
|
|
||||||
This contains project specific properties such as project target, and library
|
|
||||||
dependencies. Lower level build properties are stored in ant.properties
|
|
||||||
(or in .classpath for Eclipse projects).
|
|
||||||
|
|
||||||
This file is an integral part of the build system for your
|
|
||||||
application and should be checked into Version Control Systems. -->
|
|
||||||
<loadproperties srcFile="project.properties" />
|
|
||||||
|
|
||||||
<!-- quick check on sdk.dir -->
|
|
||||||
<fail
|
|
||||||
message="sdk.dir is missing. Insert sdk.dir=... into './local.properties'. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
|
|
||||||
unless="sdk.dir"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<fail
|
|
||||||
message="ndk.dir is missing. Insert ndk.dir=... into './local.properties'."
|
|
||||||
unless="ndk.dir"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Import per project custom build rules if present at the root of the project.
|
|
||||||
This is the place to put custom intermediary targets such as:
|
|
||||||
-pre-build
|
|
||||||
-pre-compile
|
|
||||||
-post-compile (This is typically used for code obfuscation.
|
|
||||||
Compiled code location: ${out.classes.absolute.dir}
|
|
||||||
If this is not done in place, override ${out.dex.input.absolute.dir})
|
|
||||||
-post-package
|
|
||||||
-post-build
|
|
||||||
-pre-clean
|
|
||||||
-->
|
|
||||||
<import file="custom_rules.xml" optional="true" />
|
|
||||||
|
|
||||||
<!-- Import the actual build file.
|
|
||||||
|
|
||||||
To customize existing targets, there are two options:
|
|
||||||
- Customize only one target:
|
|
||||||
- copy/paste the target into this file, *before* the
|
|
||||||
<import> task.
|
|
||||||
- customize it to your needs.
|
|
||||||
- Customize the whole content of build.xml
|
|
||||||
- copy/paste the content of the rules files (minus the top node)
|
|
||||||
into this file, replacing the <import> task.
|
|
||||||
- customize to your needs.
|
|
||||||
|
|
||||||
***********************
|
|
||||||
****** IMPORTANT ******
|
|
||||||
***********************
|
|
||||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
|
||||||
in order to avoid having your file be overridden by tools such as "android update project"
|
|
||||||
-->
|
|
||||||
<!-- version-tag: 1 -->
|
|
||||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
|
||||||
</project>
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
org.gradle.parallel=true
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
LOCAL_PATH := $(call my-dir)
|
|
||||||
include $(CLEAR_VARS)
|
|
||||||
LOCAL_MODULE := i2pd
|
|
||||||
LOCAL_CPP_FEATURES := rtti exceptions
|
|
||||||
LOCAL_C_INCLUDES += $(IFADDRS_PATH) $(LIB_SRC_PATH) $(LIB_CLIENT_SRC_PATH) $(DAEMON_SRC_PATH)
|
|
||||||
LOCAL_STATIC_LIBRARIES := \
|
|
||||||
boost_system \
|
|
||||||
boost_date_time \
|
|
||||||
boost_filesystem \
|
|
||||||
boost_program_options \
|
|
||||||
crypto ssl \
|
|
||||||
miniupnpc
|
|
||||||
LOCAL_LDLIBS := -lz
|
|
||||||
|
|
||||||
LOCAL_SRC_FILES := DaemonAndroid.cpp i2pd_android.cpp $(IFADDRS_PATH)/ifaddrs.c \
|
|
||||||
$(wildcard $(LIB_SRC_PATH)/*.cpp)\
|
|
||||||
$(wildcard $(LIB_CLIENT_SRC_PATH)/*.cpp)\
|
|
||||||
$(DAEMON_SRC_PATH)/Daemon.cpp \
|
|
||||||
$(DAEMON_SRC_PATH)/UPnP.cpp \
|
|
||||||
$(DAEMON_SRC_PATH)/HTTPServer.cpp \
|
|
||||||
$(DAEMON_SRC_PATH)/I2PControl.cpp
|
|
||||||
|
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
|
||||||
|
|
||||||
LOCAL_PATH := $(call my-dir)
|
|
||||||
include $(CLEAR_VARS)
|
|
||||||
LOCAL_MODULE := boost_system
|
|
||||||
LOCAL_SRC_FILES := $(BOOST_PATH)/boost_1_64_0/$(TARGET_ARCH_ABI)/lib/libboost_system.a
|
|
||||||
LOCAL_EXPORT_C_INCLUDES := $(BOOST_PATH)/boost_1_64_0/include
|
|
||||||
include $(PREBUILT_STATIC_LIBRARY)
|
|
||||||
|
|
||||||
LOCAL_PATH := $(call my-dir)
|
|
||||||
include $(CLEAR_VARS)
|
|
||||||
LOCAL_MODULE := boost_date_time
|
|
||||||
LOCAL_SRC_FILES := $(BOOST_PATH)/boost_1_64_0/$(TARGET_ARCH_ABI)/lib/libboost_date_time.a
|
|
||||||
LOCAL_EXPORT_C_INCLUDES := $(BOOST_PATH)/boost_1_64_0/include
|
|
||||||
include $(PREBUILT_STATIC_LIBRARY)
|
|
||||||
|
|
||||||
LOCAL_PATH := $(call my-dir)
|
|
||||||
include $(CLEAR_VARS)
|
|
||||||
LOCAL_MODULE := boost_filesystem
|
|
||||||
LOCAL_SRC_FILES := $(BOOST_PATH)/boost_1_64_0/$(TARGET_ARCH_ABI)/lib/libboost_filesystem.a
|
|
||||||
LOCAL_EXPORT_C_INCLUDES := $(BOOST_PATH)/boost_1_64_0/include
|
|
||||||
include $(PREBUILT_STATIC_LIBRARY)
|
|
||||||
|
|
||||||
LOCAL_PATH := $(call my-dir)
|
|
||||||
include $(CLEAR_VARS)
|
|
||||||
LOCAL_MODULE := boost_program_options
|
|
||||||
LOCAL_SRC_FILES := $(BOOST_PATH)/boost_1_64_0/$(TARGET_ARCH_ABI)/lib/libboost_program_options.a
|
|
||||||
LOCAL_EXPORT_C_INCLUDES := $(BOOST_PATH)/boost_1_64_0/include
|
|
||||||
include $(PREBUILT_STATIC_LIBRARY)
|
|
||||||
|
|
||||||
LOCAL_PATH := $(call my-dir)
|
|
||||||
include $(CLEAR_VARS)
|
|
||||||
LOCAL_MODULE := crypto
|
|
||||||
LOCAL_SRC_FILES := $(OPENSSL_PATH)/openssl-1.1.1/$(TARGET_ARCH_ABI)/lib/libcrypto.a
|
|
||||||
LOCAL_EXPORT_C_INCLUDES := $(OPENSSL_PATH)/openssl-1.1.1/include
|
|
||||||
include $(PREBUILT_STATIC_LIBRARY)
|
|
||||||
|
|
||||||
LOCAL_PATH := $(call my-dir)
|
|
||||||
include $(CLEAR_VARS)
|
|
||||||
LOCAL_MODULE := ssl
|
|
||||||
LOCAL_SRC_FILES := $(OPENSSL_PATH)/openssl-1.1.1/$(TARGET_ARCH_ABI)/lib/libssl.a
|
|
||||||
LOCAL_EXPORT_C_INCLUDES := $(OPENSSL_PATH)/openssl-1.1.1/include
|
|
||||||
LOCAL_STATIC_LIBRARIES := crypto
|
|
||||||
include $(PREBUILT_STATIC_LIBRARY)
|
|
||||||
|
|
||||||
LOCAL_PATH := $(call my-dir)
|
|
||||||
include $(CLEAR_VARS)
|
|
||||||
LOCAL_MODULE := miniupnpc
|
|
||||||
LOCAL_SRC_FILES := $(MINIUPNP_PATH)/miniupnpc-2.1/$(TARGET_ARCH_ABI)/lib/libminiupnpc.a
|
|
||||||
LOCAL_EXPORT_C_INCLUDES := $(MINIUPNP_PATH)/miniupnpc-2.1/include
|
|
||||||
include $(PREBUILT_STATIC_LIBRARY)
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
#APP_ABI := all
|
|
||||||
APP_ABI := armeabi-v7a x86
|
|
||||||
#APP_ABI := x86
|
|
||||||
#APP_ABI := x86_64
|
|
||||||
#APP_ABI := armeabi-v7a
|
|
||||||
#can be android-3 but will fail for x86 since arch-x86 is not present at ndkroot/platforms/android-3/ . libz is taken from there.
|
|
||||||
APP_PLATFORM := android-14
|
|
||||||
|
|
||||||
# http://stackoverflow.com/a/21386866/529442 http://stackoverflow.com/a/15616255/529442 to enable c++11 support in Eclipse
|
|
||||||
NDK_TOOLCHAIN_VERSION := 4.9
|
|
||||||
# APP_STL := stlport_shared --> does not seem to contain C++11 features
|
|
||||||
APP_STL := gnustl_shared
|
|
||||||
|
|
||||||
# Enable c++11 extensions in source code
|
|
||||||
APP_CPPFLAGS += -std=c++11
|
|
||||||
|
|
||||||
APP_CPPFLAGS += -DANDROID -D__ANDROID__ -DUSE_UPNP
|
|
||||||
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
|
|
||||||
APP_CPPFLAGS += -DANDROID_ARM7A
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Forcing debug optimization. Use `ndk-build NDK_DEBUG=1` instead.
|
|
||||||
#APP_OPTIM := debug
|
|
||||||
|
|
||||||
# git clone https://github.com/PurpleI2P/Boost-for-Android-Prebuilt.git
|
|
||||||
# git clone https://github.com/PurpleI2P/OpenSSL-for-Android-Prebuilt.git
|
|
||||||
# git clone https://github.com/PurpleI2P/MiniUPnP-for-Android-Prebuilt.git
|
|
||||||
# git clone https://github.com/PurpleI2P/android-ifaddrs.git
|
|
||||||
# change to your own
|
|
||||||
I2PD_LIBS_PATH = /path/to/libraries
|
|
||||||
BOOST_PATH = $(I2PD_LIBS_PATH)/Boost-for-Android-Prebuilt
|
|
||||||
OPENSSL_PATH = $(I2PD_LIBS_PATH)/OpenSSL-for-Android-Prebuilt
|
|
||||||
MINIUPNP_PATH = $(I2PD_LIBS_PATH)/MiniUPnP-for-Android-Prebuilt
|
|
||||||
IFADDRS_PATH = $(I2PD_LIBS_PATH)/android-ifaddrs
|
|
||||||
|
|
||||||
# don't change me
|
|
||||||
I2PD_SRC_PATH = $(PWD)/..
|
|
||||||
|
|
||||||
LIB_SRC_PATH = $(I2PD_SRC_PATH)/libi2pd
|
|
||||||
LIB_CLIENT_SRC_PATH = $(I2PD_SRC_PATH)/libi2pd_client
|
|
||||||
DAEMON_SRC_PATH = $(I2PD_SRC_PATH)/daemon
|
|
||||||
@@ -1,207 +0,0 @@
|
|||||||
#include <iostream>
|
|
||||||
#include <chrono>
|
|
||||||
#include <thread>
|
|
||||||
#include <exception>
|
|
||||||
#include <boost/exception/diagnostic_information.hpp>
|
|
||||||
#include <boost/exception_ptr.hpp>
|
|
||||||
//#include "mainwindow.h"
|
|
||||||
#include "FS.h"
|
|
||||||
#include "DaemonAndroid.h"
|
|
||||||
#include "Daemon.h"
|
|
||||||
|
|
||||||
namespace i2p
|
|
||||||
{
|
|
||||||
namespace android
|
|
||||||
{
|
|
||||||
/* Worker::Worker (DaemonAndroidImpl& daemon):
|
|
||||||
m_Daemon (daemon)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Worker::startDaemon()
|
|
||||||
{
|
|
||||||
Log.d(TAG"Performing daemon start...");
|
|
||||||
m_Daemon.start();
|
|
||||||
Log.d(TAG"Daemon started.");
|
|
||||||
emit resultReady();
|
|
||||||
}
|
|
||||||
void Worker::restartDaemon()
|
|
||||||
{
|
|
||||||
Log.d(TAG"Performing daemon restart...");
|
|
||||||
m_Daemon.restart();
|
|
||||||
Log.d(TAG"Daemon restarted.");
|
|
||||||
emit resultReady();
|
|
||||||
}
|
|
||||||
void Worker::stopDaemon() {
|
|
||||||
Log.d(TAG"Performing daemon stop...");
|
|
||||||
m_Daemon.stop();
|
|
||||||
Log.d(TAG"Daemon stopped.");
|
|
||||||
emit resultReady();
|
|
||||||
}
|
|
||||||
|
|
||||||
Controller::Controller(DaemonAndroidImpl& daemon):
|
|
||||||
m_Daemon (daemon)
|
|
||||||
{
|
|
||||||
Worker *worker = new Worker (m_Daemon);
|
|
||||||
worker->moveToThread(&workerThread);
|
|
||||||
connect(&workerThread, &QThread::finished, worker, &QObject::deleteLater);
|
|
||||||
connect(this, &Controller::startDaemon, worker, &Worker::startDaemon);
|
|
||||||
connect(this, &Controller::stopDaemon, worker, &Worker::stopDaemon);
|
|
||||||
connect(this, &Controller::restartDaemon, worker, &Worker::restartDaemon);
|
|
||||||
connect(worker, &Worker::resultReady, this, &Controller::handleResults);
|
|
||||||
workerThread.start();
|
|
||||||
}
|
|
||||||
Controller::~Controller()
|
|
||||||
{
|
|
||||||
Log.d(TAG"Closing and waiting for daemon worker thread...");
|
|
||||||
workerThread.quit();
|
|
||||||
workerThread.wait();
|
|
||||||
Log.d(TAG"Waiting for daemon worker thread finished.");
|
|
||||||
if(m_Daemon.isRunning())
|
|
||||||
{
|
|
||||||
Log.d(TAG"Stopping the daemon...");
|
|
||||||
m_Daemon.stop();
|
|
||||||
Log.d(TAG"Stopped the daemon.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
DaemonAndroidImpl::DaemonAndroidImpl ()
|
|
||||||
//:
|
|
||||||
/*mutex(nullptr), */
|
|
||||||
//m_IsRunning(false),
|
|
||||||
//m_RunningChangedCallback(nullptr)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
DaemonAndroidImpl::~DaemonAndroidImpl ()
|
|
||||||
{
|
|
||||||
//delete mutex;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DaemonAndroidImpl::init(int argc, char* argv[])
|
|
||||||
{
|
|
||||||
//mutex=new QMutex(QMutex::Recursive);
|
|
||||||
//setRunningCallback(0);
|
|
||||||
//m_IsRunning=false;
|
|
||||||
|
|
||||||
// make sure assets are ready before proceed
|
|
||||||
i2p::fs::DetectDataDir("", false);
|
|
||||||
int numAttempts = 0;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if (i2p::fs::Exists (i2p::fs::DataDirPath("assets.ready"))) break; // assets ready
|
|
||||||
numAttempts++;
|
|
||||||
std::this_thread::sleep_for (std::chrono::seconds(1)); // otherwise wait for 1 more second
|
|
||||||
}
|
|
||||||
while (numAttempts <= 10); // 10 seconds max
|
|
||||||
return Daemon.init(argc,argv);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DaemonAndroidImpl::start()
|
|
||||||
{
|
|
||||||
//QMutexLocker locker(mutex);
|
|
||||||
//setRunning(true);
|
|
||||||
Daemon.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DaemonAndroidImpl::stop()
|
|
||||||
{
|
|
||||||
//QMutexLocker locker(mutex);
|
|
||||||
Daemon.stop();
|
|
||||||
//setRunning(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DaemonAndroidImpl::restart()
|
|
||||||
{
|
|
||||||
//QMutexLocker locker(mutex);
|
|
||||||
stop();
|
|
||||||
start();
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
void DaemonAndroidImpl::setRunningCallback(runningChangedCallback cb)
|
|
||||||
{
|
|
||||||
m_RunningChangedCallback = cb;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DaemonAndroidImpl::isRunning()
|
|
||||||
{
|
|
||||||
return m_IsRunning;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DaemonAndroidImpl::setRunning(bool newValue)
|
|
||||||
{
|
|
||||||
bool oldValue = m_IsRunning;
|
|
||||||
if(oldValue!=newValue)
|
|
||||||
{
|
|
||||||
m_IsRunning = newValue;
|
|
||||||
if(m_RunningChangedCallback)
|
|
||||||
m_RunningChangedCallback();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
static DaemonAndroidImpl daemon;
|
|
||||||
static char* argv[1]={strdup("tmp")};
|
|
||||||
/**
|
|
||||||
* returns error details if failed
|
|
||||||
* returns "ok" if daemon initialized and started okay
|
|
||||||
*/
|
|
||||||
std::string start(/*int argc, char* argv[]*/)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
//int result;
|
|
||||||
|
|
||||||
{
|
|
||||||
//Log.d(TAG"Initialising the daemon...");
|
|
||||||
bool daemonInitSuccess = daemon.init(1,argv);
|
|
||||||
if(!daemonInitSuccess)
|
|
||||||
{
|
|
||||||
//QMessageBox::critical(0, "Error", "Daemon init failed");
|
|
||||||
return "Daemon init failed";
|
|
||||||
}
|
|
||||||
//Log.d(TAG"Initialised, creating the main window...");
|
|
||||||
//MainWindow w;
|
|
||||||
//Log.d(TAG"Before main window.show()...");
|
|
||||||
//w.show ();
|
|
||||||
|
|
||||||
{
|
|
||||||
//i2p::qt::Controller daemonQtController(daemon);
|
|
||||||
//Log.d(TAG"Starting the daemon...");
|
|
||||||
//emit daemonQtController.startDaemon();
|
|
||||||
//daemon.start ();
|
|
||||||
//Log.d(TAG"Starting GUI event loop...");
|
|
||||||
//result = app.exec();
|
|
||||||
//daemon.stop ();
|
|
||||||
daemon.start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//QMessageBox::information(&w, "Debug", "demon stopped");
|
|
||||||
//Log.d(TAG"Exiting the application");
|
|
||||||
//return result;
|
|
||||||
}
|
|
||||||
catch (boost::exception& ex)
|
|
||||||
{
|
|
||||||
std::stringstream ss;
|
|
||||||
ss << boost::diagnostic_information(ex);
|
|
||||||
return ss.str();
|
|
||||||
}
|
|
||||||
catch (std::exception& ex)
|
|
||||||
{
|
|
||||||
std::stringstream ss;
|
|
||||||
ss << ex.what();
|
|
||||||
return ss.str();
|
|
||||||
}
|
|
||||||
catch(...)
|
|
||||||
{
|
|
||||||
return "unknown exception";
|
|
||||||
}
|
|
||||||
return "ok";
|
|
||||||
}
|
|
||||||
|
|
||||||
void stop()
|
|
||||||
{
|
|
||||||
daemon.stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
#ifndef DAEMON_ANDROID_H
|
|
||||||
#define DAEMON_ANDROID_H
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
namespace i2p
|
|
||||||
{
|
|
||||||
namespace android
|
|
||||||
{
|
|
||||||
class DaemonAndroidImpl
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
DaemonAndroidImpl ();
|
|
||||||
~DaemonAndroidImpl ();
|
|
||||||
|
|
||||||
//typedef void (*runningChangedCallback)();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return success
|
|
||||||
*/
|
|
||||||
bool init(int argc, char* argv[]);
|
|
||||||
void start();
|
|
||||||
void stop();
|
|
||||||
void restart();
|
|
||||||
//void setRunningCallback(runningChangedCallback cb);
|
|
||||||
//bool isRunning();
|
|
||||||
private:
|
|
||||||
//void setRunning(bool running);
|
|
||||||
private:
|
|
||||||
//QMutex* mutex;
|
|
||||||
//bool m_IsRunning;
|
|
||||||
//runningChangedCallback m_RunningChangedCallback;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* returns "ok" if daemon init failed
|
|
||||||
* returns errinfo if daemon initialized and started okay
|
|
||||||
*/
|
|
||||||
std::string start();
|
|
||||||
|
|
||||||
// stops the daemon
|
|
||||||
void stop();
|
|
||||||
|
|
||||||
/*
|
|
||||||
class Worker : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
|
|
||||||
Worker (DaemonAndroidImpl& daemon);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
DaemonAndroidImpl& m_Daemon;
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void startDaemon();
|
|
||||||
void restartDaemon();
|
|
||||||
void stopDaemon();
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void resultReady();
|
|
||||||
};
|
|
||||||
|
|
||||||
class Controller : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
QThread workerThread;
|
|
||||||
public:
|
|
||||||
Controller(DaemonAndroidImpl& daemon);
|
|
||||||
~Controller();
|
|
||||||
private:
|
|
||||||
DaemonAndroidImpl& m_Daemon;
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void handleResults(){}
|
|
||||||
signals:
|
|
||||||
void startDaemon();
|
|
||||||
void stopDaemon();
|
|
||||||
void restartDaemon();
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // DAEMON_ANDROID_H
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
|
|
||||||
//#include <string.h>
|
|
||||||
#include <jni.h>
|
|
||||||
#include "org_purplei2p_i2pd_I2PD_JNI.h"
|
|
||||||
#include "DaemonAndroid.h"
|
|
||||||
#include "RouterContext.h"
|
|
||||||
#include "Transports.h"
|
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_getABICompiledWith
|
|
||||||
(JNIEnv * env, jclass clazz) {
|
|
||||||
#if defined(__arm__)
|
|
||||||
#if defined(__ARM_ARCH_7A__)
|
|
||||||
#if defined(__ARM_NEON__)
|
|
||||||
#if defined(__ARM_PCS_VFP)
|
|
||||||
#define ABI "armeabi-v7a/NEON (hard-float)"
|
|
||||||
#else
|
|
||||||
#define ABI "armeabi-v7a/NEON"
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#if defined(__ARM_PCS_VFP)
|
|
||||||
#define ABI "armeabi-v7a (hard-float)"
|
|
||||||
#else
|
|
||||||
#define ABI "armeabi-v7a"
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#define ABI "armeabi"
|
|
||||||
#endif
|
|
||||||
#elif defined(__i386__)
|
|
||||||
#define ABI "x86"
|
|
||||||
#elif defined(__x86_64__)
|
|
||||||
#define ABI "x86_64"
|
|
||||||
#elif defined(__mips64) /* mips64el-* toolchain defines __mips__ too */
|
|
||||||
#define ABI "mips64"
|
|
||||||
#elif defined(__mips__)
|
|
||||||
#define ABI "mips"
|
|
||||||
#elif defined(__aarch64__)
|
|
||||||
#define ABI "arm64-v8a"
|
|
||||||
#else
|
|
||||||
#define ABI "unknown"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return env->NewStringUTF(ABI);
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_startDaemon
|
|
||||||
(JNIEnv * env, jclass clazz) {
|
|
||||||
return env->NewStringUTF(i2p::android::start().c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_stopDaemon
|
|
||||||
(JNIEnv * env, jclass clazz) {
|
|
||||||
i2p::android::stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_stopAcceptingTunnels
|
|
||||||
(JNIEnv * env, jclass clazz) {
|
|
||||||
i2p::context.SetAcceptsTunnels (false);
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_onNetworkStateChanged
|
|
||||||
(JNIEnv * env, jclass clazz, jboolean isConnected)
|
|
||||||
{
|
|
||||||
bool isConnectedBool = (bool) isConnected;
|
|
||||||
i2p::transport::transports.SetOnline (isConnectedBool);
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
|
||||||
#include <jni.h>
|
|
||||||
/* Header for class org_purplei2p_i2pd_I2PD_JNI */
|
|
||||||
|
|
||||||
#ifndef _Included_org_purplei2p_i2pd_I2PD_JNI
|
|
||||||
#define _Included_org_purplei2p_i2pd_I2PD_JNI
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
/*
|
|
||||||
* Class: org_purplei2p_i2pd_I2PD_JNI
|
|
||||||
* Method: stringFromJNI
|
|
||||||
* Signature: ()Ljava/lang/String;
|
|
||||||
*/
|
|
||||||
JNIEXPORT jstring JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_getABICompiledWith
|
|
||||||
(JNIEnv *, jclass);
|
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_startDaemon
|
|
||||||
(JNIEnv *, jclass);
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_stopDaemon
|
|
||||||
(JNIEnv *, jclass);
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_stopAcceptingTunnels
|
|
||||||
(JNIEnv *, jclass);
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_onNetworkStateChanged
|
|
||||||
(JNIEnv * env, jclass clazz, jboolean isConnected);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
# To enable ProGuard in your project, edit project.properties
|
|
||||||
# to define the proguard.config property as described in that file.
|
|
||||||
#
|
|
||||||
# Add project specific ProGuard rules here.
|
|
||||||
# By default, the flags in this file are appended to flags specified
|
|
||||||
# in ${sdk.dir}/tools/proguard/proguard-android.txt
|
|
||||||
# You can edit the include path and order by changing the ProGuard
|
|
||||||
# include property in project.properties.
|
|
||||||
#
|
|
||||||
# For more details, see
|
|
||||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
||||||
|
|
||||||
# Add any project specific keep options here:
|
|
||||||
|
|
||||||
# If your project uses WebView with JS, uncomment the following
|
|
||||||
# and specify the fully qualified class name to the JavaScript interface
|
|
||||||
# class:
|
|
||||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
|
||||||
# public *;
|
|
||||||
#}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
# This file is automatically generated by Android Tools.
|
|
||||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
|
||||||
#
|
|
||||||
# This file must be checked in Version Control Systems.
|
|
||||||
#
|
|
||||||
# To customize properties used by the Ant build system edit
|
|
||||||
# "ant.properties", and override values to adapt the script to your
|
|
||||||
# project structure.
|
|
||||||
#
|
|
||||||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
|
|
||||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
|
||||||
|
|
||||||
# Project target.
|
|
||||||
target=android-28
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 36 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.9 KiB |
@@ -1,27 +0,0 @@
|
|||||||
<LinearLayout android:id="@+id/main_layout"
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingBottom="@dimen/vertical_page_margin"
|
|
||||||
android:paddingLeft="@dimen/horizontal_page_margin"
|
|
||||||
android:paddingRight="@dimen/horizontal_page_margin"
|
|
||||||
android:paddingTop="@dimen/vertical_page_margin"
|
|
||||||
tools:context=".I2PDPermsAskerActivity">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/textview_retry"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="@dimen/horizontal_page_margin"
|
|
||||||
android:visibility="gone"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/button_request_write_ext_storage_perms"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Retry requesting the SD card write permissions"
|
|
||||||
android:visibility="gone"/>
|
|
||||||
</LinearLayout>
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
<LinearLayout android:id="@+id/layout_prompt"
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingBottom="@dimen/vertical_page_margin"
|
|
||||||
android:paddingLeft="@dimen/horizontal_page_margin"
|
|
||||||
android:paddingRight="@dimen/horizontal_page_margin"
|
|
||||||
android:paddingTop="@dimen/vertical_page_margin"
|
|
||||||
tools:context=".I2PDPermsAskerActivity">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/textview_explanation"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="@dimen/horizontal_page_margin"
|
|
||||||
android:text="SD card write access is required to write the keys and other files to the I2PD folder on SD card."
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/button_ok"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="OK"
|
|
||||||
/>
|
|
||||||
</LinearLayout>
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
<menu
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
tools:context=".I2PDActivity">
|
|
||||||
<item
|
|
||||||
android:id="@+id/action_graceful_stop"
|
|
||||||
android:title="@string/action_graceful_stop"
|
|
||||||
android:orderInCategory="98"
|
|
||||||
/>
|
|
||||||
<item
|
|
||||||
android:id="@+id/action_stop"
|
|
||||||
android:title="@string/action_stop"
|
|
||||||
android:orderInCategory="99"
|
|
||||||
/>
|
|
||||||
</menu>
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<string name="app_name">i2pd</string>
|
|
||||||
<string name="action_stop">Stop</string>
|
|
||||||
<string name="action_graceful_stop">Graceful Stop</string>
|
|
||||||
<string name="graceful_stop_is_already_in_progress">Graceful stop is already in progress</string>
|
|
||||||
<string name="graceful_stop_is_in_progress">Graceful stop is in progress</string>
|
|
||||||
<string name="already_stopped">Already stopped</string>
|
|
||||||
<string name="uninitialized">i2pd initializing</string>
|
|
||||||
<string name="starting">i2pd is starting</string>
|
|
||||||
<string name="jniLibraryLoaded">i2pd: loaded JNI libraries</string>
|
|
||||||
<string name="startedOkay">i2pd started</string>
|
|
||||||
<string name="startFailed">i2pd start failed</string>
|
|
||||||
<string name="gracefulShutdownInProgress">i2pd: graceful shutdown in progress</string>
|
|
||||||
<string name="stopped">i2pd has stopped</string>
|
|
||||||
<string name="remaining">remaining</string>
|
|
||||||
<string name="title_activity_i2_pdperms_asker_prompt">Prompt</string>
|
|
||||||
</resources>
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
<resources>
|
|
||||||
|
|
||||||
<!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
|
|
||||||
|
|
||||||
<dimen name="margin_tiny">4dp</dimen>
|
|
||||||
<dimen name="margin_small">8dp</dimen>
|
|
||||||
<dimen name="margin_medium">16dp</dimen>
|
|
||||||
<dimen name="margin_large">32dp</dimen>
|
|
||||||
<dimen name="margin_huge">64dp</dimen>
|
|
||||||
|
|
||||||
<!-- Semantic definitions -->
|
|
||||||
|
|
||||||
<dimen name="horizontal_page_margin">@dimen/margin_medium</dimen>
|
|
||||||
<dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
|
|
||||||
|
|
||||||
</resources>
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
rootProject.name = "i2pd"
|
|
||||||
@@ -1,136 +0,0 @@
|
|||||||
package org.purplei2p.i2pd;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
public class DaemonSingleton {
|
|
||||||
private static final String TAG="i2pd";
|
|
||||||
private static final DaemonSingleton instance = new DaemonSingleton();
|
|
||||||
public interface StateUpdateListener { void daemonStateUpdate(); }
|
|
||||||
private final Set<StateUpdateListener> stateUpdateListeners = new HashSet<>();
|
|
||||||
|
|
||||||
public static DaemonSingleton getInstance() {
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public synchronized void addStateChangeListener(StateUpdateListener listener) { stateUpdateListeners.add(listener); }
|
|
||||||
public synchronized void removeStateChangeListener(StateUpdateListener listener) { stateUpdateListeners.remove(listener); }
|
|
||||||
|
|
||||||
private synchronized void setState(State newState) {
|
|
||||||
if(newState==null)throw new NullPointerException();
|
|
||||||
State oldState = state;
|
|
||||||
if(oldState==null)throw new NullPointerException();
|
|
||||||
if(oldState.equals(newState))return;
|
|
||||||
state=newState;
|
|
||||||
fireStateUpdate1();
|
|
||||||
}
|
|
||||||
public synchronized void stopAcceptingTunnels() {
|
|
||||||
if(isStartedOkay()){
|
|
||||||
setState(State.gracefulShutdownInProgress);
|
|
||||||
I2PD_JNI.stopAcceptingTunnels();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private volatile boolean startedOkay;
|
|
||||||
|
|
||||||
public enum State {
|
|
||||||
uninitialized(R.string.uninitialized),
|
|
||||||
starting(R.string.starting),
|
|
||||||
jniLibraryLoaded(R.string.jniLibraryLoaded),
|
|
||||||
startedOkay(R.string.startedOkay),
|
|
||||||
startFailed(R.string.startFailed),
|
|
||||||
gracefulShutdownInProgress(R.string.gracefulShutdownInProgress),
|
|
||||||
stopped(R.string.stopped);
|
|
||||||
|
|
||||||
State(int statusStringResourceId) {
|
|
||||||
this.statusStringResourceId = statusStringResourceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
private final int statusStringResourceId;
|
|
||||||
|
|
||||||
public int getStatusStringResourceId() {
|
|
||||||
return statusStringResourceId;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private volatile State state = State.uninitialized;
|
|
||||||
|
|
||||||
public State getState() { return state; }
|
|
||||||
|
|
||||||
{
|
|
||||||
setState(State.starting);
|
|
||||||
new Thread(new Runnable(){
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
I2PD_JNI.loadLibraries();
|
|
||||||
setState(State.jniLibraryLoaded);
|
|
||||||
} catch (Throwable tr) {
|
|
||||||
lastThrowable=tr;
|
|
||||||
setState(State.startFailed);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
synchronized (DaemonSingleton.this) {
|
|
||||||
daemonStartResult = I2PD_JNI.startDaemon();
|
|
||||||
if("ok".equals(daemonStartResult)){
|
|
||||||
setState(State.startedOkay);
|
|
||||||
setStartedOkay(true);
|
|
||||||
}else setState(State.startFailed);
|
|
||||||
}
|
|
||||||
} catch (Throwable tr) {
|
|
||||||
lastThrowable=tr;
|
|
||||||
setState(State.startFailed);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}, "i2pdDaemonStart").start();
|
|
||||||
}
|
|
||||||
private Throwable lastThrowable;
|
|
||||||
private String daemonStartResult="N/A";
|
|
||||||
|
|
||||||
private void fireStateUpdate1() {
|
|
||||||
Log.i(TAG, "daemon state change: "+state);
|
|
||||||
for(StateUpdateListener listener : stateUpdateListeners) {
|
|
||||||
try {
|
|
||||||
listener.daemonStateUpdate();
|
|
||||||
} catch (Throwable tr) {
|
|
||||||
Log.e(TAG, "exception in listener ignored", tr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Throwable getLastThrowable() {
|
|
||||||
return lastThrowable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDaemonStartResult() {
|
|
||||||
return daemonStartResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
private final Object startedOkayLock = new Object();
|
|
||||||
|
|
||||||
public boolean isStartedOkay() {
|
|
||||||
synchronized (startedOkayLock) {
|
|
||||||
return startedOkay;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setStartedOkay(boolean startedOkay) {
|
|
||||||
synchronized (startedOkayLock) {
|
|
||||||
this.startedOkay = startedOkay;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public synchronized void stopDaemon() {
|
|
||||||
if(isStartedOkay()){
|
|
||||||
try {I2PD_JNI.stopDaemon();}catch(Throwable tr){Log.e(TAG, "", tr);}
|
|
||||||
setStartedOkay(false);
|
|
||||||
setState(State.stopped);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,149 +0,0 @@
|
|||||||
package org.purplei2p.i2pd;
|
|
||||||
|
|
||||||
import android.app.Notification;
|
|
||||||
import android.app.NotificationChannel;
|
|
||||||
import android.app.NotificationManager;
|
|
||||||
import android.app.PendingIntent;
|
|
||||||
import android.app.Service;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Binder;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.os.IBinder;
|
|
||||||
import android.support.annotation.RequiresApi;
|
|
||||||
import android.support.v4.app.NotificationCompat;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
public class ForegroundService extends Service {
|
|
||||||
private static final String TAG="FgService";
|
|
||||||
|
|
||||||
private volatile boolean shown;
|
|
||||||
|
|
||||||
private final DaemonSingleton.StateUpdateListener daemonStateUpdatedListener =
|
|
||||||
new DaemonSingleton.StateUpdateListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void daemonStateUpdate() {
|
|
||||||
try {
|
|
||||||
synchronized (ForegroundService.this) {
|
|
||||||
if (shown) cancelNotification();
|
|
||||||
showNotification();
|
|
||||||
}
|
|
||||||
} catch (Throwable tr) {
|
|
||||||
Log.e(TAG,"error ignored",tr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
private NotificationManager notificationManager;
|
|
||||||
|
|
||||||
// Unique Identification Number for the Notification.
|
|
||||||
// We use it on Notification start, and to cancel it.
|
|
||||||
private int NOTIFICATION = 1;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class for clients to access. Because we know this service always
|
|
||||||
* runs in the same process as its clients, we don't need to deal with
|
|
||||||
* IPC.
|
|
||||||
*/
|
|
||||||
public class LocalBinder extends Binder {
|
|
||||||
ForegroundService getService() {
|
|
||||||
return ForegroundService.this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate() {
|
|
||||||
notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
|
|
||||||
|
|
||||||
synchronized (this) {
|
|
||||||
DaemonSingleton.getInstance().addStateChangeListener(daemonStateUpdatedListener);
|
|
||||||
if (!shown) daemonStateUpdatedListener.daemonStateUpdate();
|
|
||||||
}
|
|
||||||
// Tell the user we started.
|
|
||||||
// Toast.makeText(this, R.string.i2pd_service_started, Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
|
||||||
Log.i("ForegroundService", "Received start id " + startId + ": " + intent);
|
|
||||||
return START_STICKY;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDestroy() {
|
|
||||||
DaemonSingleton.getInstance().removeStateChangeListener(daemonStateUpdatedListener);
|
|
||||||
cancelNotification();
|
|
||||||
}
|
|
||||||
|
|
||||||
private synchronized void cancelNotification() {
|
|
||||||
// Cancel the persistent notification.
|
|
||||||
notificationManager.cancel(NOTIFICATION);
|
|
||||||
|
|
||||||
stopForeground(true);
|
|
||||||
|
|
||||||
// Tell the user we stopped.
|
|
||||||
// Toast.makeText(this, R.string.i2pd_service_stopped, Toast.LENGTH_SHORT).show();
|
|
||||||
shown=false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBinder onBind(Intent intent) {
|
|
||||||
return mBinder;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is the object that receives interactions from clients. See
|
|
||||||
// RemoteService for a more complete example.
|
|
||||||
private final IBinder mBinder = new LocalBinder();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show a notification while this service is running.
|
|
||||||
*/
|
|
||||||
private synchronized void showNotification() {
|
|
||||||
// In this sample, we'll use the same text for the ticker and the expanded notification
|
|
||||||
CharSequence text = getText(DaemonSingleton.getInstance().getState().getStatusStringResourceId());
|
|
||||||
|
|
||||||
// The PendingIntent to launch our activity if the user selects this notification
|
|
||||||
PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
|
|
||||||
new Intent(this, I2PDActivity.class), 0);
|
|
||||||
|
|
||||||
// If earlier version channel ID is not used
|
|
||||||
// https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder.html#NotificationCompat.Builder(android.content.Context)
|
|
||||||
String channelId = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) ? createNotificationChannel() : "";
|
|
||||||
|
|
||||||
// Set the info for the views that show in the notification panel.
|
|
||||||
Notification notification = new NotificationCompat.Builder(this, channelId)
|
|
||||||
.setOngoing(true)
|
|
||||||
.setSmallIcon(R.drawable.itoopie_notification_icon) // the status icon
|
|
||||||
.setPriority(Notification.PRIORITY_DEFAULT)
|
|
||||||
.setCategory(Notification.CATEGORY_SERVICE)
|
|
||||||
.setTicker(text) // the status text
|
|
||||||
.setWhen(System.currentTimeMillis()) // the time stamp
|
|
||||||
.setContentTitle(getText(R.string.app_name)) // the label of the entry
|
|
||||||
.setContentText(text) // the contents of the entry
|
|
||||||
.setContentIntent(contentIntent) // The intent to send when the entry is clicked
|
|
||||||
.build();
|
|
||||||
|
|
||||||
// Send the notification.
|
|
||||||
//mNM.notify(NOTIFICATION, notification);
|
|
||||||
startForeground(NOTIFICATION, notification);
|
|
||||||
shown = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
|
||||||
private synchronized String createNotificationChannel() {
|
|
||||||
String channelId = getString(R.string.app_name);
|
|
||||||
CharSequence channelName = "I2Pd service";
|
|
||||||
NotificationChannel chan = new NotificationChannel(channelId, channelName, NotificationManager.IMPORTANCE_LOW);
|
|
||||||
//chan.setLightColor(Color.PURPLE);
|
|
||||||
chan.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
|
|
||||||
NotificationManager service = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
|
|
||||||
service.createNotificationChannel(chan);
|
|
||||||
return channelId;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final DaemonSingleton daemon = DaemonSingleton.getInstance();
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,419 +0,0 @@
|
|||||||
package org.purplei2p.i2pd;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileReader;
|
|
||||||
import java.io.FileWriter;
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.io.PrintWriter;
|
|
||||||
import java.io.StringWriter;
|
|
||||||
import java.util.Timer;
|
|
||||||
import java.util.TimerTask;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.ComponentName;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.ServiceConnection;
|
|
||||||
import android.content.res.AssetManager;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.os.Environment;
|
|
||||||
import android.os.IBinder;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.Menu;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
// For future package update checking
|
|
||||||
import org.purplei2p.i2pd.BuildConfig;
|
|
||||||
|
|
||||||
public class I2PDActivity extends Activity {
|
|
||||||
private static final String TAG = "i2pdActvt";
|
|
||||||
public static final int GRACEFUL_DELAY_MILLIS = 10 * 60 * 1000;
|
|
||||||
|
|
||||||
private TextView textView;
|
|
||||||
private boolean assetsCopied;
|
|
||||||
private String i2pdpath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/i2pd/";
|
|
||||||
|
|
||||||
private static final DaemonSingleton daemon = DaemonSingleton.getInstance();
|
|
||||||
|
|
||||||
private final DaemonSingleton.StateUpdateListener daemonStateUpdatedListener =
|
|
||||||
new DaemonSingleton.StateUpdateListener() {
|
|
||||||
@Override
|
|
||||||
public void daemonStateUpdate()
|
|
||||||
{
|
|
||||||
processAssets();
|
|
||||||
runOnUiThread(new Runnable(){
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
if(textView==null) return;
|
|
||||||
Throwable tr = daemon.getLastThrowable();
|
|
||||||
if(tr!=null) {
|
|
||||||
textView.setText(throwableToString(tr));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
DaemonSingleton.State state = daemon.getState();
|
|
||||||
textView.setText(
|
|
||||||
String.valueOf(state)+
|
|
||||||
(DaemonSingleton.State.startFailed.equals(state)?": "+daemon.getDaemonStartResult():"")+
|
|
||||||
(DaemonSingleton.State.gracefulShutdownInProgress.equals(state)?": "+formatGraceTimeRemaining()+" "+getText(R.string.remaining):"")
|
|
||||||
);
|
|
||||||
} catch (Throwable tr) {
|
|
||||||
Log.e(TAG,"error ignored",tr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
private static volatile long graceStartedMillis;
|
|
||||||
private static final Object graceStartedMillis_LOCK=new Object();
|
|
||||||
|
|
||||||
private static String formatGraceTimeRemaining() {
|
|
||||||
long remainingSeconds;
|
|
||||||
synchronized (graceStartedMillis_LOCK){
|
|
||||||
remainingSeconds=Math.round(Math.max(0,graceStartedMillis+GRACEFUL_DELAY_MILLIS-System.currentTimeMillis())/1000.0D);
|
|
||||||
}
|
|
||||||
long remainingMinutes=(long)Math.floor(remainingSeconds/60.0D);
|
|
||||||
long remSec=remainingSeconds-remainingMinutes*60;
|
|
||||||
return remainingMinutes+":"+(remSec/10)+remSec%10;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
|
|
||||||
textView = new TextView(this);
|
|
||||||
setContentView(textView);
|
|
||||||
daemon.addStateChangeListener(daemonStateUpdatedListener);
|
|
||||||
daemonStateUpdatedListener.daemonStateUpdate();
|
|
||||||
|
|
||||||
// set the app be foreground
|
|
||||||
doBindService();
|
|
||||||
|
|
||||||
final Timer gracefulQuitTimer = getGracefulQuitTimer();
|
|
||||||
if(gracefulQuitTimer!=null){
|
|
||||||
long gracefulStopAtMillis;
|
|
||||||
synchronized (graceStartedMillis_LOCK) {
|
|
||||||
gracefulStopAtMillis = graceStartedMillis + GRACEFUL_DELAY_MILLIS;
|
|
||||||
}
|
|
||||||
rescheduleGraceStop(gracefulQuitTimer, gracefulStopAtMillis);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
textView = null;
|
|
||||||
daemon.removeStateChangeListener(daemonStateUpdatedListener);
|
|
||||||
//cancelGracefulStop();
|
|
||||||
try{
|
|
||||||
doUnbindService();
|
|
||||||
}catch(Throwable tr){
|
|
||||||
Log.e(TAG, "", tr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void cancelGracefulStop() {
|
|
||||||
Timer gracefulQuitTimer = getGracefulQuitTimer();
|
|
||||||
if(gracefulQuitTimer!=null) {
|
|
||||||
gracefulQuitTimer.cancel();
|
|
||||||
setGracefulQuitTimer(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private CharSequence throwableToString(Throwable tr) {
|
|
||||||
StringWriter sw = new StringWriter(8192);
|
|
||||||
PrintWriter pw = new PrintWriter(sw);
|
|
||||||
tr.printStackTrace(pw);
|
|
||||||
pw.close();
|
|
||||||
return sw.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
// private LocalService mBoundService;
|
|
||||||
|
|
||||||
private ServiceConnection mConnection = new ServiceConnection() {
|
|
||||||
public void onServiceConnected(ComponentName className, IBinder service) {
|
|
||||||
// This is called when the connection with the service has been
|
|
||||||
// established, giving us the service object we can use to
|
|
||||||
// interact with the service. Because we have bound to a explicit
|
|
||||||
// service that we know is running in our own process, we can
|
|
||||||
// cast its IBinder to a concrete class and directly access it.
|
|
||||||
// mBoundService = ((LocalService.LocalBinder)service).getService();
|
|
||||||
|
|
||||||
// Tell the user about this for our demo.
|
|
||||||
// Toast.makeText(Binding.this, R.string.local_service_connected,
|
|
||||||
// Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onServiceDisconnected(ComponentName className) {
|
|
||||||
// This is called when the connection with the service has been
|
|
||||||
// unexpectedly disconnected -- that is, its process crashed.
|
|
||||||
// Because it is running in our same process, we should never
|
|
||||||
// see this happen.
|
|
||||||
// mBoundService = null;
|
|
||||||
// Toast.makeText(Binding.this, R.string.local_service_disconnected,
|
|
||||||
// Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private static volatile boolean mIsBound;
|
|
||||||
|
|
||||||
private void doBindService() {
|
|
||||||
synchronized (I2PDActivity.class) {
|
|
||||||
if (mIsBound) return;
|
|
||||||
// Establish a connection with the service. We use an explicit
|
|
||||||
// class name because we want a specific service implementation that
|
|
||||||
// we know will be running in our own process (and thus won't be
|
|
||||||
// supporting component replacement by other applications).
|
|
||||||
bindService(new Intent(this, ForegroundService.class), mConnection, Context.BIND_AUTO_CREATE);
|
|
||||||
mIsBound = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void doUnbindService() {
|
|
||||||
synchronized (I2PDActivity.class) {
|
|
||||||
if (mIsBound) {
|
|
||||||
// Detach our existing connection.
|
|
||||||
unbindService(mConnection);
|
|
||||||
mIsBound = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
|
||||||
// Inflate the menu; this adds items to the action bar if it is present.
|
|
||||||
getMenuInflater().inflate(R.menu.options_main, menu);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
|
||||||
// Handle action bar item clicks here. The action bar will
|
|
||||||
// automatically handle clicks on the Home/Up button, so long
|
|
||||||
// as you specify a parent activity in AndroidManifest.xml.
|
|
||||||
int id = item.getItemId();
|
|
||||||
|
|
||||||
switch(id){
|
|
||||||
case R.id.action_stop:
|
|
||||||
i2pdStop();
|
|
||||||
return true;
|
|
||||||
case R.id.action_graceful_stop:
|
|
||||||
i2pdGracefulStop();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void i2pdStop() {
|
|
||||||
cancelGracefulStop();
|
|
||||||
new Thread(new Runnable(){
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
Log.d(TAG, "stopping");
|
|
||||||
try{
|
|
||||||
daemon.stopDaemon();
|
|
||||||
}catch (Throwable tr) {
|
|
||||||
Log.e(TAG, "", tr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
},"stop").start();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static volatile Timer gracefulQuitTimer;
|
|
||||||
|
|
||||||
private void i2pdGracefulStop() {
|
|
||||||
if(daemon.getState()==DaemonSingleton.State.stopped){
|
|
||||||
Toast.makeText(this, R.string.already_stopped,
|
|
||||||
Toast.LENGTH_SHORT).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(getGracefulQuitTimer()!=null){
|
|
||||||
Toast.makeText(this, R.string.graceful_stop_is_already_in_progress,
|
|
||||||
Toast.LENGTH_SHORT).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Toast.makeText(this, R.string.graceful_stop_is_in_progress,
|
|
||||||
Toast.LENGTH_SHORT).show();
|
|
||||||
new Thread(new Runnable(){
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try{
|
|
||||||
Log.d(TAG, "grac stopping");
|
|
||||||
if(daemon.isStartedOkay()) {
|
|
||||||
daemon.stopAcceptingTunnels();
|
|
||||||
long gracefulStopAtMillis;
|
|
||||||
synchronized (graceStartedMillis_LOCK) {
|
|
||||||
graceStartedMillis = System.currentTimeMillis();
|
|
||||||
gracefulStopAtMillis = graceStartedMillis + GRACEFUL_DELAY_MILLIS;
|
|
||||||
}
|
|
||||||
rescheduleGraceStop(null,gracefulStopAtMillis);
|
|
||||||
}else{
|
|
||||||
i2pdStop();
|
|
||||||
}
|
|
||||||
} catch(Throwable tr) {
|
|
||||||
Log.e(TAG,"",tr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
},"gracInit").start();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void rescheduleGraceStop(Timer gracefulQuitTimerOld, long gracefulStopAtMillis) {
|
|
||||||
if(gracefulQuitTimerOld!=null)gracefulQuitTimerOld.cancel();
|
|
||||||
final Timer gracefulQuitTimer = new Timer(true);
|
|
||||||
setGracefulQuitTimer(gracefulQuitTimer);
|
|
||||||
gracefulQuitTimer.schedule(new TimerTask(){
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
i2pdStop();
|
|
||||||
}
|
|
||||||
|
|
||||||
}, Math.max(0,gracefulStopAtMillis-System.currentTimeMillis()));
|
|
||||||
final TimerTask tickerTask = new TimerTask() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
daemonStateUpdatedListener.daemonStateUpdate();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
gracefulQuitTimer.scheduleAtFixedRate(tickerTask,0/*start delay*/,1000/*millis period*/);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Timer getGracefulQuitTimer() {
|
|
||||||
return gracefulQuitTimer;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void setGracefulQuitTimer(Timer gracefulQuitTimer) {
|
|
||||||
I2PDActivity.gracefulQuitTimer = gracefulQuitTimer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copy the asset at the specified path to this app's data directory. If the
|
|
||||||
* asset is a directory, its contents are also copied.
|
|
||||||
*
|
|
||||||
* @param path
|
|
||||||
* Path to asset, relative to app's assets directory.
|
|
||||||
*/
|
|
||||||
private void copyAsset(String path) {
|
|
||||||
AssetManager manager = getAssets();
|
|
||||||
|
|
||||||
// If we have a directory, we make it and recurse. If a file, we copy its
|
|
||||||
// contents.
|
|
||||||
try {
|
|
||||||
String[] contents = manager.list(path);
|
|
||||||
|
|
||||||
// The documentation suggests that list throws an IOException, but doesn't
|
|
||||||
// say under what conditions. It'd be nice if it did so when the path was
|
|
||||||
// to a file. That doesn't appear to be the case. If the returned array is
|
|
||||||
// null or has 0 length, we assume the path is to a file. This means empty
|
|
||||||
// directories will get turned into files.
|
|
||||||
if (contents == null || contents.length == 0)
|
|
||||||
throw new IOException();
|
|
||||||
|
|
||||||
// Make the directory.
|
|
||||||
File dir = new File(i2pdpath, path);
|
|
||||||
dir.mkdirs();
|
|
||||||
|
|
||||||
// Recurse on the contents.
|
|
||||||
for (String entry : contents) {
|
|
||||||
copyAsset(path + "/" + entry);
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
copyFileAsset(path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copy the asset file specified by path to app's data directory. Assumes
|
|
||||||
* parent directories have already been created.
|
|
||||||
*
|
|
||||||
* @param path
|
|
||||||
* Path to asset, relative to app's assets directory.
|
|
||||||
*/
|
|
||||||
private void copyFileAsset(String path) {
|
|
||||||
File file = new File(i2pdpath, path);
|
|
||||||
if(!file.exists()) try {
|
|
||||||
InputStream in = getAssets().open(path);
|
|
||||||
OutputStream out = new FileOutputStream(file);
|
|
||||||
byte[] buffer = new byte[1024];
|
|
||||||
int read = in.read(buffer);
|
|
||||||
while (read != -1) {
|
|
||||||
out.write(buffer, 0, read);
|
|
||||||
read = in.read(buffer);
|
|
||||||
}
|
|
||||||
out.close();
|
|
||||||
in.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
Log.e(TAG, "", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void deleteRecursive(File fileOrDirectory) {
|
|
||||||
if (fileOrDirectory.isDirectory()) {
|
|
||||||
for (File child : fileOrDirectory.listFiles()) {
|
|
||||||
deleteRecursive(child);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fileOrDirectory.delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void processAssets() {
|
|
||||||
if (!assetsCopied) try {
|
|
||||||
assetsCopied = true; // prevent from running on every state update
|
|
||||||
|
|
||||||
File holderfile = new File(i2pdpath, "assets.ready");
|
|
||||||
String versionName = BuildConfig.VERSION_NAME; // here will be app version, like 2.XX.XX
|
|
||||||
StringBuilder text = new StringBuilder();
|
|
||||||
|
|
||||||
if (holderfile.exists()) try { // if holder file exists, read assets version string
|
|
||||||
BufferedReader br = new BufferedReader(new FileReader(holderfile));
|
|
||||||
String line;
|
|
||||||
|
|
||||||
while ((line = br.readLine()) != null) {
|
|
||||||
text.append(line);
|
|
||||||
}
|
|
||||||
br.close();
|
|
||||||
}
|
|
||||||
catch (IOException e) {
|
|
||||||
Log.e(TAG, "", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
// if version differs from current app version or null, try to delete certificates folder
|
|
||||||
if (!text.toString().contains(versionName)) try {
|
|
||||||
holderfile.delete();
|
|
||||||
File certpath = new File(i2pdpath, "certificates");
|
|
||||||
deleteRecursive(certpath);
|
|
||||||
}
|
|
||||||
catch (Throwable tr) {
|
|
||||||
Log.e(TAG, "", tr);
|
|
||||||
}
|
|
||||||
|
|
||||||
// copy assets. If processed file exists, it won't be overwrited
|
|
||||||
copyAsset("certificates");
|
|
||||||
copyAsset("i2pd.conf");
|
|
||||||
copyAsset("subscriptions.txt");
|
|
||||||
copyAsset("tunnels.conf");
|
|
||||||
|
|
||||||
// update holder file about successful copying
|
|
||||||
FileWriter writer = new FileWriter(holderfile);
|
|
||||||
writer.append(versionName);
|
|
||||||
writer.flush();
|
|
||||||
writer.close();
|
|
||||||
}
|
|
||||||
catch (Throwable tr)
|
|
||||||
{
|
|
||||||
Log.e(TAG,"copy assets",tr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,171 +0,0 @@
|
|||||||
package org.purplei2p.i2pd;
|
|
||||||
|
|
||||||
import android.Manifest;
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.pm.PackageManager;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
|
|
||||||
//dangerous perms, per https://developer.android.com/guide/topics/permissions/normal-permissions.html :
|
|
||||||
//android.permission.WRITE_EXTERNAL_STORAGE
|
|
||||||
public class I2PDPermsAskerActivity extends Activity {
|
|
||||||
|
|
||||||
private static final int PERMISSION_WRITE_EXTERNAL_STORAGE = 0;
|
|
||||||
|
|
||||||
private Button button_request_write_ext_storage_perms;
|
|
||||||
private TextView textview_retry;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
//if less than Android 6, no runtime perms req system present
|
|
||||||
if (android.os.Build.VERSION.SDK_INT < 23) {
|
|
||||||
startMainActivity();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
setContentView(R.layout.activity_perms_asker);
|
|
||||||
button_request_write_ext_storage_perms = (Button) findViewById(R.id.button_request_write_ext_storage_perms);
|
|
||||||
textview_retry = (TextView) findViewById(R.id.textview_retry);
|
|
||||||
|
|
||||||
button_request_write_ext_storage_perms.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
request_write_ext_storage_perms();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
request_write_ext_storage_perms();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void request_write_ext_storage_perms() {
|
|
||||||
|
|
||||||
textview_retry.setVisibility(TextView.GONE);
|
|
||||||
button_request_write_ext_storage_perms.setVisibility(Button.GONE);
|
|
||||||
|
|
||||||
Method methodCheckPermission;
|
|
||||||
Method method_shouldShowRequestPermissionRationale;
|
|
||||||
Method method_requestPermissions;
|
|
||||||
try {
|
|
||||||
methodCheckPermission = getClass().getMethod("checkSelfPermission", String.class);
|
|
||||||
method_shouldShowRequestPermissionRationale =
|
|
||||||
getClass().getMethod("shouldShowRequestPermissionRationale", String.class);
|
|
||||||
method_requestPermissions =
|
|
||||||
getClass().getMethod("requestPermissions", String[].class, int.class);
|
|
||||||
} catch (NoSuchMethodException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
Integer resultObj;
|
|
||||||
try {
|
|
||||||
resultObj = (Integer) methodCheckPermission.invoke(
|
|
||||||
this, Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resultObj != PackageManager.PERMISSION_GRANTED) {
|
|
||||||
|
|
||||||
// Should we show an explanation?
|
|
||||||
Boolean aBoolean;
|
|
||||||
try {
|
|
||||||
aBoolean = (Boolean) method_shouldShowRequestPermissionRationale.invoke(this,
|
|
||||||
Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
if (aBoolean) {
|
|
||||||
|
|
||||||
// Show an explanation to the user *asynchronously* -- don't block
|
|
||||||
// this thread waiting for the user's response! After the user
|
|
||||||
// sees the explanation, try again to request the permission.
|
|
||||||
|
|
||||||
showExplanation();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
// No explanation needed, we can request the permission.
|
|
||||||
|
|
||||||
try {
|
|
||||||
method_requestPermissions.invoke(this,
|
|
||||||
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
|
|
||||||
PERMISSION_WRITE_EXTERNAL_STORAGE);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else startMainActivity();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onRequestPermissionsResult(int requestCode,
|
|
||||||
String permissions[], int[] grantResults) {
|
|
||||||
switch (requestCode) {
|
|
||||||
case PERMISSION_WRITE_EXTERNAL_STORAGE: {
|
|
||||||
// If request is cancelled, the result arrays are empty.
|
|
||||||
if (grantResults.length > 0
|
|
||||||
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
|
||||||
|
|
||||||
// permission was granted, yay! Do the
|
|
||||||
// contacts-related task you need to do.
|
|
||||||
|
|
||||||
startMainActivity();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
// permission denied, boo! Disable the
|
|
||||||
// functionality that depends on this permission.
|
|
||||||
textview_retry.setText("SD card write permission denied, you need to allow this to continue");
|
|
||||||
textview_retry.setVisibility(TextView.VISIBLE);
|
|
||||||
button_request_write_ext_storage_perms.setVisibility(Button.VISIBLE);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// other 'case' lines to check for other
|
|
||||||
// permissions this app might request.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void startMainActivity() {
|
|
||||||
startActivity(new Intent(this, I2PDActivity.class));
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final int SHOW_EXPLANATION_REQUEST = 1; // The request code
|
|
||||||
private void showExplanation() {
|
|
||||||
Intent intent = new Intent(this, I2PDPermsExplanationActivity.class);
|
|
||||||
startActivityForResult(intent, SHOW_EXPLANATION_REQUEST);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
||||||
// Check which request we're responding to
|
|
||||||
if (requestCode == SHOW_EXPLANATION_REQUEST) {
|
|
||||||
// Make sure the request was successful
|
|
||||||
if (resultCode == RESULT_OK) {
|
|
||||||
// Request the permission
|
|
||||||
Method method_requestPermissions;
|
|
||||||
try {
|
|
||||||
method_requestPermissions =
|
|
||||||
getClass().getMethod("requestPermissions", String[].class, int.class);
|
|
||||||
} catch (NoSuchMethodException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
method_requestPermissions.invoke(this,
|
|
||||||
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
|
|
||||||
PERMISSION_WRITE_EXTERNAL_STORAGE);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
finish(); //close the app
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
package org.purplei2p.i2pd;
|
|
||||||
|
|
||||||
import android.app.ActionBar;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.Button;
|
|
||||||
|
|
||||||
public class I2PDPermsExplanationActivity extends Activity {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_perms_explanation);
|
|
||||||
ActionBar actionBar = getActionBar();
|
|
||||||
if(actionBar!=null)actionBar.setHomeButtonEnabled(false);
|
|
||||||
Button button_ok = (Button) findViewById(R.id.button_ok);
|
|
||||||
button_ok.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
returnFromActivity();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void returnFromActivity() {
|
|
||||||
Intent data = new Intent();
|
|
||||||
Activity parent = getParent();
|
|
||||||
if (parent == null) {
|
|
||||||
setResult(Activity.RESULT_OK, data);
|
|
||||||
} else {
|
|
||||||
parent.setResult(Activity.RESULT_OK, data);
|
|
||||||
}
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
package org.purplei2p.i2pd;
|
|
||||||
|
|
||||||
public class I2PD_JNI {
|
|
||||||
public static native String getABICompiledWith();
|
|
||||||
/**
|
|
||||||
* returns error info if failed
|
|
||||||
* returns "ok" if daemon initialized and started okay
|
|
||||||
*/
|
|
||||||
public static native String startDaemon();
|
|
||||||
//should only be called after startDaemon() success
|
|
||||||
public static native void stopDaemon();
|
|
||||||
|
|
||||||
public static native void stopAcceptingTunnels();
|
|
||||||
|
|
||||||
public static native void onNetworkStateChanged(boolean isConnected);
|
|
||||||
|
|
||||||
public static void loadLibraries() {
|
|
||||||
System.loadLibrary("gnustl_shared");
|
|
||||||
System.loadLibrary("i2pd");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
package org.purplei2p.i2pd;
|
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.net.ConnectivityManager;
|
|
||||||
import android.net.NetworkInfo;
|
|
||||||
|
|
||||||
public class NetworkStateChangeReceiver extends BroadcastReceiver {
|
|
||||||
|
|
||||||
private static final String TAG = "i2pd";
|
|
||||||
|
|
||||||
//api level 1
|
|
||||||
@Override
|
|
||||||
public void onReceive(final Context context, final Intent intent) {
|
|
||||||
Log.d(TAG,"Network state change");
|
|
||||||
try {
|
|
||||||
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
|
||||||
NetworkInfo activeNetworkInfo = cm.getActiveNetworkInfo();
|
|
||||||
boolean isConnected = activeNetworkInfo!=null && activeNetworkInfo.isConnected();
|
|
||||||
// https://developer.android.com/training/monitoring-device-state/connectivity-monitoring.html?hl=ru
|
|
||||||
// boolean isWiFi = activeNetworkInfo!=null && (activeNetworkInfo.getType() == ConnectivityManager.TYPE_WIFI);
|
|
||||||
|
|
||||||
I2PD_JNI.onNetworkStateChanged(isConnected);
|
|
||||||
} catch (Throwable tr) {
|
|
||||||
Log.d(TAG,"",tr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
18
android_binary_only/.gitignore
vendored
18
android_binary_only/.gitignore
vendored
@@ -1,18 +0,0 @@
|
|||||||
gen
|
|
||||||
tests
|
|
||||||
bin
|
|
||||||
libs
|
|
||||||
log*
|
|
||||||
obj
|
|
||||||
.gradle
|
|
||||||
.idea
|
|
||||||
.externalNativeBuild
|
|
||||||
ant.properties
|
|
||||||
local.properties
|
|
||||||
build.sh
|
|
||||||
android.iml
|
|
||||||
build
|
|
||||||
gradle
|
|
||||||
gradlew
|
|
||||||
gradlew.bat
|
|
||||||
|
|
||||||
56
appveyor.yml
56
appveyor.yml
@@ -1,4 +1,4 @@
|
|||||||
version: 2.21.1.{build}
|
version: 2.37.0.{build}
|
||||||
pull_requests:
|
pull_requests:
|
||||||
do_not_increment_build_number: true
|
do_not_increment_build_number: true
|
||||||
branches:
|
branches:
|
||||||
@@ -9,41 +9,49 @@ os: Visual Studio 2015
|
|||||||
shallow_clone: true
|
shallow_clone: true
|
||||||
clone_depth: 1
|
clone_depth: 1
|
||||||
|
|
||||||
|
# avoid building 32-bit if 64-bit failed already
|
||||||
|
matrix:
|
||||||
|
fast_finish: true
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
|
APPVEYOR_SAVE_CACHE_ON_ERROR: true
|
||||||
MSYS2_PATH_TYPE: inherit
|
MSYS2_PATH_TYPE: inherit
|
||||||
CHERE_INVOKING: enabled_from_arguments
|
CHERE_INVOKING: enabled_from_arguments
|
||||||
matrix:
|
matrix:
|
||||||
- MSYSTEM: MINGW64
|
- MSYSTEM: MINGW64
|
||||||
- MSYSTEM: MINGW32
|
- MSYSTEM: MINGW32
|
||||||
|
|
||||||
|
cache:
|
||||||
|
- c:\msys64\var\cache\pacman\pkg\
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- c:\msys64\usr\bin\bash -lc "pacman --noconfirm -Rns gcc-fortran gcc"
|
# install new signing keyring
|
||||||
- c:\msys64\usr\bin\bash -lc "pacman --noconfirm -Syuu --force"
|
- c:\msys64\usr\bin\bash -lc "curl -O https://mirror.selfnet.de/msys2/msys/x86_64/msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz"
|
||||||
|
- c:\msys64\usr\bin\bash -lc "curl -O https://mirror.selfnet.de/msys2/msys/x86_64/msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz.sig"
|
||||||
- c:\msys64\usr\bin\bash -lc "pacman --noconfirm -Syuu --force"
|
- c:\msys64\usr\bin\bash -lc "pacman-key --verify msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz.sig"
|
||||||
|
- c:\msys64\usr\bin\bash -lc "pacman --noconfirm -U msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz"
|
||||||
- if "%MSYSTEM%" == "MINGW64" (
|
# remove packages which can break build
|
||||||
c:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-x86_64-boost mingw-w64-x86_64-miniupnpc"
|
- c:\msys64\usr\bin\bash -lc "pacman --noconfirm -Rns gcc-fortran gcc mingw-w64-{i686,x86_64}-gcc-ada mingw-w64-{i686,x86_64}-gcc-objc"
|
||||||
) else (
|
# update runtime
|
||||||
c:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-i686-boost mingw-w64-i686-miniupnpc"
|
- c:\msys64\usr\bin\bash -lc "pacman --noconfirm -Syuu"
|
||||||
)
|
# Kill bash before next try
|
||||||
|
- taskkill /T /F /IM bash.exe /IM gpg.exe /IM gpg-agent.exe | exit /B 0
|
||||||
- if "%MSYSTEM%" == "MINGW64" (
|
# update packages and install required
|
||||||
set "bitness=64"
|
- c:\msys64\usr\bin\bash -lc "pacman --noconfirm -Syuu $MINGW_PACKAGE_PREFIX-boost $MINGW_PACKAGE_PREFIX-miniupnpc"
|
||||||
) else (
|
|
||||||
set "bitness=32"
|
|
||||||
)
|
|
||||||
|
|
||||||
build_script:
|
build_script:
|
||||||
- cmd: >-
|
- c:\msys64\usr\bin\bash -lc "make USE_UPNP=yes DEBUG=no -j3"
|
||||||
cd \projects\i2pd
|
# prepare archive for uploading
|
||||||
|
- set "FILELIST=i2pd.exe README.txt contrib/i2pd.conf contrib/tunnels.conf contrib/certificates contrib/tunnels.d"
|
||||||
|
- echo This is development build, use it carefully! For running in portable mode, move all files from contrib directory here. > README.txt
|
||||||
|
- 7z a -tzip -mx9 -mmt i2pd-%APPVEYOR_BUILD_VERSION%-%APPVEYOR_REPO_COMMIT:~0,7%-mingw-win%MSYSTEM:~-2%.zip %FILELIST%
|
||||||
|
|
||||||
echo MSYSTEM = %MSYSTEM%, bitness = %bitness%
|
after_build:
|
||||||
|
- c:\msys64\usr\bin\bash -lc "pacman --noconfirm -Sc"
|
||||||
- c:\msys64\usr\bin\bash -lc "make USE_UPNP=yes -j2"
|
|
||||||
- 7z a -tzip -mx9 -mmt i2pd-mingw-win%bitness%.zip i2pd.exe
|
|
||||||
|
|
||||||
test: off
|
test: off
|
||||||
|
|
||||||
|
deploy: off
|
||||||
|
|
||||||
artifacts:
|
artifacts:
|
||||||
- path: i2pd-mingw-win*.zip
|
- path: i2pd-*.zip
|
||||||
|
|||||||
@@ -1,30 +1,31 @@
|
|||||||
cmake_minimum_required ( VERSION 2.8.12 )
|
cmake_minimum_required(VERSION 2.8.12)
|
||||||
# this addresses CMP0059 with CMake > 3.3 for PCH flags
|
# this addresses CMP0059 with CMake > 3.3 for PCH flags
|
||||||
cmake_policy( VERSION 2.8.12 )
|
cmake_policy(VERSION 2.8.12)
|
||||||
project ( "i2pd" )
|
project("i2pd")
|
||||||
|
|
||||||
# for debugging
|
# for debugging
|
||||||
#set(CMAKE_VERBOSE_MAKEFILE on)
|
#set(CMAKE_VERBOSE_MAKEFILE on)
|
||||||
|
|
||||||
# configurale options
|
# Win32 build with cmake is not supported
|
||||||
option(WITH_AESNI "Use AES-NI instructions set" OFF)
|
if(WIN32 OR MSVC OR MSYS OR MINGW)
|
||||||
option(WITH_AVX "Use AVX instructions" OFF)
|
message(SEND_ERROR "cmake build for windows is not supported. Please use MSYS2 with makefiles in project root.")
|
||||||
option(WITH_HARDENING "Use hardening compiler flags" OFF)
|
endif()
|
||||||
option(WITH_LIBRARY "Build library" ON)
|
|
||||||
option(WITH_BINARY "Build binary" ON)
|
# configurable options
|
||||||
option(WITH_STATIC "Static build" OFF)
|
option(WITH_AESNI "Use AES-NI instructions set" ON)
|
||||||
option(WITH_UPNP "Include support for UPnP client" OFF)
|
option(WITH_HARDENING "Use hardening compiler flags" OFF)
|
||||||
option(WITH_PCH "Use precompiled header" OFF)
|
option(WITH_LIBRARY "Build library" ON)
|
||||||
option(WITH_GUI "Include GUI (currently MS Windows only)" ON)
|
option(WITH_BINARY "Build binary" ON)
|
||||||
option(WITH_MESHNET "Build for cjdns test network" OFF)
|
option(WITH_STATIC "Static build" OFF)
|
||||||
option(WITH_ADDRSANITIZER "Build with address sanitizer unix only" OFF)
|
option(WITH_UPNP "Include support for UPnP client" OFF)
|
||||||
option(WITH_THREADSANITIZER "Build with thread sanitizer unix only" OFF)
|
option(WITH_PCH "Use precompiled header" OFF)
|
||||||
option(WITH_I2LUA "Build for i2lua" OFF)
|
option(WITH_MESHNET "Build for cjdns test network" OFF)
|
||||||
option(WITH_WEBSOCKETS "Build with websocket ui" OFF)
|
option(WITH_ADDRSANITIZER "Build with address sanitizer unix only" OFF)
|
||||||
|
option(WITH_THREADSANITIZER "Build with thread sanitizer unix only" OFF)
|
||||||
|
|
||||||
# paths
|
# paths
|
||||||
set ( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules" )
|
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules")
|
||||||
set ( CMAKE_SOURCE_DIR ".." )
|
set(CMAKE_SOURCE_DIR "..")
|
||||||
|
|
||||||
# architecture
|
# architecture
|
||||||
include(TargetArch)
|
include(TargetArch)
|
||||||
@@ -32,74 +33,65 @@ target_architecture(ARCHITECTURE)
|
|||||||
|
|
||||||
set(LIBI2PD_SRC_DIR ../libi2pd)
|
set(LIBI2PD_SRC_DIR ../libi2pd)
|
||||||
set(LIBI2PD_CLIENT_SRC_DIR ../libi2pd_client)
|
set(LIBI2PD_CLIENT_SRC_DIR ../libi2pd_client)
|
||||||
|
set(DAEMON_SRC_DIR ../daemon)
|
||||||
|
|
||||||
include_directories(${LIBI2PD_SRC_DIR})
|
include_directories(${LIBI2PD_SRC_DIR})
|
||||||
include_directories(${LIBI2PD_CLIENT_SRC_DIR})
|
include_directories(${LIBI2PD_CLIENT_SRC_DIR})
|
||||||
|
include_directories(${DAEMON_SRC_DIR})
|
||||||
|
|
||||||
set (LIBI2PD_SRC
|
set(LIBI2PD_SRC
|
||||||
|
"${LIBI2PD_SRC_DIR}/api.cpp"
|
||||||
|
"${LIBI2PD_SRC_DIR}/Base.cpp"
|
||||||
|
"${LIBI2PD_SRC_DIR}/Blinding.cpp"
|
||||||
"${LIBI2PD_SRC_DIR}/BloomFilter.cpp"
|
"${LIBI2PD_SRC_DIR}/BloomFilter.cpp"
|
||||||
|
"${LIBI2PD_SRC_DIR}/ChaCha20.cpp"
|
||||||
"${LIBI2PD_SRC_DIR}/Config.cpp"
|
"${LIBI2PD_SRC_DIR}/Config.cpp"
|
||||||
"${LIBI2PD_SRC_DIR}/CPU.cpp"
|
"${LIBI2PD_SRC_DIR}/CPU.cpp"
|
||||||
"${LIBI2PD_SRC_DIR}/Crypto.cpp"
|
"${LIBI2PD_SRC_DIR}/Crypto.cpp"
|
||||||
"${LIBI2PD_SRC_DIR}/CryptoKey.cpp"
|
"${LIBI2PD_SRC_DIR}/CryptoKey.cpp"
|
||||||
|
"${LIBI2PD_SRC_DIR}/Datagram.cpp"
|
||||||
|
"${LIBI2PD_SRC_DIR}/Destination.cpp"
|
||||||
|
"${LIBI2PD_SRC_DIR}/ECIESX25519AEADRatchetSession.cpp"
|
||||||
|
"${LIBI2PD_SRC_DIR}/Ed25519.cpp"
|
||||||
|
"${LIBI2PD_SRC_DIR}/Elligator.cpp"
|
||||||
|
"${LIBI2PD_SRC_DIR}/Family.cpp"
|
||||||
|
"${LIBI2PD_SRC_DIR}/FS.cpp"
|
||||||
"${LIBI2PD_SRC_DIR}/Garlic.cpp"
|
"${LIBI2PD_SRC_DIR}/Garlic.cpp"
|
||||||
|
"${LIBI2PD_SRC_DIR}/Gost.cpp"
|
||||||
"${LIBI2PD_SRC_DIR}/Gzip.cpp"
|
"${LIBI2PD_SRC_DIR}/Gzip.cpp"
|
||||||
"${LIBI2PD_SRC_DIR}/HTTP.cpp"
|
"${LIBI2PD_SRC_DIR}/HTTP.cpp"
|
||||||
"${LIBI2PD_SRC_DIR}/I2NPProtocol.cpp"
|
"${LIBI2PD_SRC_DIR}/I2NPProtocol.cpp"
|
||||||
"${LIBI2PD_SRC_DIR}/Identity.cpp"
|
"${LIBI2PD_SRC_DIR}/Identity.cpp"
|
||||||
"${LIBI2PD_SRC_DIR}/LeaseSet.cpp"
|
"${LIBI2PD_SRC_DIR}/LeaseSet.cpp"
|
||||||
"${LIBI2PD_SRC_DIR}/FS.cpp"
|
|
||||||
"${LIBI2PD_SRC_DIR}/Log.cpp"
|
"${LIBI2PD_SRC_DIR}/Log.cpp"
|
||||||
"${LIBI2PD_SRC_DIR}/NTCPSession.cpp"
|
|
||||||
"${LIBI2PD_SRC_DIR}/NetDbRequests.cpp"
|
|
||||||
"${LIBI2PD_SRC_DIR}/NetDb.cpp"
|
"${LIBI2PD_SRC_DIR}/NetDb.cpp"
|
||||||
|
"${LIBI2PD_SRC_DIR}/NetDbRequests.cpp"
|
||||||
|
"${LIBI2PD_SRC_DIR}/NTCP2.cpp"
|
||||||
|
"${LIBI2PD_SRC_DIR}/Poly1305.cpp"
|
||||||
"${LIBI2PD_SRC_DIR}/Profiling.cpp"
|
"${LIBI2PD_SRC_DIR}/Profiling.cpp"
|
||||||
"${LIBI2PD_SRC_DIR}/Reseed.cpp"
|
"${LIBI2PD_SRC_DIR}/Reseed.cpp"
|
||||||
"${LIBI2PD_SRC_DIR}/RouterContext.cpp"
|
"${LIBI2PD_SRC_DIR}/RouterContext.cpp"
|
||||||
"${LIBI2PD_SRC_DIR}/RouterInfo.cpp"
|
"${LIBI2PD_SRC_DIR}/RouterInfo.cpp"
|
||||||
|
"${LIBI2PD_SRC_DIR}/Signature.cpp"
|
||||||
"${LIBI2PD_SRC_DIR}/SSU.cpp"
|
"${LIBI2PD_SRC_DIR}/SSU.cpp"
|
||||||
"${LIBI2PD_SRC_DIR}/SSUData.cpp"
|
"${LIBI2PD_SRC_DIR}/SSUData.cpp"
|
||||||
"${LIBI2PD_SRC_DIR}/SSUSession.cpp"
|
"${LIBI2PD_SRC_DIR}/SSUSession.cpp"
|
||||||
"${LIBI2PD_SRC_DIR}/Streaming.cpp"
|
"${LIBI2PD_SRC_DIR}/Streaming.cpp"
|
||||||
"${LIBI2PD_SRC_DIR}/Destination.cpp"
|
|
||||||
"${LIBI2PD_SRC_DIR}/TransitTunnel.cpp"
|
|
||||||
"${LIBI2PD_SRC_DIR}/Tunnel.cpp"
|
|
||||||
"${LIBI2PD_SRC_DIR}/TunnelGateway.cpp"
|
|
||||||
"${LIBI2PD_SRC_DIR}/Transports.cpp"
|
|
||||||
"${LIBI2PD_SRC_DIR}/TunnelEndpoint.cpp"
|
|
||||||
"${LIBI2PD_SRC_DIR}/TunnelPool.cpp"
|
|
||||||
"${LIBI2PD_SRC_DIR}/Base.cpp"
|
|
||||||
"${LIBI2PD_SRC_DIR}/util.cpp"
|
|
||||||
"${LIBI2PD_SRC_DIR}/Datagram.cpp"
|
|
||||||
"${LIBI2PD_SRC_DIR}/Family.cpp"
|
|
||||||
"${LIBI2PD_SRC_DIR}/Signature.cpp"
|
|
||||||
"${LIBI2PD_SRC_DIR}/Timestamp.cpp"
|
"${LIBI2PD_SRC_DIR}/Timestamp.cpp"
|
||||||
"${LIBI2PD_SRC_DIR}/api.cpp"
|
"${LIBI2PD_SRC_DIR}/TransitTunnel.cpp"
|
||||||
"${LIBI2PD_SRC_DIR}/Event.cpp"
|
"${LIBI2PD_SRC_DIR}/Transports.cpp"
|
||||||
"${LIBI2PD_SRC_DIR}/Gost.cpp"
|
"${LIBI2PD_SRC_DIR}/Tunnel.cpp"
|
||||||
"${LIBI2PD_SRC_DIR}/ChaCha20.cpp"
|
"${LIBI2PD_SRC_DIR}/TunnelEndpoint.cpp"
|
||||||
"${LIBI2PD_SRC_DIR}/Poly1305.cpp"
|
"${LIBI2PD_SRC_DIR}/TunnelGateway.cpp"
|
||||||
"${LIBI2PD_SRC_DIR}/Ed25519.cpp"
|
"${LIBI2PD_SRC_DIR}/TunnelPool.cpp"
|
||||||
"${LIBI2PD_SRC_DIR}/NTCP2.cpp"
|
"${LIBI2PD_SRC_DIR}/TunnelConfig.cpp"
|
||||||
|
"${LIBI2PD_SRC_DIR}/util.cpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
if (WITH_WEBSOCKETS)
|
|
||||||
add_definitions(-DWITH_EVENTS)
|
|
||||||
find_package(websocketpp REQUIRED)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
if (WIN32 OR MSYS)
|
|
||||||
list (APPEND LIBI2PD_SRC "${CMAKE_SOURCE_DIR}/I2PEndian.cpp")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
if (WITH_I2LUA)
|
|
||||||
add_definitions(-DI2LUA)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_library(libi2pd ${LIBI2PD_SRC})
|
add_library(libi2pd ${LIBI2PD_SRC})
|
||||||
set_target_properties(libi2pd PROPERTIES PREFIX "")
|
set_target_properties(libi2pd PROPERTIES PREFIX "")
|
||||||
|
|
||||||
if (WITH_LIBRARY)
|
if(WITH_LIBRARY)
|
||||||
install(TARGETS libi2pd
|
install(TARGETS libi2pd
|
||||||
EXPORT libi2pd
|
EXPORT libi2pd
|
||||||
ARCHIVE DESTINATION lib
|
ARCHIVE DESTINATION lib
|
||||||
@@ -110,7 +102,7 @@ if (WITH_LIBRARY)
|
|||||||
# install(EXPORT libi2pd DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
# install(EXPORT libi2pd DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set (CLIENT_SRC
|
set(CLIENT_SRC
|
||||||
"${LIBI2PD_CLIENT_SRC_DIR}/AddressBook.cpp"
|
"${LIBI2PD_CLIENT_SRC_DIR}/AddressBook.cpp"
|
||||||
"${LIBI2PD_CLIENT_SRC_DIR}/BOB.cpp"
|
"${LIBI2PD_CLIENT_SRC_DIR}/BOB.cpp"
|
||||||
"${LIBI2PD_CLIENT_SRC_DIR}/ClientContext.cpp"
|
"${LIBI2PD_CLIENT_SRC_DIR}/ClientContext.cpp"
|
||||||
@@ -121,17 +113,12 @@ set (CLIENT_SRC
|
|||||||
"${LIBI2PD_CLIENT_SRC_DIR}/SOCKS.cpp"
|
"${LIBI2PD_CLIENT_SRC_DIR}/SOCKS.cpp"
|
||||||
"${LIBI2PD_CLIENT_SRC_DIR}/HTTPProxy.cpp"
|
"${LIBI2PD_CLIENT_SRC_DIR}/HTTPProxy.cpp"
|
||||||
"${LIBI2PD_CLIENT_SRC_DIR}/I2CP.cpp"
|
"${LIBI2PD_CLIENT_SRC_DIR}/I2CP.cpp"
|
||||||
"${LIBI2PD_CLIENT_SRC_DIR}/WebSocks.cpp"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if(WITH_WEBSOCKETS)
|
|
||||||
list (APPEND CLIENT_SRC "${LIBI2PD_CLIENT_SRC_DIR}/Websocket.cpp")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
add_library(libi2pdclient ${CLIENT_SRC})
|
add_library(libi2pdclient ${CLIENT_SRC})
|
||||||
set_target_properties(libi2pdclient PROPERTIES PREFIX "")
|
set_target_properties(libi2pdclient PROPERTIES PREFIX "")
|
||||||
|
|
||||||
if (WITH_LIBRARY)
|
if(WITH_LIBRARY)
|
||||||
install(TARGETS libi2pdclient
|
install(TARGETS libi2pdclient
|
||||||
EXPORT libi2pdclient
|
EXPORT libi2pdclient
|
||||||
ARCHIVE DESTINATION lib
|
ARCHIVE DESTINATION lib
|
||||||
@@ -139,9 +126,7 @@ if (WITH_LIBRARY)
|
|||||||
COMPONENT Libraries)
|
COMPONENT Libraries)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(DAEMON_SRC_DIR ../daemon)
|
set(DAEMON_SRC
|
||||||
|
|
||||||
set (DAEMON_SRC
|
|
||||||
"${DAEMON_SRC_DIR}/Daemon.cpp"
|
"${DAEMON_SRC_DIR}/Daemon.cpp"
|
||||||
"${DAEMON_SRC_DIR}/HTTPServer.cpp"
|
"${DAEMON_SRC_DIR}/HTTPServer.cpp"
|
||||||
"${DAEMON_SRC_DIR}/I2PControl.cpp"
|
"${DAEMON_SRC_DIR}/I2PControl.cpp"
|
||||||
@@ -149,116 +134,78 @@ set (DAEMON_SRC
|
|||||||
"${DAEMON_SRC_DIR}/UPnP.cpp"
|
"${DAEMON_SRC_DIR}/UPnP.cpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
if (WITH_MESHNET)
|
if(WITH_MESHNET)
|
||||||
add_definitions(-DMESHNET)
|
add_definitions(-DMESHNET)
|
||||||
endif ()
|
endif()
|
||||||
|
|
||||||
if (WITH_UPNP)
|
if(WITH_UPNP)
|
||||||
add_definitions(-DUSE_UPNP)
|
add_definitions(-DUSE_UPNP)
|
||||||
if (NOT MSVC AND NOT MSYS)
|
endif()
|
||||||
set(DL_LIB ${CMAKE_DL_LIBS})
|
|
||||||
endif ()
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
# compiler flags customization (by vendor)
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Winvalid-pch -Wno-unused-parameter")
|
||||||
if (MSVC)
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -pedantic")
|
||||||
add_definitions( -DWIN32_LEAN_AND_MEAN -DNOMINMAX )
|
# TODO: The following is incompatible with static build and enabled hardening for OpenWRT.
|
||||||
# TODO Check & report to Boost dev, there should be no need for these two
|
# Multiple definitions of __stack_chk_fail(libssp & libc)
|
||||||
add_definitions( -DBOOST_THREAD_NO_LIB -DBOOST_CHRONO_NO_LIB )
|
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -flto -s -ffunction-sections -fdata-sections")
|
||||||
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL" )
|
set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "-Wl,--gc-sections") # -flto is added from above
|
||||||
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /INCREMENTAL:NO /LTCG" )
|
|
||||||
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} /GL" )
|
|
||||||
set( CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /INCREMENTAL:NO /LTCG" )
|
|
||||||
else()
|
|
||||||
if (MSYS OR MINGW)
|
|
||||||
add_definitions( -DWIN32_LEAN_AND_MEAN )
|
|
||||||
endif ()
|
|
||||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Winvalid-pch -Wno-unused-parameter" )
|
|
||||||
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -pedantic" )
|
|
||||||
# TODO: The following is incompatible with static build and enabled hardening for OpenWRT.
|
|
||||||
# Multiple definitions of __stack_chk_fail (libssp & libc)
|
|
||||||
set( CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -flto -s -ffunction-sections -fdata-sections" )
|
|
||||||
set( CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "-Wl,--gc-sections" ) # -flto is added from above
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
# check for c++11 support
|
# check for c++17 & c++11 support
|
||||||
include(CheckCXXCompilerFlag)
|
include(CheckCXXCompilerFlag)
|
||||||
|
CHECK_CXX_COMPILER_FLAG("-std=c++17" CXX17_SUPPORTED)
|
||||||
CHECK_CXX_COMPILER_FLAG("-std=c++11" CXX11_SUPPORTED)
|
CHECK_CXX_COMPILER_FLAG("-std=c++11" CXX11_SUPPORTED)
|
||||||
CHECK_CXX_COMPILER_FLAG("-std=c++0x" CXX0X_SUPPORTED)
|
if(CXX17_SUPPORTED)
|
||||||
if (CXX11_SUPPORTED)
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
|
||||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
|
elseif(CXX11_SUPPORTED)
|
||||||
elseif (CXX0X_SUPPORTED) # gcc 4.6
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x" )
|
else()
|
||||||
elseif (NOT MSVC)
|
message(SEND_ERROR "C++17 nor C++11 standard not seems to be supported by compiler. Too old version?")
|
||||||
message(SEND_ERROR "C++11 standard not seems to be supported by compiler. Too old version?")
|
endif()
|
||||||
endif ()
|
|
||||||
|
|
||||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pipe")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pipe")
|
||||||
if (WITH_HARDENING)
|
if(WITH_HARDENING)
|
||||||
add_definitions( "-D_FORTIFY_SOURCE=2" )
|
add_definitions("-D_FORTIFY_SOURCE=2")
|
||||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat -Wformat-security -Werror=format-security" )
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat -Wformat-security -Werror=format-security")
|
||||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector --param ssp-buffer-size=4" )
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector --param ssp-buffer-size=4")
|
||||||
endif ()
|
endif()
|
||||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
# more tweaks
|
# more tweaks
|
||||||
if (LINUX)
|
if(LINUX)
|
||||||
set (CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -stdlib=libstdc++" ) # required for <atomic>
|
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -stdlib=libstdc++") # required for <atomic>
|
||||||
list(APPEND CMAKE_REQUIRED_LIBRARIES "stdc++") # required to link with -stdlib=libstdc++
|
list(APPEND CMAKE_REQUIRED_LIBRARIES "stdc++") # required to link with -stdlib=libstdc++
|
||||||
endif()
|
endif()
|
||||||
if (NOT (MSVC OR MSYS OR APPLE))
|
if(NOT APPLE)
|
||||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-const-variable -Wno-overloaded-virtual -Wno-c99-extensions" )
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-const-variable -Wno-overloaded-virtual -Wno-c99-extensions")
|
||||||
endif()
|
endif()
|
||||||
endif ()
|
endif()
|
||||||
|
|
||||||
if (WITH_HARDENING AND MSVC)
|
# compiler flags customization(by system)
|
||||||
# Most security options like dynamic base, buffer & stack checks are ON by default
|
if(UNIX)
|
||||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /guard:cf" )
|
list(APPEND DAEMON_SRC "${DAEMON_SRC_DIR}/UnixDaemon.cpp")
|
||||||
endif ()
|
if(NOT(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD" OR APPLE))
|
||||||
|
|
||||||
# compiler flags customization (by system)
|
|
||||||
if (UNIX)
|
|
||||||
list (APPEND DAEMON_SRC "${DAEMON_SRC_DIR}/UnixDaemon.cpp")
|
|
||||||
if (NOT (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD" OR APPLE))
|
|
||||||
# "'sleep_for' is not a member of 'std::this_thread'" in gcc 4.7/4.8
|
# "'sleep_for' is not a member of 'std::this_thread'" in gcc 4.7/4.8
|
||||||
add_definitions( "-D_GLIBCXX_USE_NANOSLEEP=1" )
|
add_definitions("-D_GLIBCXX_USE_NANOSLEEP=1")
|
||||||
endif ()
|
|
||||||
elseif (WIN32 OR MSYS)
|
|
||||||
list (APPEND DAEMON_SRC "${CMAKE_SOURCE_DIR}/Win32/DaemonWin32.cpp")
|
|
||||||
if (WITH_GUI)
|
|
||||||
list (APPEND DAEMON_SRC "${CMAKE_SOURCE_DIR}/Win32/Win32App.cpp")
|
|
||||||
set_source_files_properties("${CMAKE_SOURCE_DIR}/Win32/DaemonWin32.cpp"
|
|
||||||
PROPERTIES COMPILE_DEFINITIONS WIN32_APP)
|
|
||||||
endif ()
|
|
||||||
list (APPEND DAEMON_SRC "${CMAKE_SOURCE_DIR}/Win32/Win32Service.cpp")
|
|
||||||
list (APPEND DAEMON_SRC "${CMAKE_SOURCE_DIR}/Win32/Resource.rc")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
if (WITH_AESNI)
|
|
||||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes" )
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (WITH_AVX)
|
|
||||||
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx" )
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (WITH_ADDRSANITIZER)
|
|
||||||
if (NOT MSVC)
|
|
||||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer" )
|
|
||||||
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address" )
|
|
||||||
else ()
|
|
||||||
message( SEND_ERROR "MSVC does not support address sanitizer option")
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (WITH_THREADSANITIZER)
|
# Note: AES-NI and AVX is available on x86-based CPU's.
|
||||||
if (WITH_ADDRSANITIZER)
|
# Here also ARM64 implementation, but currently we don't support it.
|
||||||
message( FATAL_ERROR "thread sanitizer option cannot be combined with address sanitizer")
|
if(WITH_AESNI AND (ARCHITECTURE MATCHES "x86_64" OR ARCHITECTURE MATCHES "i386"))
|
||||||
elseif (NOT MSVC)
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes")
|
||||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread" )
|
add_definitions(-D__AES__)
|
||||||
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread" )
|
endif()
|
||||||
else ()
|
|
||||||
message( SEND_ERROR "MSVC does not support address sanitizer option")
|
if(WITH_ADDRSANITIZER)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(WITH_THREADSANITIZER)
|
||||||
|
if(WITH_ADDRSANITIZER)
|
||||||
|
message(FATAL_ERROR "thread sanitizer option cannot be combined with address sanitizer")
|
||||||
|
else()
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread")
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -267,141 +214,87 @@ endif()
|
|||||||
# TODO: once CMake 3.1+ becomes mainstream, see e.g. http://stackoverflow.com/a/29871891/673826
|
# TODO: once CMake 3.1+ becomes mainstream, see e.g. http://stackoverflow.com/a/29871891/673826
|
||||||
# use imported Threads::Threads instead
|
# use imported Threads::Threads instead
|
||||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||||
if (IOS)
|
if(IOS)
|
||||||
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
|
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
|
||||||
set(CMAKE_HAVE_THREADS_LIBRARY 1)
|
set(CMAKE_HAVE_THREADS_LIBRARY 1)
|
||||||
set(CMAKE_USE_WIN32_THREADS_INIT 0)
|
set(CMAKE_USE_WIN32_THREADS_INIT 0)
|
||||||
set(CMAKE_USE_PTHREADS_INIT 1)
|
set(CMAKE_USE_PTHREADS_INIT 1)
|
||||||
else()
|
else()
|
||||||
find_package ( Threads REQUIRED )
|
find_package(Threads REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
if(THREADS_HAVE_PTHREAD_ARG) # compile time flag
|
if(THREADS_HAVE_PTHREAD_ARG) # compile time flag
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (WITH_STATIC)
|
if(WITH_STATIC)
|
||||||
set(Boost_USE_STATIC_LIBS ON)
|
set(Boost_USE_STATIC_LIBS ON)
|
||||||
set(Boost_USE_STATIC_RUNTIME ON)
|
set(Boost_USE_STATIC_RUNTIME ON)
|
||||||
if (WIN32 AND NOT MSYS AND NOT MINGW)
|
|
||||||
# http://www.cmake.org/Wiki/CMake_FAQ#Dynamic_Replace
|
|
||||||
foreach(flag_var
|
|
||||||
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
|
||||||
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
|
||||||
if(${flag_var} MATCHES "/MD")
|
|
||||||
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
|
|
||||||
endif(${flag_var} MATCHES "/MD")
|
|
||||||
endforeach(flag_var)
|
|
||||||
else ()
|
|
||||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
|
|
||||||
endif ()
|
|
||||||
set(BUILD_SHARED_LIBS OFF)
|
set(BUILD_SHARED_LIBS OFF)
|
||||||
if (${CMAKE_CXX_COMPILER} MATCHES ".*-openwrt-.*")
|
if(${CMAKE_CXX_COMPILER} MATCHES ".*-openwrt-.*")
|
||||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread" )
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
|
||||||
# set( CMAKE_THREAD_LIBS_INIT "gcc_eh -Wl,--whole-archive -lpthread -Wl,--no-whole-archive" )
|
# set(CMAKE_THREAD_LIBS_INIT "gcc_eh -Wl,--whole-archive -lpthread -Wl,--no-whole-archive")
|
||||||
set( CMAKE_THREAD_LIBS_INIT "gcc_eh -Wl,-u,pthread_create,-u,pthread_once,-u,pthread_mutex_lock,-u,pthread_mutex_unlock,-u,pthread_join,-u,pthread_equal,-u,pthread_detach,-u,pthread_cond_wait,-u,pthread_cond_signal,-u,pthread_cond_destroy,-u,pthread_cond_broadcast,-u,pthread_cancel" )
|
set(CMAKE_THREAD_LIBS_INIT "gcc_eh -Wl,-u,pthread_create,-u,pthread_once,-u,pthread_mutex_lock,-u,pthread_mutex_unlock,-u,pthread_join,-u,pthread_equal,-u,pthread_detach,-u,pthread_cond_wait,-u,pthread_cond_signal,-u,pthread_cond_destroy,-u,pthread_cond_broadcast,-u,pthread_cancel")
|
||||||
endif ()
|
endif()
|
||||||
else()
|
else()
|
||||||
if (NOT WIN32 AND NOT MSYS)
|
# TODO: Consider separate compilation for LIBI2PD_SRC for library.
|
||||||
# TODO: Consider separate compilation for LIBI2PD_SRC for library.
|
# No need in -fPIC overhead for binary if not interested in library
|
||||||
# No need in -fPIC overhead for binary if not interested in library
|
# HINT: revert c266cff CMakeLists.txt: compilation speed up
|
||||||
# HINT: revert c266cff CMakeLists.txt: compilation speed up
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
||||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC" )
|
|
||||||
endif ()
|
|
||||||
add_definitions(-DBOOST_SYSTEM_DYN_LINK -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_DATE_TIME_DYN_LINK -DBOOST_REGEX_DYN_LINK)
|
add_definitions(-DBOOST_SYSTEM_DYN_LINK -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_DATE_TIME_DYN_LINK -DBOOST_REGEX_DYN_LINK)
|
||||||
endif ()
|
endif()
|
||||||
|
|
||||||
if (WITH_PCH)
|
if(WITH_PCH)
|
||||||
include_directories(BEFORE ${CMAKE_BINARY_DIR})
|
include_directories(BEFORE ${CMAKE_BINARY_DIR})
|
||||||
add_library(stdafx STATIC "${LIBI2PD_SRC_DIR}/stdafx.cpp")
|
add_library(stdafx STATIC "${LIBI2PD_SRC_DIR}/stdafx.cpp")
|
||||||
if(MSVC)
|
string(TOUPPER ${CMAKE_BUILD_TYPE} BTU)
|
||||||
target_compile_options(stdafx PRIVATE /Ycstdafx.h /Zm155)
|
get_directory_property(DEFS DEFINITIONS)
|
||||||
add_custom_command(TARGET stdafx POST_BUILD
|
string(REPLACE " " ";" FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BTU}} ${DEFS}")
|
||||||
COMMAND xcopy /y stdafx.dir\\$<CONFIG>\\*.pdb libi2pd.dir\\$<CONFIG>\\
|
add_custom_command(TARGET stdafx PRE_BUILD
|
||||||
COMMAND xcopy /y stdafx.dir\\$<CONFIG>\\*.pdb i2pdclient.dir\\$<CONFIG>\\
|
COMMAND ${CMAKE_CXX_COMPILER} ${FLAGS} -c ${CMAKE_CURRENT_SOURCE_DIR}/../libi2pd/stdafx.h -o ${CMAKE_BINARY_DIR}/stdafx.h.gch
|
||||||
COMMAND xcopy /y stdafx.dir\\$<CONFIG>\\*.pdb i2pd.dir\\$<CONFIG>\\
|
)
|
||||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
target_compile_options(libi2pd PRIVATE -include libi2pd/stdafx.h)
|
||||||
)
|
target_compile_options(libi2pdclient PRIVATE -include libi2pd/stdafx.h)
|
||||||
target_compile_options(libi2pd PRIVATE /FIstdafx.h /Yustdafx.h /Zm155 "/Fp${CMAKE_BINARY_DIR}/stdafx.dir/$<CONFIG>/stdafx.pch")
|
|
||||||
target_compile_options(libi2pdclient PRIVATE /FIstdafx.h /Yustdafx.h /Zm155 "/Fp${CMAKE_BINARY_DIR}/stdafx.dir/$<CONFIG>/stdafx.pch")
|
|
||||||
else()
|
|
||||||
string(TOUPPER ${CMAKE_BUILD_TYPE} BTU)
|
|
||||||
get_directory_property(DEFS DEFINITIONS)
|
|
||||||
string(REPLACE " " ";" FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BTU}} ${DEFS}")
|
|
||||||
add_custom_command(TARGET stdafx PRE_BUILD
|
|
||||||
COMMAND ${CMAKE_CXX_COMPILER} ${FLAGS} -c ${CMAKE_CURRENT_SOURCE_DIR}/../libi2pd/stdafx.h -o ${CMAKE_BINARY_DIR}/stdafx.h.gch
|
|
||||||
)
|
|
||||||
target_compile_options(libi2pd PRIVATE -include libi2pd/stdafx.h)
|
|
||||||
target_compile_options(libi2pdclient PRIVATE -include libi2pd/stdafx.h)
|
|
||||||
endif()
|
|
||||||
target_link_libraries(libi2pd stdafx)
|
target_link_libraries(libi2pd stdafx)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(libi2pdclient libi2pd)
|
target_link_libraries(libi2pdclient libi2pd)
|
||||||
|
|
||||||
find_package ( Boost COMPONENTS system filesystem program_options date_time REQUIRED )
|
find_package(Boost COMPONENTS system filesystem program_options date_time REQUIRED)
|
||||||
if(NOT DEFINED Boost_INCLUDE_DIRS)
|
if(NOT DEFINED Boost_INCLUDE_DIRS)
|
||||||
message(SEND_ERROR "Boost is not found, or your boost version was below 1.46. Please download Boost!")
|
message(SEND_ERROR "Boost is not found, or your boost version was below 1.46. Please download Boost!")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package ( OpenSSL REQUIRED )
|
find_package(OpenSSL REQUIRED)
|
||||||
if(NOT DEFINED OPENSSL_INCLUDE_DIR)
|
if(NOT DEFINED OPENSSL_INCLUDE_DIR)
|
||||||
message(SEND_ERROR "Could not find OpenSSL. Please download and install it first!")
|
message(SEND_ERROR "Could not find OpenSSL. Please download and install it first!")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (WITH_UPNP)
|
if(WITH_UPNP)
|
||||||
find_package ( MiniUPnPc REQUIRED )
|
find_package(MiniUPnPc REQUIRED)
|
||||||
include_directories( SYSTEM ${MINIUPNPC_INCLUDE_DIR} )
|
if(NOT MINIUPNPC_FOUND)
|
||||||
|
message(SEND_ERROR "Could not find MiniUPnPc. Please download and install it first!")
|
||||||
|
else()
|
||||||
|
include_directories(SYSTEM ${MINIUPNPC_INCLUDE_DIR})
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package ( ZLIB )
|
find_package(ZLIB)
|
||||||
if (NOT ZLIB_FOUND )
|
if(ZLIB_FOUND)
|
||||||
# We are probably on Windows
|
|
||||||
find_program( PATCH patch C:/Program Files/Git/usr/bin C:/msys64/usr/bin C:/msys32/usr/bin C:/Strawberry/c/bin )
|
|
||||||
include( ExternalProject )
|
|
||||||
if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
|
||||||
set( ZLIB_EXTRA -DAMD64=ON )
|
|
||||||
else()
|
|
||||||
set( ZLIB_EXTRA -DASM686=ON "-DCMAKE_ASM_MASM_FLAGS=/W0 /safeseh" )
|
|
||||||
endif()
|
|
||||||
ExternalProject_Add(zlib-project
|
|
||||||
URL http://zlib.net/zlib-1.2.8.tar.gz
|
|
||||||
URL_MD5 44d667c142d7cda120332623eab69f40
|
|
||||||
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/zlib
|
|
||||||
PATCH_COMMAND "${PATCH}" -p0 < ${CMAKE_CURRENT_SOURCE_DIR}/cmake-zlib-static.patch
|
|
||||||
&& "${PATCH}" -p0 < ${CMAKE_CURRENT_SOURCE_DIR}/cmake-zlib-amd64.patch
|
|
||||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
|
|
||||||
-DWITH_STATIC=${WITH_STATIC} ${ZLIB_EXTRA}
|
|
||||||
)
|
|
||||||
if (WITH_PCH)
|
|
||||||
add_dependencies( stdafx zlib-project )
|
|
||||||
else ()
|
|
||||||
add_dependencies( libi2pd zlib-project )
|
|
||||||
endif ()
|
|
||||||
# ExternalProject_Get_Property(zlib-project install_dir)
|
|
||||||
set ( ZLIB_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/zlib/include" CACHE FILEPATH "zlib include dir" FORCE)
|
|
||||||
if (NOT WITH_STATIC)
|
|
||||||
set ( ZLIB_LIBRARY debug zlibd optimized zlib CACHE STRING "zlib libraries" FORCE)
|
|
||||||
endif ()
|
|
||||||
link_directories(${CMAKE_CURRENT_BINARY_DIR}/zlib/lib)
|
|
||||||
else()
|
|
||||||
link_directories(${ZLIB_ROOT}/lib)
|
link_directories(${ZLIB_ROOT}/lib)
|
||||||
endif ()
|
endif()
|
||||||
if (WITH_STATIC AND (MSVC OR MSYS))
|
|
||||||
set ( ZLIB_LIBRARY debug zlibstaticd optimized zlibstatic CACHE STRING "zlib libraries" FORCE)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
# load includes
|
# load includes
|
||||||
include_directories( SYSTEM ${Boost_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
|
include_directories(SYSTEM ${Boost_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
|
||||||
|
|
||||||
|
|
||||||
# warn if for meshnet
|
# warn if for meshnet
|
||||||
if (WITH_MESHNET)
|
if(WITH_MESHNET)
|
||||||
message(STATUS "Building for testnet")
|
message(STATUS "Building for testnet")
|
||||||
message(WARNING "This build will NOT work on mainline i2p")
|
message(WARNING "This build will NOT work on mainline i2p")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(CheckAtomic)
|
if(NOT MSYS)
|
||||||
|
include(CheckAtomic)
|
||||||
|
endif()
|
||||||
|
|
||||||
# show summary
|
# show summary
|
||||||
message(STATUS "---------------------------------------")
|
message(STATUS "---------------------------------------")
|
||||||
@@ -413,7 +306,6 @@ message(STATUS "Architecture : ${ARCHITECTURE}")
|
|||||||
message(STATUS "Install prefix: : ${CMAKE_INSTALL_PREFIX}")
|
message(STATUS "Install prefix: : ${CMAKE_INSTALL_PREFIX}")
|
||||||
message(STATUS "Options:")
|
message(STATUS "Options:")
|
||||||
message(STATUS " AESNI : ${WITH_AESNI}")
|
message(STATUS " AESNI : ${WITH_AESNI}")
|
||||||
message(STATUS " AVX : ${WITH_AVX}")
|
|
||||||
message(STATUS " HARDENING : ${WITH_HARDENING}")
|
message(STATUS " HARDENING : ${WITH_HARDENING}")
|
||||||
message(STATUS " LIBRARY : ${WITH_LIBRARY}")
|
message(STATUS " LIBRARY : ${WITH_LIBRARY}")
|
||||||
message(STATUS " BINARY : ${WITH_BINARY}")
|
message(STATUS " BINARY : ${WITH_BINARY}")
|
||||||
@@ -423,39 +315,29 @@ message(STATUS " PCH : ${WITH_PCH}")
|
|||||||
message(STATUS " MESHNET : ${WITH_MESHNET}")
|
message(STATUS " MESHNET : ${WITH_MESHNET}")
|
||||||
message(STATUS " ADDRSANITIZER : ${WITH_ADDRSANITIZER}")
|
message(STATUS " ADDRSANITIZER : ${WITH_ADDRSANITIZER}")
|
||||||
message(STATUS " THREADSANITIZER : ${WITH_THREADSANITIZER}")
|
message(STATUS " THREADSANITIZER : ${WITH_THREADSANITIZER}")
|
||||||
message(STATUS " I2LUA : ${WITH_I2LUA}")
|
|
||||||
message(STATUS " WEBSOCKETS : ${WITH_WEBSOCKETS}")
|
|
||||||
message(STATUS "---------------------------------------")
|
message(STATUS "---------------------------------------")
|
||||||
|
|
||||||
#Handle paths nicely
|
#Handle paths nicely
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
if (WITH_BINARY)
|
if(WITH_BINARY)
|
||||||
add_executable ( "${PROJECT_NAME}" ${DAEMON_SRC} )
|
add_executable("${PROJECT_NAME}" ${DAEMON_SRC})
|
||||||
if (WIN32 AND WITH_GUI)
|
|
||||||
set_target_properties("${PROJECT_NAME}" PROPERTIES WIN32_EXECUTABLE TRUE )
|
if(WITH_STATIC)
|
||||||
endif()
|
set_target_properties("${PROJECT_NAME}" PROPERTIES LINK_FLAGS "-static")
|
||||||
if(NOT MSVC)
|
|
||||||
if (WITH_STATIC)
|
|
||||||
set_target_properties("${PROJECT_NAME}" PROPERTIES LINK_FLAGS "-static" )
|
|
||||||
endif ()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (WITH_PCH)
|
if(WITH_PCH)
|
||||||
if (MSVC)
|
target_compile_options("${PROJECT_NAME}" PRIVATE -include libi2pd/stdafx.h)
|
||||||
target_compile_options("${PROJECT_NAME}" PRIVATE /FIstdafx.h /Yustdafx.h /Zm155 "/Fp${CMAKE_BINARY_DIR}/stdafx.dir/$<CONFIG>/stdafx.pch")
|
|
||||||
else()
|
|
||||||
target_compile_options("${PROJECT_NAME}" PRIVATE -include libi2pd/stdafx.h)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (WITH_HARDENING AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT MSYS AND NOT MINGW)
|
if(WITH_HARDENING AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
set_target_properties("${PROJECT_NAME}" PROPERTIES LINK_FLAGS "-z relro -z now" )
|
set_target_properties("${PROJECT_NAME}" PROPERTIES LINK_FLAGS "-z relro -z now")
|
||||||
endif ()
|
endif()
|
||||||
|
|
||||||
if (WITH_UPNP)
|
if(WITH_UPNP)
|
||||||
target_link_libraries("${PROJECT_NAME}" "${MINIUPNPC_LIBRARY}")
|
set(UPNP_LIB ${MINIUPNPC_LIBRARY})
|
||||||
endif ()
|
endif()
|
||||||
|
|
||||||
# FindBoost pulls pthread for thread which is broken for static linking at least on Ubuntu 15.04
|
# FindBoost pulls pthread for thread which is broken for static linking at least on Ubuntu 15.04
|
||||||
list(GET Boost_LIBRARIES -1 LAST_Boost_LIBRARIES)
|
list(GET Boost_LIBRARIES -1 LAST_Boost_LIBRARIES)
|
||||||
@@ -463,127 +345,15 @@ if (WITH_BINARY)
|
|||||||
list(REMOVE_AT Boost_LIBRARIES -1)
|
list(REMOVE_AT Boost_LIBRARIES -1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (MSYS OR MINGW)
|
|
||||||
set (MINGW_EXTRA -lws2_32 -lmswsock -liphlpapi )
|
if(WITH_STATIC)
|
||||||
endif ()
|
|
||||||
if (WITH_STATIC)
|
|
||||||
set(DL_LIB ${CMAKE_DL_LIBS})
|
set(DL_LIB ${CMAKE_DL_LIBS})
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries( "${PROJECT_NAME}" libi2pd libi2pdclient ${DL_LIB} ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MINGW_EXTRA} ${DL_LIB} ${CMAKE_REQUIRED_LIBRARIES})
|
|
||||||
|
target_link_libraries(libi2pd ${Boost_LIBRARIES} ${ZLIB_LIBRARY})
|
||||||
|
target_link_libraries("${PROJECT_NAME}" libi2pd libi2pdclient ${DL_LIB} ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${UPNP_LIB} ${ZLIB_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MINGW_EXTRA} ${DL_LIB} ${CMAKE_REQUIRED_LIBRARIES})
|
||||||
|
|
||||||
install(TARGETS "${PROJECT_NAME}" RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Runtime)
|
install(TARGETS "${PROJECT_NAME}" RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Runtime)
|
||||||
set (APPS "\${CMAKE_INSTALL_PREFIX}/bin/${PROJECT_NAME}${CMAKE_EXECUTABLE_SUFFIX}")
|
set(APPS "\${CMAKE_INSTALL_PREFIX}/bin/${PROJECT_NAME}${CMAKE_EXECUTABLE_SUFFIX}")
|
||||||
set (DIRS "${Boost_LIBRARY_DIR};${OPENSSL_INCLUDE_DIR}/../bin;${ZLIB_INCLUDE_DIR}/../bin;/mingw32/bin")
|
set(DIRS "${Boost_LIBRARY_DIR};${OPENSSL_INCLUDE_DIR}/../bin;${ZLIB_INCLUDE_DIR}/../bin;/mingw32/bin")
|
||||||
if (MSVC)
|
|
||||||
install(FILES $<TARGET_PDB_FILE:${PROJECT_NAME}> DESTINATION ${CMAKE_INSTALL_BINDIR} CONFIGURATIONS DEBUG RELWITHDEBINFO COMPONENT Symbols)
|
|
||||||
# TODO Somehow this picks lots of unrelevant stuff with MSYS. OS X testing needed.
|
|
||||||
INSTALL(CODE "
|
|
||||||
include(BundleUtilities)
|
|
||||||
fixup_bundle(\"${APPS}\" \"\" \"${DIRS}\")
|
|
||||||
" COMPONENT Runtime)
|
|
||||||
endif ()
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
install(FILES ../LICENSE
|
|
||||||
DESTINATION .
|
|
||||||
COMPONENT Runtime
|
|
||||||
)
|
|
||||||
# Take a copy on Appveyor
|
|
||||||
install(FILES "C:/projects/openssl-$ENV{OPENSSL}/LICENSE"
|
|
||||||
DESTINATION .
|
|
||||||
COMPONENT Runtime
|
|
||||||
RENAME LICENSE_OPENSSL
|
|
||||||
OPTIONAL # for local builds only!
|
|
||||||
)
|
|
||||||
|
|
||||||
file(GLOB_RECURSE I2PD_SOURCES "../libi2pd/*.cpp" "../libi2pd_client/*.cpp" "../daemon/*.cpp" "../build" "../Win32" "../Makefile*")
|
|
||||||
install(FILES ${I2PD_SOURCES} DESTINATION src/ COMPONENT Source)
|
|
||||||
# install(DIRECTORY ../ DESTINATION src/
|
|
||||||
# # OPTIONAL
|
|
||||||
# COMPONENT Source FILES_MATCHING
|
|
||||||
# PATTERN .git EXCLUDE
|
|
||||||
# PATTERN "*.cpp"
|
|
||||||
# )
|
|
||||||
|
|
||||||
file(GLOB I2PD_HEADERS "../libi2pd/*.h" "../libi2pd_client/*.h" "../daemon/*.h")
|
|
||||||
install(FILES ${I2PD_HEADERS} DESTINATION src/ COMPONENT Headers)
|
|
||||||
# install(DIRECTORY ../ DESTINATION src/
|
|
||||||
# # OPTIONAL
|
|
||||||
# COMPONENT Headers FILES_MATCHING
|
|
||||||
# PATTERN .git EXCLUDE
|
|
||||||
# PATTERN "*.h"
|
|
||||||
# )
|
|
||||||
|
|
||||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Purple I2P, a C++ I2P daemon")
|
|
||||||
set(CPACK_PACKAGE_VENDOR "Purple I2P")
|
|
||||||
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/../README.md")
|
|
||||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/../LICENSE")
|
|
||||||
file(READ ../libi2pd/version.h version_h)
|
|
||||||
string(REGEX REPLACE ".*I2PD_VERSION_MAJOR ([0-9]+).*" "\\1" CPACK_PACKAGE_VERSION_MAJOR "${version_h}")
|
|
||||||
string(REGEX REPLACE ".*I2PD_VERSION_MINOR ([0-9]+).*" "\\1" CPACK_PACKAGE_VERSION_MINOR "${version_h}")
|
|
||||||
string(REGEX REPLACE ".*I2PD_VERSION_MICRO ([0-9]+).*" "\\1" CPACK_PACKAGE_VERSION_MICRO "${version_h}")
|
|
||||||
string(REGEX REPLACE ".*I2PD_VERSION_PATCH ([0-9]+).*" "\\1" CPACK_PACKAGE_VERSION_PATCH "${version_h}")
|
|
||||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "Purple I2P")# ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
|
|
||||||
include(CPackComponent)
|
|
||||||
cpack_add_component(Runtime
|
|
||||||
DESCRIPTION "Main files"
|
|
||||||
REQUIRED INSTALL_TYPES minimal)
|
|
||||||
cpack_add_component(Symbols
|
|
||||||
DISPLAY_NAME "Debug symbols"
|
|
||||||
DESCRIPTION "Debug symbols for use with WinDbg or Visual Studio"
|
|
||||||
INSTALL_TYPES recommended full
|
|
||||||
)
|
|
||||||
cpack_add_component(Libraries
|
|
||||||
DESCRIPTION "Binary libraries for development"
|
|
||||||
INSTALL_TYPES full dev3rd
|
|
||||||
)
|
|
||||||
cpack_add_component(Source
|
|
||||||
DISPLAY_NAME "Source code"
|
|
||||||
DESCRIPTION "I2pd source code"
|
|
||||||
INSTALL_TYPES full
|
|
||||||
)
|
|
||||||
cpack_add_component(Headers
|
|
||||||
DISPLAY_NAME "Header files"
|
|
||||||
DESCRIPTION "I2pd header files for development"
|
|
||||||
INSTALL_TYPES full dev3rd
|
|
||||||
)
|
|
||||||
install(FILES ${MINIUPNPC_INCLUDE_DIR}/miniupnpc/miniupnpc.dll
|
|
||||||
DESTINATION bin
|
|
||||||
COMPONENT MiniUPnPc
|
|
||||||
OPTIONAL
|
|
||||||
)
|
|
||||||
install(FILES ${MINIUPNPC_INCLUDE_DIR}/miniupnpc/LICENSE
|
|
||||||
DESTINATION .
|
|
||||||
COMPONENT MiniUPnPc
|
|
||||||
RENAME LICENSE_MINIUPNPC
|
|
||||||
OPTIONAL
|
|
||||||
)
|
|
||||||
cpack_add_component(MiniUPnPc
|
|
||||||
INSTALL_TYPES full recommended
|
|
||||||
# DOWNLOADED
|
|
||||||
# ARCHIVE_FILE miniupnpc-win32.zip
|
|
||||||
)
|
|
||||||
cpack_add_install_type(recommended DISPLAY_NAME Recommended)
|
|
||||||
cpack_add_install_type(dev3rd DISPLAY_NAME "Third party development")
|
|
||||||
cpack_add_install_type(full DISPLAY_NAME Full)
|
|
||||||
cpack_add_install_type(minimal DISPLAY_NAME Minimal)
|
|
||||||
if((WIN32 OR MSYS) AND NOT UNIX)
|
|
||||||
# There is a bug in NSI that does not handle full unix paths properly. Make
|
|
||||||
# sure there is at least one set of four (4) backlasshes.
|
|
||||||
set(CPACK_NSIS_DEFINES "RequestExecutionLevel user")
|
|
||||||
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/../Win32\\\\mask.bmp")
|
|
||||||
set(CPACK_NSIS_INSTALLED_ICON_NAME "bin/i2pd.exe")
|
|
||||||
SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}")
|
|
||||||
set(CPACK_NSIS_HELP_LINK "https:\\\\\\\\github.com\\\\PurpleI2P\\\\i2pd\\\\issues")
|
|
||||||
set(CPACK_NSIS_URL_INFO_ABOUT "https:\\\\\\\\github.com\\\\PurpleI2P\\\\i2pd")
|
|
||||||
set(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Install i2pd as windows service.lnk' '$INSTDIR\\\\bin\\\\i2pd.exe' '--service=install'
|
|
||||||
CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Remove i2pd windows service.lnk' '$INSTDIR\\\\bin\\\\i2pd.exe' '--service=remove'")
|
|
||||||
set(CPACK_NSIS_DELETE_ICONS_EXTRA "Delete '$SMPROGRAMS\\\\$START_MENU\\\\Install i2pd as windows service.lnk'
|
|
||||||
Delete '$SMPROGRAMS\\\\$START_MENU\\\\Remove i2pd windows service.lnk'")
|
|
||||||
else()
|
|
||||||
set(CPACK_STRIP_FILES "bin/i2pd")
|
|
||||||
set(CPACK_SOURCE_STRIP_FILES "")
|
|
||||||
endif()
|
endif()
|
||||||
set(CPACK_PACKAGE_EXECUTABLES "i2pd" "C++ I2P daemon")
|
|
||||||
set(CPACK_SOURCE_GENERATOR "TGZ")
|
|
||||||
include(CPack)
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
setlocal enableextensions enabledelayedexpansion
|
setlocal enableextensions enabledelayedexpansion
|
||||||
title Building i2pd
|
title Building i2pd
|
||||||
|
|
||||||
REM Copyright (c) 2013-2017, The PurpleI2P Project
|
REM Copyright (c) 2013-2020, The PurpleI2P Project
|
||||||
REM This file is part of Purple i2pd project and licensed under BSD3
|
REM This file is part of Purple i2pd project and licensed under BSD3
|
||||||
REM See full license text in LICENSE file at top of project tree
|
REM See full license text in LICENSE file at top of project tree
|
||||||
|
|
||||||
@@ -21,17 +21,19 @@ set MSYSTEM=MINGW32
|
|||||||
|
|
||||||
set "xSH=%WD%bash -lc"
|
set "xSH=%WD%bash -lc"
|
||||||
|
|
||||||
REM detecting number of processors and subtract 1.
|
set "FILELIST=i2pd.exe README.txt contrib/i2pd.conf contrib/tunnels.conf contrib/certificates contrib/tunnels.d"
|
||||||
set /a threads=%NUMBER_OF_PROCESSORS%-1
|
|
||||||
|
REM detecting number of processors
|
||||||
|
set /a threads=%NUMBER_OF_PROCESSORS%
|
||||||
|
|
||||||
REM we must work in root of repo
|
REM we must work in root of repo
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
REM deleting old log files
|
REM deleting old log files
|
||||||
del /S build_*.log >> nul
|
del /S build_*.log >> nul 2>&1
|
||||||
|
|
||||||
echo Receiving latest commit and cleaning up...
|
echo Receiving latest commit and cleaning up...
|
||||||
%xSH% "git pull && make clean" > build/build_git.log 2>&1
|
%xSH% "git checkout contrib/* && git pull && make clean" > build\build.log 2>&1
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
REM set to variable current commit hash
|
REM set to variable current commit hash
|
||||||
@@ -41,18 +43,30 @@ FOR /F "usebackq" %%a IN (`%xSH% 'git describe --tags'`) DO (
|
|||||||
|
|
||||||
%xSH% "echo To use configs and certificates, move all files and certificates folder from contrib directory here. > README.txt" >> nul
|
%xSH% "echo To use configs and certificates, move all files and certificates folder from contrib directory here. > README.txt" >> nul
|
||||||
|
|
||||||
|
REM converting configuration files to DOS format (usable in default notepad)
|
||||||
|
%xSH% "unix2dos contrib/i2pd.conf contrib/tunnels.conf contrib/tunnels.d/*" >> build\build.log 2>&1
|
||||||
|
|
||||||
REM starting building
|
REM starting building
|
||||||
set MSYSTEM=MINGW32
|
set MSYSTEM=MINGW32
|
||||||
set bitness=32
|
set bitness=32
|
||||||
call :BUILDING
|
call :BUILDING
|
||||||
echo.
|
|
||||||
|
|
||||||
set MSYSTEM=MINGW64
|
set MSYSTEM=MINGW64
|
||||||
set bitness=64
|
set bitness=64
|
||||||
call :BUILDING
|
call :BUILDING
|
||||||
|
|
||||||
|
REM building for WinXP
|
||||||
|
set "WD=C:\msys64-xp\usr\bin\"
|
||||||
|
set MSYSTEM=MINGW32
|
||||||
|
set bitness=32
|
||||||
|
set "xSH=%WD%bash -lc"
|
||||||
|
call :BUILDING_XP
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
del README.txt >> nul
|
REM compile installer
|
||||||
|
C:\PROGRA~2\INNOSE~1\ISCC.exe /dI2Pd_TextVer="%tag%" /dI2Pd_Ver="%tag%.0" build\win_installer.iss >> build\build.log 2>&1
|
||||||
|
|
||||||
|
del README.txt i2pd_x32.exe i2pd_x64.exe i2pd_xp.exe >> nul
|
||||||
|
|
||||||
echo Build complete...
|
echo Build complete...
|
||||||
pause
|
pause
|
||||||
@@ -60,14 +74,13 @@ exit /b 0
|
|||||||
|
|
||||||
:BUILDING
|
:BUILDING
|
||||||
%xSH% "make clean" >> nul
|
%xSH% "make clean" >> nul
|
||||||
echo Building i2pd %tag% for win%bitness%:
|
echo Building i2pd %tag% for win%bitness%
|
||||||
echo Build AVX+AESNI...
|
%xSH% "make DEBUG=no USE_UPNP=yes -j%threads% && cp i2pd.exe i2pd_x%bitness%.exe && zip -r9 build/i2pd_%tag%_win%bitness%_mingw.zip %FILELIST% && make clean" > build\build_win%bitness%_%tag%.log 2>&1
|
||||||
%xSH% "make DEBUG=no USE_UPNP=yes USE_AVX=1 USE_AESNI=1 -j%threads% && zip -r9 build/i2pd_%tag%_win%bitness%_mingw_avx_aesni.zip i2pd.exe README.txt contrib/i2pd.conf contrib/tunnels.conf contrib/certificates && make clean" > build/build_win%bitness%_avx_aesni.log 2>&1
|
goto EOF
|
||||||
echo Build AVX...
|
|
||||||
%xSH% "make DEBUG=no USE_UPNP=yes USE_AVX=1 -j%threads% && zip -r9 build/i2pd_%tag%_win%bitness%_mingw_avx.zip i2pd.exe README.txt contrib/i2pd.conf contrib/tunnels.conf contrib/certificates && make clean" > build/build_win%bitness%_avx.log 2>&1
|
:BUILDING_XP
|
||||||
echo Build AESNI...
|
%xSH% "make clean" >> nul
|
||||||
%xSH% "make DEBUG=no USE_UPNP=yes USE_AESNI=1 -j%threads% && zip -r9 build/i2pd_%tag%_win%bitness%_mingw_aesni.zip i2pd.exe README.txt contrib/i2pd.conf contrib/tunnels.conf contrib/certificates && make clean" > build/build_win%bitness%_aesni.log 2>&1
|
echo Building i2pd %tag% for winxp
|
||||||
echo Build without extensions...
|
%xSH% "make DEBUG=no USE_UPNP=yes USE_WINXP_FLAGS=yes -j%threads% && cp i2pd.exe i2pd_xp.exe && zip -r9 build/i2pd_%tag%_winxp_mingw.zip %FILELIST% && make clean" > build\build_winxp_%tag%.log 2>&1
|
||||||
%xSH% "make DEBUG=no USE_UPNP=yes -j%threads% && zip -r9 build/i2pd_%tag%_win%bitness%_mingw.zip i2pd.exe README.txt contrib/i2pd.conf contrib/tunnels.conf contrib/certificates && make clean" > build/build_win%bitness%.log 2>&1
|
|
||||||
|
|
||||||
:EOF
|
:EOF
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
--- CMakeLists.txt.orig 2015-12-07 14:19:36.447689600 -0600
|
|
||||||
+++ CMakeLists.txt 2015-12-07 14:18:23.004419900 -0600
|
|
||||||
@@ -165,6 +165,7 @@
|
|
||||||
ENABLE_LANGUAGE(ASM_MASM)
|
|
||||||
set(ZLIB_ASMS
|
|
||||||
contrib/masmx64/gvmat64.asm
|
|
||||||
+ contrib/masmx64/inffas8664.c
|
|
||||||
contrib/masmx64/inffasx64.asm
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
--- CMakeLists.txt.orig 2013-04-28 17:57:10.000000000 -0500
|
|
||||||
+++ CMakeLists.txt 2015-12-03 12:53:52.371087900 -0600
|
|
||||||
@@ -7,6 +7,7 @@
|
|
||||||
|
|
||||||
option(ASM686 "Enable building i686 assembly implementation")
|
|
||||||
option(AMD64 "Enable building amd64 assembly implementation")
|
|
||||||
+option(WITH_STATIC "Static runtime on Windows" OFF)
|
|
||||||
|
|
||||||
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
|
|
||||||
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
|
|
||||||
@@ -66,6 +67,17 @@
|
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
+if(WITH_STATIC AND (MSVC OR MSYS))
|
|
||||||
+ # http://www.cmake.org/Wiki/CMake_FAQ#Dynamic_Replace
|
|
||||||
+ foreach(flag_var
|
|
||||||
+ CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
|
||||||
+ CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
|
|
||||||
+ if(${flag_var} MATCHES "/MD")
|
|
||||||
+ string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
|
|
||||||
+ endif(${flag_var} MATCHES "/MD")
|
|
||||||
+ endforeach(flag_var)
|
|
||||||
+endif()
|
|
||||||
+
|
|
||||||
if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
|
|
||||||
# If we're doing an out of source build and the user has a zconf.h
|
|
||||||
# in their source tree...
|
|
||||||
@@ -1,37 +1,52 @@
|
|||||||
#define I2Pd_AppName "i2pd"
|
#define I2Pd_AppName "i2pd"
|
||||||
#define I2Pd_ver "2.21.1"
|
|
||||||
#define I2Pd_Publisher "PurpleI2P"
|
#define I2Pd_Publisher "PurpleI2P"
|
||||||
|
; Get application version from compiled binary
|
||||||
|
; Disabled to use definition from command line
|
||||||
|
;#define I2Pd_ver GetFileVersionString(AddBackslash(SourcePath) + "..\i2pd_x64.exe")
|
||||||
|
|
||||||
[Setup]
|
[Setup]
|
||||||
AppName={#I2Pd_AppName}
|
AppName={#I2Pd_AppName}
|
||||||
AppVersion={#I2Pd_ver}
|
AppVersion={#I2Pd_TextVer}
|
||||||
AppPublisher={#I2Pd_Publisher}
|
AppPublisher={#I2Pd_Publisher}
|
||||||
|
|
||||||
DefaultDirName={pf}\I2Pd
|
DefaultDirName={pf}\I2Pd
|
||||||
DefaultGroupName=I2Pd
|
DefaultGroupName=I2Pd
|
||||||
UninstallDisplayIcon={app}\I2Pd.exe
|
UninstallDisplayIcon={app}\I2Pd.exe
|
||||||
OutputDir=.
|
OutputDir=.
|
||||||
LicenseFile=../LICENSE
|
OutputBaseFilename=setup_{#I2Pd_AppName}_v{#I2Pd_TextVer}
|
||||||
OutputBaseFilename=setup_{#I2Pd_AppName}_v{#I2Pd_ver}
|
|
||||||
SetupIconFile=mask.ico
|
LicenseFile=..\LICENSE
|
||||||
|
SetupIconFile=..\Win32\mask.ico
|
||||||
|
|
||||||
InternalCompressLevel=ultra64
|
InternalCompressLevel=ultra64
|
||||||
Compression=lzma/ultra64
|
Compression=lzma/ultra64
|
||||||
SolidCompression=true
|
SolidCompression=true
|
||||||
|
|
||||||
ArchitecturesInstallIn64BitMode=x64
|
ArchitecturesInstallIn64BitMode=x64
|
||||||
AppVerName={#I2Pd_AppName}
|
|
||||||
ExtraDiskSpaceRequired=15
|
ExtraDiskSpaceRequired=15
|
||||||
|
|
||||||
AppID={{621A23E0-3CF4-4BD6-97BC-4835EA5206A2}
|
AppID={{621A23E0-3CF4-4BD6-97BC-4835EA5206A2}
|
||||||
|
AppVerName={#I2Pd_AppName}
|
||||||
|
AppCopyright=Copyright (c) 2013-2020, The PurpleI2P Project
|
||||||
AppPublisherURL=http://i2pd.website/
|
AppPublisherURL=http://i2pd.website/
|
||||||
AppSupportURL=https://github.com/PurpleI2P/i2pd/issues
|
AppSupportURL=https://github.com/PurpleI2P/i2pd/issues
|
||||||
AppUpdatesURL=https://github.com/PurpleI2P/i2pd/releases
|
AppUpdatesURL=https://github.com/PurpleI2P/i2pd/releases
|
||||||
|
|
||||||
|
VersionInfoProductVersion={#I2Pd_Ver}
|
||||||
|
VersionInfoVersion={#I2Pd_Ver}
|
||||||
|
|
||||||
|
CloseApplications=yes
|
||||||
|
|
||||||
[Files]
|
[Files]
|
||||||
Source: ..\i2pd_x86.exe; DestDir: {app}; DestName: i2pd.exe; Flags: ignoreversion; Check: not IsWin64
|
Source: ..\i2pd_x32.exe; DestDir: {app}; DestName: i2pd.exe; Flags: ignoreversion; Check: not IsWin64; MinVersion: 6.0
|
||||||
Source: ..\i2pd_x64.exe; DestDir: {app}; DestName: i2pd.exe; Flags: ignoreversion; Check: IsWin64
|
Source: ..\i2pd_x64.exe; DestDir: {app}; DestName: i2pd.exe; Flags: ignoreversion; Check: IsWin64; MinVersion: 6.0
|
||||||
|
Source: ..\i2pd_xp.exe; DestDir: {app}; DestName: i2pd.exe; Flags: ignoreversion; Check: IsWin64; OnlyBelowVersion: 6.0
|
||||||
Source: ..\README.md; DestDir: {app}; DestName: Readme.txt; Flags: onlyifdoesntexist
|
Source: ..\README.md; DestDir: {app}; DestName: Readme.txt; Flags: onlyifdoesntexist
|
||||||
Source: ..\contrib\i2pd.conf; DestDir: {userappdata}\i2pd; Flags: onlyifdoesntexist
|
Source: ..\contrib\i2pd.conf; DestDir: {userappdata}\i2pd; Flags: onlyifdoesntexist
|
||||||
Source: ..\contrib\subscriptions.txt; DestDir: {userappdata}\i2pd; Flags: onlyifdoesntexist
|
Source: ..\contrib\subscriptions.txt; DestDir: {userappdata}\i2pd; Flags: onlyifdoesntexist
|
||||||
Source: ..\contrib\tunnels.conf; DestDir: {userappdata}\i2pd; Flags: onlyifdoesntexist
|
Source: ..\contrib\tunnels.conf; DestDir: {userappdata}\i2pd; Flags: onlyifdoesntexist
|
||||||
Source: ..\contrib\certificates\*; DestDir: {userappdata}\i2pd\certificates; Flags: onlyifdoesntexist recursesubdirs createallsubdirs
|
Source: ..\contrib\certificates\*; DestDir: {userappdata}\i2pd\certificates; Flags: onlyifdoesntexist recursesubdirs createallsubdirs
|
||||||
|
Source: ..\contrib\tunnels.d\*; DestDir: {userappdata}\i2pd\tunnels.d; Flags: onlyifdoesntexist recursesubdirs createallsubdirs
|
||||||
|
|
||||||
[Icons]
|
[Icons]
|
||||||
Name: {group}\I2Pd; Filename: {app}\i2pd.exe
|
Name: {group}\I2Pd; Filename: {app}\i2pd.exe
|
||||||
24
android_binary_only/jni/Android.mk → contrib/android_binary_only/jni/Android.mk
Executable file → Normal file
24
android_binary_only/jni/Android.mk → contrib/android_binary_only/jni/Android.mk
Executable file → Normal file
@@ -26,43 +26,43 @@ include $(BUILD_EXECUTABLE)
|
|||||||
LOCAL_PATH := $(call my-dir)
|
LOCAL_PATH := $(call my-dir)
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
LOCAL_MODULE := boost_system
|
LOCAL_MODULE := boost_system
|
||||||
LOCAL_SRC_FILES := $(BOOST_PATH)/boost_1_64_0/$(TARGET_ARCH_ABI)/lib/libboost_system.a
|
LOCAL_SRC_FILES := $(BOOST_PATH)/boost-1_72_0/$(TARGET_ARCH_ABI)/lib/libboost_system.a
|
||||||
LOCAL_EXPORT_C_INCLUDES := $(BOOST_PATH)/boost_1_64_0/include
|
LOCAL_EXPORT_C_INCLUDES := $(BOOST_PATH)/boost-1_72_0/include
|
||||||
include $(PREBUILT_STATIC_LIBRARY)
|
include $(PREBUILT_STATIC_LIBRARY)
|
||||||
|
|
||||||
LOCAL_PATH := $(call my-dir)
|
LOCAL_PATH := $(call my-dir)
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
LOCAL_MODULE := boost_date_time
|
LOCAL_MODULE := boost_date_time
|
||||||
LOCAL_SRC_FILES := $(BOOST_PATH)/boost_1_64_0/$(TARGET_ARCH_ABI)/lib/libboost_date_time.a
|
LOCAL_SRC_FILES := $(BOOST_PATH)/boost-1_72_0/$(TARGET_ARCH_ABI)/lib/libboost_date_time.a
|
||||||
LOCAL_EXPORT_C_INCLUDES := $(BOOST_PATH)/boost_1_64_0/include
|
LOCAL_EXPORT_C_INCLUDES := $(BOOST_PATH)/boost-1_72_0/include
|
||||||
include $(PREBUILT_STATIC_LIBRARY)
|
include $(PREBUILT_STATIC_LIBRARY)
|
||||||
|
|
||||||
LOCAL_PATH := $(call my-dir)
|
LOCAL_PATH := $(call my-dir)
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
LOCAL_MODULE := boost_filesystem
|
LOCAL_MODULE := boost_filesystem
|
||||||
LOCAL_SRC_FILES := $(BOOST_PATH)/boost_1_64_0/$(TARGET_ARCH_ABI)/lib/libboost_filesystem.a
|
LOCAL_SRC_FILES := $(BOOST_PATH)/boost-1_72_0/$(TARGET_ARCH_ABI)/lib/libboost_filesystem.a
|
||||||
LOCAL_EXPORT_C_INCLUDES := $(BOOST_PATH)/boost_1_64_0/include
|
LOCAL_EXPORT_C_INCLUDES := $(BOOST_PATH)/boost-1_72_0/include
|
||||||
include $(PREBUILT_STATIC_LIBRARY)
|
include $(PREBUILT_STATIC_LIBRARY)
|
||||||
|
|
||||||
LOCAL_PATH := $(call my-dir)
|
LOCAL_PATH := $(call my-dir)
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
LOCAL_MODULE := boost_program_options
|
LOCAL_MODULE := boost_program_options
|
||||||
LOCAL_SRC_FILES := $(BOOST_PATH)/boost_1_64_0/$(TARGET_ARCH_ABI)/lib/libboost_program_options.a
|
LOCAL_SRC_FILES := $(BOOST_PATH)/boost-1_72_0/$(TARGET_ARCH_ABI)/lib/libboost_program_options.a
|
||||||
LOCAL_EXPORT_C_INCLUDES := $(BOOST_PATH)/boost_1_64_0/include
|
LOCAL_EXPORT_C_INCLUDES := $(BOOST_PATH)/boost-1_72_0/include
|
||||||
include $(PREBUILT_STATIC_LIBRARY)
|
include $(PREBUILT_STATIC_LIBRARY)
|
||||||
|
|
||||||
LOCAL_PATH := $(call my-dir)
|
LOCAL_PATH := $(call my-dir)
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
LOCAL_MODULE := crypto
|
LOCAL_MODULE := crypto
|
||||||
LOCAL_SRC_FILES := $(OPENSSL_PATH)/openssl-1.1.1/$(TARGET_ARCH_ABI)/lib/libcrypto.a
|
LOCAL_SRC_FILES := $(OPENSSL_PATH)/openssl-1.1.1a-clang/$(TARGET_ARCH_ABI)/lib/libcrypto.a
|
||||||
LOCAL_EXPORT_C_INCLUDES := $(OPENSSL_PATH)/openssl-1.1.1/include
|
LOCAL_EXPORT_C_INCLUDES := $(OPENSSL_PATH)/openssl-1.1.1a-clang/include
|
||||||
include $(PREBUILT_STATIC_LIBRARY)
|
include $(PREBUILT_STATIC_LIBRARY)
|
||||||
|
|
||||||
LOCAL_PATH := $(call my-dir)
|
LOCAL_PATH := $(call my-dir)
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
LOCAL_MODULE := ssl
|
LOCAL_MODULE := ssl
|
||||||
LOCAL_SRC_FILES := $(OPENSSL_PATH)/openssl-1.1.1/$(TARGET_ARCH_ABI)/lib/libssl.a
|
LOCAL_SRC_FILES := $(OPENSSL_PATH)/openssl-1.1.1a-clang/$(TARGET_ARCH_ABI)/lib/libssl.a
|
||||||
LOCAL_EXPORT_C_INCLUDES := $(OPENSSL_PATH)/openssl-1.1.1/include
|
LOCAL_EXPORT_C_INCLUDES := $(OPENSSL_PATH)/openssl-1.1.1a-clang/include
|
||||||
LOCAL_STATIC_LIBRARIES := crypto
|
LOCAL_STATIC_LIBRARIES := crypto
|
||||||
include $(PREBUILT_STATIC_LIBRARY)
|
include $(PREBUILT_STATIC_LIBRARY)
|
||||||
|
|
||||||
25
android_binary_only/jni/Application.mk → contrib/android_binary_only/jni/Application.mk
Executable file → Normal file
25
android_binary_only/jni/Application.mk → contrib/android_binary_only/jni/Application.mk
Executable file → Normal file
@@ -1,19 +1,16 @@
|
|||||||
#APP_ABI := all
|
APP_ABI := all
|
||||||
#APP_ABI := armeabi-v7a x86
|
#APP_ABI += x86
|
||||||
#APP_ABI := x86
|
#APP_ABI += x86_64
|
||||||
#APP_ABI := x86_64
|
#APP_ABI += armeabi-v7a
|
||||||
APP_ABI := armeabi-v7a
|
#APP_ABI += arm64-v8a
|
||||||
#can be android-3 but will fail for x86 since arch-x86 is not present at ndkroot/platforms/android-3/ . libz is taken from there.
|
#can be android-3 but will fail for x86 since arch-x86 is not present at ndkroot/platforms/android-3/ . libz is taken from there.
|
||||||
APP_PLATFORM := android-14
|
APP_PLATFORM := android-14
|
||||||
|
|
||||||
# http://stackoverflow.com/a/21386866/529442 http://stackoverflow.com/a/15616255/529442 to enable c++11 support in Eclipse
|
NDK_TOOLCHAIN_VERSION := clang
|
||||||
NDK_TOOLCHAIN_VERSION := 4.9
|
APP_STL := c++_static
|
||||||
# APP_STL := stlport_shared --> does not seem to contain C++11 features
|
|
||||||
#APP_STL := gnustl_shared
|
|
||||||
APP_STL := gnustl_static
|
|
||||||
|
|
||||||
# Enable c++11 extensions in source code
|
# Enable c++17 extensions in source code
|
||||||
APP_CPPFLAGS += -std=c++11 -fvisibility=default -fPIE
|
APP_CPPFLAGS += -std=c++17 -fvisibility=default -fPIE
|
||||||
|
|
||||||
APP_CPPFLAGS += -DANDROID_BINARY -DANDROID -D__ANDROID__ -DUSE_UPNP
|
APP_CPPFLAGS += -DANDROID_BINARY -DANDROID -D__ANDROID__ -DUSE_UPNP
|
||||||
APP_LDFLAGS += -rdynamic -fPIE -pie
|
APP_LDFLAGS += -rdynamic -fPIE -pie
|
||||||
@@ -24,7 +21,7 @@ endif
|
|||||||
# Forcing debug optimization. Use `ndk-build NDK_DEBUG=1` instead.
|
# Forcing debug optimization. Use `ndk-build NDK_DEBUG=1` instead.
|
||||||
#APP_OPTIM := debug
|
#APP_OPTIM := debug
|
||||||
|
|
||||||
# git clone https://github.com/PurpleI2P/Boost-for-Android-Prebuilt.git
|
# git clone https://github.com/PurpleI2P/Boost-for-Android-Prebuilt.git -b boost-1_72_0
|
||||||
# git clone https://github.com/PurpleI2P/OpenSSL-for-Android-Prebuilt.git
|
# git clone https://github.com/PurpleI2P/OpenSSL-for-Android-Prebuilt.git
|
||||||
# git clone https://github.com/PurpleI2P/MiniUPnP-for-Android-Prebuilt.git
|
# git clone https://github.com/PurpleI2P/MiniUPnP-for-Android-Prebuilt.git
|
||||||
# git clone https://github.com/PurpleI2P/android-ifaddrs.git
|
# git clone https://github.com/PurpleI2P/android-ifaddrs.git
|
||||||
@@ -36,7 +33,7 @@ MINIUPNP_PATH = $(I2PD_LIBS_PATH)/MiniUPnP-for-Android-Prebuilt
|
|||||||
IFADDRS_PATH = $(I2PD_LIBS_PATH)/android-ifaddrs
|
IFADDRS_PATH = $(I2PD_LIBS_PATH)/android-ifaddrs
|
||||||
|
|
||||||
# don't change me
|
# don't change me
|
||||||
I2PD_SRC_PATH = $(PWD)/..
|
I2PD_SRC_PATH = $(PWD)/../..
|
||||||
|
|
||||||
LIB_SRC_PATH = $(I2PD_SRC_PATH)/libi2pd
|
LIB_SRC_PATH = $(I2PD_SRC_PATH)/libi2pd
|
||||||
LIB_CLIENT_SRC_PATH = $(I2PD_SRC_PATH)/libi2pd_client
|
LIB_CLIENT_SRC_PATH = $(I2PD_SRC_PATH)/libi2pd_client
|
||||||
2
contrib/android_binary_pack/.gitignore
vendored
Normal file
2
contrib/android_binary_pack/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
archive
|
||||||
|
i2pd_*_android_binary.zip
|
||||||
48
contrib/android_binary_pack/build-archive
Executable file
48
contrib/android_binary_pack/build-archive
Executable file
@@ -0,0 +1,48 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copyright (c) 2013-2020, The PurpleI2P Project
|
||||||
|
#
|
||||||
|
# This file is part of Purple i2pd project and licensed under BSD3
|
||||||
|
#
|
||||||
|
# See full license text in LICENSE file at top of project tree
|
||||||
|
|
||||||
|
GITDESC=$(git describe --tags)
|
||||||
|
|
||||||
|
declare -A ABILIST=(
|
||||||
|
["armeabi-v7a"]="armv7l"
|
||||||
|
["arm64-v8a"]="aarch64"
|
||||||
|
["x86"]="x86"
|
||||||
|
["x86_64"]="x86_64"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Remove old files and archives
|
||||||
|
if [ -d archive ]; then
|
||||||
|
rm -r archive
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f ../i2pd_*_android_binary.zip ]; then
|
||||||
|
rm i2pd_*_android_binary.zip
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Prepare files for package
|
||||||
|
mkdir archive
|
||||||
|
|
||||||
|
for ABI in "${!ABILIST[@]}"; do
|
||||||
|
if [ -f ../android_binary_only/libs/${ABI}/i2pd ]; then
|
||||||
|
cp ../android_binary_only/libs/${ABI}/i2pd archive/i2pd-${ABILIST[$ABI]}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
cp i2pd archive/i2pd
|
||||||
|
cp -rH ../android/assets/certificates archive/
|
||||||
|
cp -rH ../android/assets/tunnels.conf.d archive/
|
||||||
|
cp -H ../android/assets/i2pd.conf archive/
|
||||||
|
cp -H ../android/assets/tunnels.conf archive/
|
||||||
|
|
||||||
|
# Compress files
|
||||||
|
cd archive
|
||||||
|
zip -r6 ../i2pd_${GITDESC}_android_binary.zip .
|
||||||
|
|
||||||
|
# Remove temporary folder
|
||||||
|
cd ..
|
||||||
|
rm -r archive
|
||||||
33
contrib/android_binary_pack/i2pd
Executable file
33
contrib/android_binary_pack/i2pd
Executable file
@@ -0,0 +1,33 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Copyright (c) 2013-2020, The PurpleI2P Project
|
||||||
|
#
|
||||||
|
# This file is part of Purple i2pd project and licensed under BSD3
|
||||||
|
#
|
||||||
|
# See full license text in LICENSE file at top of project tree
|
||||||
|
#
|
||||||
|
# That script written for use with Termux.
|
||||||
|
|
||||||
|
# https://stackoverflow.com/a/246128
|
||||||
|
SOURCE="${0}"
|
||||||
|
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||||
|
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
|
||||||
|
SOURCE="$(readlink "$SOURCE")"
|
||||||
|
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
||||||
|
done
|
||||||
|
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
|
||||||
|
|
||||||
|
arch=$(uname -m)
|
||||||
|
|
||||||
|
screenfind=$(which screen)
|
||||||
|
if [ -z $screenfind ]; then
|
||||||
|
echo "Can't find 'screen' installed. That script needs it!";
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z i2pd-$arch ]; then
|
||||||
|
echo "Can't find i2pd binary for your archtecture.";
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
screen -AmdS i2pd ./i2pd-$arch --datadir=$DIR
|
||||||
@@ -4,33 +4,22 @@
|
|||||||
#
|
#
|
||||||
#include <tunables/global>
|
#include <tunables/global>
|
||||||
|
|
||||||
/usr/sbin/i2pd {
|
profile i2pd /{usr/,}sbin/i2pd {
|
||||||
#include <abstractions/base>
|
#include <abstractions/base>
|
||||||
|
#include <abstractions/openssl>
|
||||||
network inet dgram,
|
#include <abstractions/nameservice>
|
||||||
network inet stream,
|
|
||||||
network inet6 dgram,
|
|
||||||
network inet6 stream,
|
|
||||||
network netlink raw,
|
|
||||||
|
|
||||||
/etc/gai.conf r,
|
|
||||||
/etc/host.conf r,
|
|
||||||
/etc/hosts r,
|
|
||||||
/etc/nsswitch.conf r,
|
|
||||||
/etc/resolv.conf r,
|
|
||||||
/run/resolvconf/resolv.conf r,
|
|
||||||
/run/systemd/resolve/stub-resolv.conf r,
|
|
||||||
|
|
||||||
# path specific (feel free to modify if you have another paths)
|
# path specific (feel free to modify if you have another paths)
|
||||||
/etc/i2pd/** r,
|
/etc/i2pd/** r,
|
||||||
/run/i2pd/i2pd.pid rwk,
|
|
||||||
/var/lib/i2pd/** rw,
|
/var/lib/i2pd/** rw,
|
||||||
/var/log/i2pd/i2pd.log w,
|
/var/log/i2pd/i2pd.log w,
|
||||||
/var/run/i2pd/i2pd.pid rwk,
|
/{var/,}run/i2pd/i2pd.pid rwk,
|
||||||
/usr/sbin/i2pd mr,
|
/{usr/,}sbin/i2pd mr,
|
||||||
/usr/share/i2pd/** r,
|
@{system_share_dirs}/i2pd/** r,
|
||||||
|
|
||||||
# user homedir (if started not by init.d or systemd)
|
# user homedir (if started not by init.d or systemd)
|
||||||
owner @{HOME}/.i2pd/ rw,
|
owner @{HOME}/.i2pd/ rw,
|
||||||
owner @{HOME}/.i2pd/** rwk,
|
owner @{HOME}/.i2pd/** rwk,
|
||||||
|
|
||||||
|
#include if exists <local/usr.sbin.i2pd>
|
||||||
}
|
}
|
||||||
|
|||||||
32
contrib/certificates/reseed/acetone_at_mail.i2p.crt
Normal file
32
contrib/certificates/reseed/acetone_at_mail.i2p.crt
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
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
|
||||||
|
3ZUnv2ipo2fpr69NtuBnutK6gw==
|
||||||
|
-----END CERTIFICATE-----
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
-----BEGIN CERTIFICATE-----
|
|
||||||
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
|
|
||||||
cGpnw4a2u9sHZIUNHzoGq32+7UWXsBI5Ow==
|
|
||||||
-----END CERTIFICATE-----
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
-----BEGIN CERTIFICATE-----
|
|
||||||
MIIFfTCCA2WgAwIBAgIEOprmhjANBgkqhkiG9w0BAQ0FADBvMQswCQYDVQQGEwJY
|
|
||||||
WDELMAkGA1UECBMCWFgxCzAJBgNVBAcTAlhYMR4wHAYDVQQKExVJMlAgQW5vbnlt
|
|
||||||
b3VzIE5ldHdvcmsxDDAKBgNVBAsTA0kyUDEYMBYGA1UEAwwPYmFja3VwQG1haWwu
|
|
||||||
aTJwMB4XDTEzMTAxMzEzNDQ1NVoXDTIzMTAxMzEzNDQ1NVowbzELMAkGA1UEBhMC
|
|
||||||
WFgxCzAJBgNVBAgTAlhYMQswCQYDVQQHEwJYWDEeMBwGA1UEChMVSTJQIEFub255
|
|
||||||
bW91cyBOZXR3b3JrMQwwCgYDVQQLEwNJMlAxGDAWBgNVBAMMD2JhY2t1cEBtYWls
|
|
||||||
LmkycDCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAIoAkobXwk/Enf1d
|
|
||||||
roHyqCyvcJfZJVTwb/LgYWAvCBMCr+RGqlSgtk3g69Y3I0xU08fD2kGt3r5Pwsbr
|
|
||||||
omXIbJAcccyLqmQ5QX6QgL+X9VpMDp9C4h2RogCrqLBAWw4cuZ4RS9VCpP1Yis7H
|
|
||||||
uejYqENP86p7BsRnuW/4cYnfunAdMpss4LpRGQXt1nTX+kfgCYgnKFbFqwAHt7yV
|
|
||||||
Ds+Pe6FuBHPlp+sc1amKRcUnSvhXLsv43VicnT7xYL/kUsN83wrtHA3B4aGDx3aA
|
|
||||||
3/EzuRmIXQB0BlTZILMEyYwG/nc4OsW82QYrvEZ9BIg9A4lF/wS/KZCICPxLF2zo
|
|
||||||
dGjnmlgkiA4s8eO+va/ElHyELjckVXqmG1eXHhSkEsDvOQJy01IUuwLinvq7cUbJ
|
|
||||||
HfJBZJllEg+sLDCv3FkEqN+XjBNFfQN4oNew4w6IPY6YH1INVB9LL0Cmdu4DudLv
|
|
||||||
TY8OcI8eSfez3hmm+pYQ23PJRYYnvRDnRECyIWBegkckWRh8U/WvZUYUvETK6EDl
|
|
||||||
/0KpTtfzX6MqHA5D6bTAB8Y3ijGMLrZ/B5vj5yCoZbLiGme9X2moR2k1LEhdhtzV
|
|
||||||
exsqezCpg6dn48FTX7mHjvR5/r4kz2jqBGmdPUWIIxnjFUzDUK3llVQiHihleHpe
|
|
||||||
jL4LqnhBGKWFRTaVwaIkBG4zAfIzAgMBAAGjITAfMB0GA1UdDgQWBBQNkfW7bSMl
|
|
||||||
1/4KDbgwrkf9x1Zu/TANBgkqhkiG9w0BAQ0FAAOCAgEAGg3a3rTf0EznQocmio0T
|
|
||||||
5gCoL0n8h6yKW/PyPAIELrd9wiYjhJFcWvMTcJJJnVqmAL5vpvhaAFVtAfx70MGa
|
|
||||||
0DZ7FvytK5hEfF4IqOFDyEEVGJR5rIpVK4MeI1nmwEsxdbW+FhODjtRzgYO8XBME
|
|
||||||
Xj4aY1FWg9vxc3reUj6PSFsZtsB0aLiRgL9JDovJIiRw0Uqr1v2wXBte5yVCxDge
|
|
||||||
vTREZtpK4cKetoOa68pwSXI32JwKE18j6bfdKVBCcYQKlKP/3gHGduaDrQv3w32S
|
|
||||||
DRym5s6MREeTUOtAw4wq46KpdOX8yyAqJPrCfMwS6ORd3t+egqOw0PUnsqb97w4O
|
|
||||||
lUtrRYvb2cOj60SmRx4vJvItyuHbKqIK7o2e1RcUZPXYoAVx2ww4XB2Wk4D7LSAs
|
|
||||||
cS7nLj8yAqzJ2qqtBzxu+zILJtkVa12dKF0xmS0BxBp4sCYiBtmAVE8AWQqEuSHA
|
|
||||||
FrMWqoXcjcfdvvyX487FFWWUE7ZBIn0hee2sK9J9+SPtqczJaN7TF3K3nzo65WJG
|
|
||||||
1epltmq2Ugjb67Gz7v4y7H23DJ/qhm8yLtCHTj69HTta5I08j6Kut924WLZaiMO/
|
|
||||||
4YoEL5AE63X0sxYibKFQiq7FW5nUJA280GRlY3xSMFzlB2ggazrUV3YAWVDhfdnI
|
|
||||||
flpzWXkFM2D36OUaubfe9YY=
|
|
||||||
-----END CERTIFICATE-----
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
-----BEGIN CERTIFICATE-----
|
|
||||||
MIIFezCCA2OgAwIBAgIEUQYyQjANBgkqhkiG9w0BAQ0FADBuMQswCQYDVQQGEwJY
|
|
||||||
WDELMAkGA1UECBMCWFgxCzAJBgNVBAcTAlhYMR4wHAYDVQQKExVJMlAgQW5vbnlt
|
|
||||||
b3VzIE5ldHdvcmsxDDAKBgNVBAsTA0kyUDEXMBUGA1UEAwwOYnVnbWVAbWFpbC5p
|
|
||||||
MnAwHhcNMTQxMTA2MDkxMTE0WhcNMjQxMTA1MDkxMTE0WjBuMQswCQYDVQQGEwJY
|
|
||||||
WDELMAkGA1UECBMCWFgxCzAJBgNVBAcTAlhYMR4wHAYDVQQKExVJMlAgQW5vbnlt
|
|
||||||
b3VzIE5ldHdvcmsxDDAKBgNVBAsTA0kyUDEXMBUGA1UEAwwOYnVnbWVAbWFpbC5p
|
|
||||||
MnAwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCrThOH0eSDT0VnCSBC
|
|
||||||
sqYmAydWH+O8eNttDXr2mSvZLhvAW+6/xHTkKhaWvkIvvS0Vh8hujMnD90Cgp4Fk
|
|
||||||
TKCxMj9K527o5xIZwWW05OevbjlBwIpVLO1PjmsfsoD1nIX14eEzJSEoAulKsv7V
|
|
||||||
jGUC/6hC11mmVvH9buQLSRv6sCjuAcMszmw3TAD+XYBIs+z57KuwYXtX3+OA543c
|
|
||||||
l1/ZKLYkkwY8cwzZqWDVWqTKP5TfVae58t40HhJk3bOsr21FZsaOjlmao3GO+d/3
|
|
||||||
exKuUGJRcolSqskL3sZ1ovFqko81obvvx0upI0YA0iMr/NRGl3VPuf/LJvRppYGc
|
|
||||||
LsJHgy9TIgtHvaXRi5Nt4CbKl9sZh/7WkkTTI5YGvevu00btlabAN+DSAZZqdsB3
|
|
||||||
wY8HhM1MHiA9SWsqwU65TwErcRrjNna2FiDHEu0xk5+/iAGl6CSKHZBmNcYKXSv8
|
|
||||||
cwShB0jjmciK0a05nC638RPgj0fng7KRrSglyzfjXRrljmZ40LSBL/GGMZMWpOM7
|
|
||||||
mEsBH5UZJ/2BEmjc9X9257zBdx8BK8y1TXpAligpNBsERcTw1WP1PJ35einZvlXW
|
|
||||||
qI3GwMf0sl26sn+evcK0gDl27jVDZ45MtNQEq64M4NV3Tn9zq0eg/39YvjVeqrI5
|
|
||||||
l7sxmYqYGR6BuSncwdc4x+t6swIDAQABoyEwHzAdBgNVHQ4EFgQU/REZ7NMbVZHr
|
|
||||||
Xkao6Q8Ccqv2kAMwDQYJKoZIhvcNAQENBQADggIBACc2YjLVNbl1kJUdg2klCLJt
|
|
||||||
5LjNTiIZa2Cha5GStlC/lyoRRge6+q/y9TN3tTptlzLPS9pI9EE1GfIQaE+HAk+e
|
|
||||||
/bC3KUOAHgVuETvsNAbfpaVsPCdWpFuXmp/4b9iDN7qZy4afTKUPA/Ir/cLfNp14
|
|
||||||
JULfP4z2yFOsCQZ5viNFAs1u99FrwobV2LBzUSIJQewsksuOwj96zIyau0Y629oJ
|
|
||||||
k+og88Tifd9EH3MVZNGhdpojQDDdwHQSITnCDgfRP5yER1WIA4jg6l+mM90QkvLY
|
|
||||||
5NjWTna5kJ3X6UizvgCk365yzT2sbN3R9UGXfCJa9GBcnnviJtJF3+/gC0abwY2f
|
|
||||||
NtVYp32Xky45NY/NdRhDg0bjHP3psxmX+Sc0M9NuQcDQ+fUR+CzM0IGeiszkzXOs
|
|
||||||
RG+bOou2cZ81G4oxWdAALHIRrn7VvLGlkFMxiIZyhYcTGQZzsTPT6n18dY99+DAV
|
|
||||||
yQWZfIRdm8DOnt0G+cwfeohc/9ZwDmj4jJAAi0aeTXdY6NEGIVydk6MAycEhg2Hx
|
|
||||||
9EV96kRwZNIW0AGY8CozECFL3Eyo2ClQVV4Q35SsBibsitDjM03usc2DJ/qjynXA
|
|
||||||
C8HoOSWgbddiBvqZueqK8GdhykOy3J3ysr+MNN/lbG48LqkQr1OWxev9rGGQ6RJT
|
|
||||||
wpBgPyAFAwouPy1whmnx
|
|
||||||
-----END CERTIFICATE-----
|
|
||||||
34
contrib/certificates/reseed/hankhill19580_at_gmail.com.crt
Normal file
34
contrib/certificates/reseed/hankhill19580_at_gmail.com.crt
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
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
|
||||||
|
CCOJyu3XtyzFf+tAeixOnuQ=
|
||||||
|
-----END CERTIFICATE-----
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
-----BEGIN CERTIFICATE-----
|
|
||||||
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
|
|
||||||
o3eNsanvTU+TIFBh2Q==
|
|
||||||
-----END CERTIFICATE-----
|
|
||||||
34
contrib/certificates/reseed/reseed_at_diva.exchange.crt
Normal file
34
contrib/certificates/reseed/reseed_at_diva.exchange.crt
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIF0zCCA7ugAwIBAgIQWjHyC+NRh3emuuAwcEnKSjANBgkqhkiG9w0BAQsFADB0
|
||||||
|
MQswCQYDVQQGEwJYWDELMAkGA1UEBxMCWFgxCzAJBgNVBAkTAlhYMR4wHAYDVQQK
|
||||||
|
ExVJMlAgQW5vbnltb3VzIE5ldHdvcmsxDDAKBgNVBAsTA0kyUDEdMBsGA1UEAwwU
|
||||||
|
cmVzZWVkQGRpdmEuZXhjaGFuZ2UwHhcNMjAwNjA5MDUzNjQ1WhcNMzAwNjA5MDUz
|
||||||
|
NjQ1WjB0MQswCQYDVQQGEwJYWDELMAkGA1UEBxMCWFgxCzAJBgNVBAkTAlhYMR4w
|
||||||
|
HAYDVQQKExVJMlAgQW5vbnltb3VzIE5ldHdvcmsxDDAKBgNVBAsTA0kyUDEdMBsG
|
||||||
|
A1UEAwwUcmVzZWVkQGRpdmEuZXhjaGFuZ2UwggIiMA0GCSqGSIb3DQEBAQUAA4IC
|
||||||
|
DwAwggIKAoICAQC6BJGeMEgoXk9dlzKVfmwHrT2VpwTT+wRJvh3eAM746u4uDT2y
|
||||||
|
NPHXhdGcQ9dRRZ63T98IshWCwOmWSlm1kdWkmKkVVb93GUoMQ3gziCi0apLJMAau
|
||||||
|
gEu/sPCbORS2dPsQeAPW2eIsJO7dSjTRiQAuquW//NcIXG4gnxDA52lgke1BvpKr
|
||||||
|
83SJlCrqECAy6OKtZ49yn75CqmPPWFn0b/E8bxruN5ffeipTTospvdEtT41gXUqk
|
||||||
|
hOz3k8ang+QTWiP//jOjk31KXZ2dbh0LOlNJOvRxCqQmBZafNxxCR4DH8RewfPlL
|
||||||
|
qOiOJVzbLSP9RjqPLwnny5BOjbLWXcaybN5Qv2Pyd4mKtN3EpqBwRu7VnzXpsuuG
|
||||||
|
gRbxNmfKJ/vBEGrZAHAxi0NkHHEEne3B7pPDc2dVZHOfTfCu31m9uDHZ4eHEsNOJ
|
||||||
|
SJRiGjq74l0chCSlBGLrD1Y9LPyqadjdwuB9bzM0tMFC1wPflanQCflhhnEzAfbN
|
||||||
|
BaU2GRXo/I1UCDW/dH1FIkqEe61eMW1Lwqr5tdlrUpdr5VIddTyNJRBJogbZ+HZE
|
||||||
|
8mcoJW2lXRAkYi7KEm4b4EQNe7sbRNTF0j+fAJ+3ZOZ3O3SMHss6ignlSa+giVim
|
||||||
|
VvL+Joc6wpSzxpeNPf6m82cEO/UvifFYeOC9TpiRriSt+vvgQVzQtfQ+fQIDAQAB
|
||||||
|
o2EwXzAOBgNVHQ8BAf8EBAMCAoQwHQYDVR0lBBYwFAYIKwYBBQUHAwIGCCsGAQUF
|
||||||
|
BwMBMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFHJlc2VlZEBkaXZhLmV4Y2hh
|
||||||
|
bmdlMA0GCSqGSIb3DQEBCwUAA4ICAQCFGOb1dHlwjmgFHEER6oMiGWl1mI3Hb7GX
|
||||||
|
NNI6QUhZQ+iEWGYtsOTk3Q8xejL8t6AG/ZLXfZviLIJXZc5XZfPXk0ezDSC2cYxQ
|
||||||
|
ZAyYPw2dRP14brI86sCSqNAFIax/U5SM3zXhCbBiTfaEoBPfDpvKjx+VliaITUnc
|
||||||
|
sHTRn+C5ID5M8cZIqUSGECPEMU/bDtuRNJLTKYaJ98yXtYuS2CWsMEM4o0GGcnYQ
|
||||||
|
5HOZT/lbbwfq1Ks7IyJpeIpRaS5qckGcfgkxFY4eGujDuaFeWC+HCIh9RzBJrqZR
|
||||||
|
73Aly4Pyu7Jjg8xCCf9MswDjtqAjEHgWCmRLWL7p3H6cPipFKNMY6yomYZl5urE7
|
||||||
|
q6DUAZFKwPqlZpyeaY4/SVvaHTxuPp7484s3db4kPhdmuQS/DOB/7d+cn/S580Vy
|
||||||
|
ALqlFQjtjLEaT16upceAV0gYktDInE6Rtym/OsqilrtYks/Sc0GROSz8lJhDDWbr
|
||||||
|
W3t92muSXDh0rYrEUYWl+xl1gSTpbIP75zzU+cUr1E/qlRY9qZn66FsJpOuN0I0q
|
||||||
|
UXsQS/bPDcA+IW48Hd9LfO9gtTWZslwFTimjEvQ2nJAnUlUQP6OfuPUKHoYX/CwY
|
||||||
|
2LCN8+pv2bKPDVHvp0lf6xrbbZNvFtzfR0G3AprZjYpuu2XgjVB5nJnwmbH74b9w
|
||||||
|
LD8d2z2Lgg==
|
||||||
|
-----END CERTIFICATE-----
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
-----BEGIN CERTIFICATE-----
|
|
||||||
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
|
|
||||||
fNr8P7NIRyZ8
|
|
||||||
-----END CERTIFICATE-----
|
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
d /var/run/i2pd 0755 i2pd i2pd - -
|
d /run/i2pd 0755 i2pd i2pd - -
|
||||||
d /var/log/i2pd 0755 i2pd i2pd - -
|
d /var/log/i2pd 0755 i2pd i2pd - -
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ ENV REPO_URL=${REPO_URL}
|
|||||||
|
|
||||||
ENV I2PD_HOME="/home/i2pd"
|
ENV I2PD_HOME="/home/i2pd"
|
||||||
ENV DATA_DIR="${I2PD_HOME}/data"
|
ENV DATA_DIR="${I2PD_HOME}/data"
|
||||||
|
ENV DEFAULT_ARGS=" --datadir=$DATA_DIR --reseed.verify=true --upnp.enabled=false --http.enabled=true --http.address=0.0.0.0 --httpproxy.enabled=true --httpproxy.address=0.0.0.0 --socksproxy.enabled=true --socksproxy.address=0.0.0.0 --sam.enabled=true --sam.address=0.0.0.0"
|
||||||
|
|
||||||
RUN mkdir -p "$I2PD_HOME" "$DATA_DIR" \
|
RUN mkdir -p "$I2PD_HOME" "$DATA_DIR" \
|
||||||
&& adduser -S -h "$I2PD_HOME" i2pd \
|
&& adduser -S -h "$I2PD_HOME" i2pd \
|
||||||
@@ -24,7 +25,7 @@ RUN mkdir -p "$I2PD_HOME" "$DATA_DIR" \
|
|||||||
# 1. install deps, clone and build.
|
# 1. install deps, clone and build.
|
||||||
# 2. strip binaries.
|
# 2. strip binaries.
|
||||||
# 3. Purge all dependencies and other unrelated packages, including build directory.
|
# 3. Purge all dependencies and other unrelated packages, including build directory.
|
||||||
RUN apk --no-cache --virtual build-dependendencies add make gcc g++ libtool boost-dev build-base openssl-dev openssl git \
|
RUN apk --no-cache --virtual build-dependendencies add make gcc g++ libtool zlib-dev boost-dev build-base openssl-dev openssl git \
|
||||||
&& mkdir -p /tmp/build \
|
&& mkdir -p /tmp/build \
|
||||||
&& cd /tmp/build && git clone -b ${GIT_BRANCH} ${REPO_URL} \
|
&& cd /tmp/build && git clone -b ${GIT_BRANCH} ${REPO_URL} \
|
||||||
&& cd i2pd \
|
&& cd i2pd \
|
||||||
@@ -36,9 +37,9 @@ RUN apk --no-cache --virtual build-dependendencies add make gcc g++ libtool boos
|
|||||||
&& cd /usr/local/bin \
|
&& cd /usr/local/bin \
|
||||||
&& strip i2pd \
|
&& strip i2pd \
|
||||||
&& rm -fr /tmp/build && apk --no-cache --purge del build-dependendencies build-base fortify-headers boost-dev zlib-dev openssl-dev \
|
&& rm -fr /tmp/build && apk --no-cache --purge del build-dependendencies build-base fortify-headers boost-dev zlib-dev openssl-dev \
|
||||||
boost-python3 python3 gdbm boost-unit_test_framework boost-python linux-headers boost-prg_exec_monitor \
|
boost-python3 python3 gdbm boost-unit_test_framework linux-headers boost-prg_exec_monitor \
|
||||||
boost-serialization boost-signals boost-wave boost-wserialization boost-math boost-graph boost-regex git pcre \
|
boost-serialization boost-wave boost-wserialization boost-math boost-graph boost-regex git pcre2 \
|
||||||
libtool g++ gcc pkgconfig
|
libtool g++ gcc
|
||||||
|
|
||||||
# 2. Adding required libraries to run i2pd to ensure it will run.
|
# 2. Adding required libraries to run i2pd to ensure it will run.
|
||||||
RUN apk --no-cache add boost-filesystem boost-system boost-program_options boost-date_time boost-thread boost-iostreams openssl musl-utils libstdc++
|
RUN apk --no-cache add boost-filesystem boost-system boost-program_options boost-date_time boost-thread boost-iostreams openssl musl-utils libstdc++
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
COMMAND=/usr/local/bin/i2pd
|
COMMAND=/usr/local/bin/i2pd
|
||||||
# To make ports exposeable
|
# To make ports exposeable
|
||||||
# Note: $DATA_DIR is defined in /etc/profile
|
# Note: $DATA_DIR is defined in /etc/profile
|
||||||
DEFAULT_ARGS=" --datadir=$DATA_DIR --reseed.verify=true --upnp.enabled=false --http.enabled=true --http.address=0.0.0.0 --httpproxy.enabled=true --httpproxy.address=0.0.0.0 --socksproxy.enabled=true --socksproxy.address=0.0.0.0 --sam.enabled=true --sam.address=0.0.0.0"
|
|
||||||
|
|
||||||
if [ "$1" = "--help" ]; then
|
if [ "$1" = "--help" ]; then
|
||||||
set -- $COMMAND --help
|
set -- $COMMAND --help
|
||||||
|
|||||||
@@ -10,8 +10,13 @@
|
|||||||
## Default: ~/.i2pd/tunnels.conf or /var/lib/i2pd/tunnels.conf
|
## Default: ~/.i2pd/tunnels.conf or /var/lib/i2pd/tunnels.conf
|
||||||
# tunconf = /var/lib/i2pd/tunnels.conf
|
# tunconf = /var/lib/i2pd/tunnels.conf
|
||||||
|
|
||||||
## Where to write pidfile (don't write by default)
|
## Tunnels config files path
|
||||||
# pidfile = /var/run/i2pd.pid
|
## Use that path to store separated tunnels in different config files.
|
||||||
|
## Default: ~/.i2pd/tunnels.d or /var/lib/i2pd/tunnels.d
|
||||||
|
# tunnelsdir = /var/lib/i2pd/tunnels.d
|
||||||
|
|
||||||
|
## Where to write pidfile (default: i2pd.pid, not used in Windows)
|
||||||
|
# pidfile = /run/i2pd.pid
|
||||||
|
|
||||||
## Logging configuration section
|
## Logging configuration section
|
||||||
## By default logs go to stdout with level 'info' and higher
|
## By default logs go to stdout with level 'info' and higher
|
||||||
@@ -22,10 +27,10 @@
|
|||||||
## * syslog - use syslog, see man 3 syslog
|
## * syslog - use syslog, see man 3 syslog
|
||||||
# log = file
|
# log = file
|
||||||
## Path to logfile (default - autodetect)
|
## Path to logfile (default - autodetect)
|
||||||
# logfile = /var/log/i2pd.log
|
# logfile = /var/log/i2pd/i2pd.log
|
||||||
## Log messages above this level (debug, *info, warn, error, none)
|
## Log messages above this level (debug, info, *warn, error, none)
|
||||||
## If you set it to none, logging will be disabled
|
## If you set it to none, logging will be disabled
|
||||||
# loglevel = info
|
# loglevel = warn
|
||||||
## Write full CLF-formatted date and time to log (default: write only time)
|
## Write full CLF-formatted date and time to log (default: write only time)
|
||||||
# logclftime = true
|
# logclftime = true
|
||||||
|
|
||||||
@@ -88,6 +93,8 @@ ipv6 = false
|
|||||||
## Address and port service will listen on
|
## Address and port service will listen on
|
||||||
address = 127.0.0.1
|
address = 127.0.0.1
|
||||||
port = 7070
|
port = 7070
|
||||||
|
## Path to web console, default "/"
|
||||||
|
# webroot = /
|
||||||
## Uncomment following lines to enable Web Console authentication
|
## Uncomment following lines to enable Web Console authentication
|
||||||
# auth = true
|
# auth = true
|
||||||
# user = i2pd
|
# user = i2pd
|
||||||
@@ -185,8 +192,8 @@ verify = true
|
|||||||
|
|
||||||
[addressbook]
|
[addressbook]
|
||||||
## AddressBook subscription URL for initial setup
|
## AddressBook subscription URL for initial setup
|
||||||
## Default: inr.i2p at "mainline" I2P Network
|
## Default: reg.i2p at "mainline" I2P Network
|
||||||
# defaulturl = http://joajgazyztfssty4w2on5oaqksz6tqoxbduy553y34mf4byv6gpq.b32.i2p/export/alive-hosts.txt
|
# defaulturl = http://shx5vqsw7usdaunyzr2qmes2fq37oumybpudrd4jjj4e4vk4uusa.b32.i2p/hosts.txt
|
||||||
## Optional subscriptions URLs, separated by comma
|
## Optional subscriptions URLs, separated by comma
|
||||||
# subscriptions = http://inr.i2p/export/alive-hosts.txt,http://stats.i2p/cgi-bin/newhosts.txt,http://rus.i2p/hosts.txt
|
# subscriptions = http://inr.i2p/export/alive-hosts.txt,http://stats.i2p/cgi-bin/newhosts.txt,http://rus.i2p/hosts.txt
|
||||||
|
|
||||||
@@ -218,3 +225,16 @@ verify = true
|
|||||||
# inbound.quantity = 3
|
# inbound.quantity = 3
|
||||||
# outbound.length = 2
|
# outbound.length = 2
|
||||||
# outbound.quantity = 3
|
# outbound.quantity = 3
|
||||||
|
|
||||||
|
[persist]
|
||||||
|
## Save peer profiles on disk (default: true)
|
||||||
|
# profiles = true
|
||||||
|
|
||||||
|
[cpuext]
|
||||||
|
## Use CPU AES-NI instructions set when work with cryptography when available (default: true)
|
||||||
|
# aesni = true
|
||||||
|
## Use CPU AVX instructions set when work with cryptography when available (default: true)
|
||||||
|
# avx = true
|
||||||
|
## Force usage of CPU instructions set, even if they not found
|
||||||
|
## DO NOT TOUCH that option if you really don't know what are you doing!
|
||||||
|
# force = false
|
||||||
|
|||||||
9
contrib/i2pd.logrotate
Normal file
9
contrib/i2pd.logrotate
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
"/var/log/i2pd/*.log" {
|
||||||
|
copytruncate
|
||||||
|
daily
|
||||||
|
rotate 5
|
||||||
|
compress
|
||||||
|
delaycompress
|
||||||
|
missingok
|
||||||
|
notifempty
|
||||||
|
}
|
||||||
@@ -11,21 +11,27 @@ RuntimeDirectoryMode=0700
|
|||||||
LogsDirectory=i2pd
|
LogsDirectory=i2pd
|
||||||
LogsDirectoryMode=0700
|
LogsDirectoryMode=0700
|
||||||
Type=forking
|
Type=forking
|
||||||
ExecStart=/usr/sbin/i2pd --conf=/etc/i2pd/i2pd.conf --tunconf=/etc/i2pd/tunnels.conf --pidfile=/var/run/i2pd/i2pd.pid --logfile=/var/log/i2pd/i2pd.log --daemon --service
|
ExecStart=/usr/sbin/i2pd --conf=/etc/i2pd/i2pd.conf --tunconf=/etc/i2pd/tunnels.conf --tunnelsdir=/etc/i2pd/tunnels.conf.d --pidfile=/run/i2pd/i2pd.pid --logfile=/var/log/i2pd/i2pd.log --daemon --service
|
||||||
ExecReload=/bin/kill -HUP $MAINPID
|
ExecReload=/bin/sh -c "kill -HUP $MAINPID"
|
||||||
PIDFile=/var/run/i2pd/i2pd.pid
|
PIDFile=/run/i2pd/i2pd.pid
|
||||||
### Uncomment, if auto restart needed
|
### Uncomment, if auto restart needed
|
||||||
#Restart=on-failure
|
#Restart=on-failure
|
||||||
|
|
||||||
KillSignal=SIGQUIT
|
# Use SIGTERM to stop i2pd immediately.
|
||||||
|
# Some cleanup processes can delay stopping, so we set 30 seconds timeout and then SIGKILL i2pd.
|
||||||
|
KillSignal=SIGTERM
|
||||||
|
TimeoutStopSec=30s
|
||||||
|
SendSIGKILL=yes
|
||||||
|
|
||||||
# If you have the patience waiting 10 min on restarting/stopping it, uncomment this.
|
# If you have the patience waiting 10 min on restarting/stopping it, uncomment this.
|
||||||
# i2pd stops accepting new tunnels and waits ~10 min while old ones do not die.
|
# i2pd stops accepting new tunnels and waits ~10 min while old ones do not die.
|
||||||
#KillSignal=SIGINT
|
#KillSignal=SIGINT
|
||||||
#TimeoutStopSec=10m
|
#TimeoutStopSec=10m
|
||||||
|
|
||||||
# If you have problems with hanging i2pd, you can try enable this
|
# If you have problems with hanging i2pd, you can try increase this
|
||||||
LimitNOFILE=4096
|
LimitNOFILE=4096
|
||||||
PrivateDevices=yes
|
# To enable write of coredump uncomment this
|
||||||
|
#LimitCORE=infinity
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|||||||
@@ -1,31 +1,32 @@
|
|||||||
%define git_hash %(git rev-parse HEAD | cut -c -7)
|
%define git_hash %(git rev-parse HEAD | cut -c -7)
|
||||||
|
|
||||||
Name: i2pd-git
|
Name: i2pd-git
|
||||||
Version: 2.21.1
|
Version: 2.37.0
|
||||||
Release: git%{git_hash}%{?dist}
|
Release: git%{git_hash}%{?dist}
|
||||||
Summary: I2P router written in C++
|
Summary: I2P router written in C++
|
||||||
Conflicts: i2pd
|
Conflicts: i2pd
|
||||||
|
|
||||||
License: BSD
|
License: BSD
|
||||||
URL: https://github.com/PurpleI2P/i2pd
|
URL: https://github.com/PurpleI2P/i2pd
|
||||||
Source0: https://github.com/PurpleI2P/i2pd/archive/openssl/i2pd-openssl.tar.gz
|
Source0: https://github.com/PurpleI2P/i2pd/archive/openssl/i2pd-openssl.tar.gz
|
||||||
|
|
||||||
%if 0%{?rhel} == 7
|
%if 0%{?rhel} == 7
|
||||||
BuildRequires: cmake3
|
BuildRequires: cmake3
|
||||||
%else
|
%else
|
||||||
BuildRequires: cmake
|
BuildRequires: cmake
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
BuildRequires: chrpath
|
BuildRequires: chrpath
|
||||||
BuildRequires: gcc-c++
|
BuildRequires: gcc-c++
|
||||||
BuildRequires: zlib-devel
|
BuildRequires: zlib-devel
|
||||||
BuildRequires: boost-devel
|
BuildRequires: boost-devel
|
||||||
BuildRequires: openssl-devel
|
BuildRequires: openssl-devel
|
||||||
BuildRequires: miniupnpc-devel
|
BuildRequires: miniupnpc-devel
|
||||||
BuildRequires: systemd-units
|
BuildRequires: systemd-units
|
||||||
|
|
||||||
Requires: systemd
|
Requires: logrotate
|
||||||
Requires(pre): %{_sbindir}/useradd %{_sbindir}/groupadd
|
Requires: systemd
|
||||||
|
Requires(pre): %{_sbindir}/useradd %{_sbindir}/groupadd
|
||||||
|
|
||||||
%description
|
%description
|
||||||
C++ implementation of I2P.
|
C++ implementation of I2P.
|
||||||
@@ -47,23 +48,56 @@ cd build
|
|||||||
-DWITH_LIBRARY=OFF \
|
-DWITH_LIBRARY=OFF \
|
||||||
-DWITH_UPNP=ON \
|
-DWITH_UPNP=ON \
|
||||||
-DWITH_HARDENING=ON \
|
-DWITH_HARDENING=ON \
|
||||||
|
%if 0%{?fedora} > 29
|
||||||
|
-DBUILD_SHARED_LIBS:BOOL=OFF \
|
||||||
|
.
|
||||||
|
%else
|
||||||
-DBUILD_SHARED_LIBS:BOOL=OFF
|
-DBUILD_SHARED_LIBS:BOOL=OFF
|
||||||
%endif
|
%endif
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if 0%{?fedora} >= 33
|
||||||
|
pushd %{_target_platform}
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if 0%{?mageia} > 7
|
||||||
|
pushd build
|
||||||
|
%endif
|
||||||
|
|
||||||
make %{?_smp_mflags}
|
make %{?_smp_mflags}
|
||||||
|
|
||||||
|
%if 0%{?fedora} >= 33
|
||||||
|
popd
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if 0%{?mageia} > 7
|
||||||
|
popd
|
||||||
|
%endif
|
||||||
|
|
||||||
%install
|
%install
|
||||||
cd build
|
pushd build
|
||||||
|
|
||||||
|
%if 0%{?fedora} >= 33
|
||||||
|
pushd %{_target_platform}
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if 0%{?mageia}
|
||||||
|
pushd build
|
||||||
|
%endif
|
||||||
|
|
||||||
chrpath -d i2pd
|
chrpath -d i2pd
|
||||||
install -D -m 755 i2pd %{buildroot}%{_sbindir}/i2pd
|
%{__install} -D -m 755 i2pd %{buildroot}%{_sbindir}/i2pd
|
||||||
install -D -m 755 %{_builddir}/%{name}-%{version}/contrib/i2pd.conf %{buildroot}%{_sysconfdir}/i2pd/i2pd.conf
|
%{__install} -d -m 755 %{buildroot}%{_datadir}/i2pd
|
||||||
install -D -m 755 %{_builddir}/%{name}-%{version}/contrib/tunnels.conf %{buildroot}%{_sysconfdir}/i2pd/tunnels.conf
|
%{__install} -d -m 700 %{buildroot}%{_sharedstatedir}/i2pd
|
||||||
install -d -m 755 %{buildroot}%{_datadir}/i2pd
|
%{__install} -d -m 700 %{buildroot}%{_localstatedir}/log/i2pd
|
||||||
|
%{__install} -D -m 644 %{_builddir}/%{name}-%{version}/contrib/i2pd.conf %{buildroot}%{_sysconfdir}/i2pd/i2pd.conf
|
||||||
|
%{__install} -D -m 644 %{_builddir}/%{name}-%{version}/contrib/subscriptions.txt %{buildroot}%{_sysconfdir}/i2pd/subscriptions.txt
|
||||||
|
%{__install} -D -m 644 %{_builddir}/%{name}-%{version}/contrib/tunnels.conf %{buildroot}%{_sysconfdir}/i2pd/tunnels.conf
|
||||||
|
%{__install} -D -m 644 %{_builddir}/%{name}-%{version}/contrib/i2pd.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/i2pd
|
||||||
|
%{__install} -D -m 644 %{_builddir}/%{name}-%{version}/contrib/i2pd.service %{buildroot}%{_unitdir}/i2pd.service
|
||||||
|
%{__install} -D -m 644 %{_builddir}/%{name}-%{version}/debian/i2pd.1 %{buildroot}%{_mandir}/man1/i2pd.1
|
||||||
%{__cp} -r %{_builddir}/%{name}-%{version}/contrib/certificates/ %{buildroot}%{_datadir}/i2pd/certificates
|
%{__cp} -r %{_builddir}/%{name}-%{version}/contrib/certificates/ %{buildroot}%{_datadir}/i2pd/certificates
|
||||||
install -D -m 644 %{_builddir}/%{name}-%{version}/contrib/rpm/i2pd.service %{buildroot}%{_unitdir}/i2pd.service
|
%{__cp} -r %{_builddir}/%{name}-%{version}/contrib/tunnels.d/ %{buildroot}%{_sysconfdir}/i2pd/tunnels.conf.d
|
||||||
install -d -m 700 %{buildroot}%{_sharedstatedir}/i2pd
|
|
||||||
install -d -m 700 %{buildroot}%{_localstatedir}/log/i2pd
|
|
||||||
ln -s %{_datadir}/%{name}/certificates %{buildroot}%{_sharedstatedir}/i2pd/certificates
|
ln -s %{_datadir}/%{name}/certificates %{buildroot}%{_sharedstatedir}/i2pd/certificates
|
||||||
|
|
||||||
|
|
||||||
@@ -87,16 +121,76 @@ getent passwd i2pd >/dev/null || \
|
|||||||
|
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%doc LICENSE README.md
|
%doc LICENSE README.md contrib/i2pd.conf contrib/subscriptions.txt contrib/tunnels.conf contrib/tunnels.d
|
||||||
%{_sbindir}/i2pd
|
%{_sbindir}/i2pd
|
||||||
%{_datadir}/i2pd/certificates
|
%config(noreplace) %{_sysconfdir}/i2pd/*.conf
|
||||||
%config(noreplace) %{_sysconfdir}/i2pd/*
|
%config(noreplace) %{_sysconfdir}/i2pd/tunnels.conf.d/*.conf
|
||||||
/%{_unitdir}/i2pd.service
|
%config %{_sysconfdir}/i2pd/subscriptions.txt
|
||||||
%dir %attr(0700,i2pd,i2pd) %{_localstatedir}/log/i2pd
|
%doc %{_sysconfdir}/i2pd/tunnels.conf.d/README
|
||||||
|
%{_sysconfdir}/logrotate.d/i2pd
|
||||||
|
%{_unitdir}/i2pd.service
|
||||||
|
%{_mandir}/man1/i2pd.1*
|
||||||
%dir %attr(0700,i2pd,i2pd) %{_sharedstatedir}/i2pd
|
%dir %attr(0700,i2pd,i2pd) %{_sharedstatedir}/i2pd
|
||||||
|
%dir %attr(0700,i2pd,i2pd) %{_localstatedir}/log/i2pd
|
||||||
|
%{_datadir}/i2pd/certificates
|
||||||
%{_sharedstatedir}/i2pd/certificates
|
%{_sharedstatedir}/i2pd/certificates
|
||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Mar 15 2021 orignal <i2porignal@yandex.ru> - 2.37.0
|
||||||
|
- update to 2.37.0
|
||||||
|
|
||||||
|
* Mon Feb 15 2021 orignal <i2porignal@yandex.ru> - 2.36.0
|
||||||
|
- update to 2.36.0
|
||||||
|
|
||||||
|
* Mon Nov 30 2020 orignal <i2porignal@yandex.ru> - 2.35.0
|
||||||
|
- update to 2.35.0
|
||||||
|
|
||||||
|
* Tue Oct 27 2020 orignal <i2porignal@yandex.ru> - 2.34.0
|
||||||
|
- update to 2.34.0
|
||||||
|
|
||||||
|
* Mon Aug 24 2020 orignal <i2porignal@yandex.ru> - 2.33.0
|
||||||
|
- update to 2.33.0
|
||||||
|
|
||||||
|
* Tue Jun 02 2020 r4sas <r4sas@i2pmail.org> - 2.32.1
|
||||||
|
- update to 2.32.1
|
||||||
|
|
||||||
|
* Mon May 25 2020 r4sas <r4sas@i2pmail.org> - 2.32.0
|
||||||
|
- update to 2.32.0
|
||||||
|
- updated systemd service file (#1394)
|
||||||
|
|
||||||
|
* Thu May 7 2020 Anatolii Vorona <vorona.tolik@gmail.com> - 2.31.0-3
|
||||||
|
- added RPM logrotate config
|
||||||
|
|
||||||
|
* Fri Apr 10 2020 orignal <i2porignal@yandex.ru> - 2.31.0
|
||||||
|
- update to 2.31.0
|
||||||
|
|
||||||
|
* Tue Feb 25 2020 orignal <i2porignal@yandex.ru> - 2.30.0
|
||||||
|
- update to 2.30.0
|
||||||
|
|
||||||
|
* Mon Oct 21 2019 orignal <i2porignal@yandex.ru> - 2.29.0
|
||||||
|
- update to 2.29.0
|
||||||
|
|
||||||
|
* Tue Aug 27 2019 orignal <i2porignal@yandex.ru> - 2.28.0
|
||||||
|
- update to 2.28.0
|
||||||
|
|
||||||
|
* Wed Jul 3 2019 orignal <i2porignal@yandex.ru> - 2.27.0
|
||||||
|
- update to 2.27.0
|
||||||
|
|
||||||
|
* Fri Jun 7 2019 orignal <i2porignal@yandex.ru> - 2.26.0
|
||||||
|
- update to 2.26.0
|
||||||
|
|
||||||
|
* Thu May 9 2019 orignal <i2porignal@yandex.ru> - 2.25.0
|
||||||
|
- update to 2.25.0
|
||||||
|
|
||||||
|
* Thu Mar 21 2019 orignal <i2porignal@yandex.ru> - 2.24.0
|
||||||
|
- update to 2.24.0
|
||||||
|
|
||||||
|
* Mon Jan 21 2019 orignal <i2porignal@yandex.ru> - 2.23.0
|
||||||
|
- update to 2.23.0
|
||||||
|
|
||||||
|
* Fri Nov 09 2018 r4sas <r4sas@i2pmail.org> - 2.22.0
|
||||||
|
- add support of tunnelsdir option
|
||||||
|
|
||||||
* Thu Feb 01 2018 r4sas <r4sas@i2pmail.org> - 2.18.0
|
* Thu Feb 01 2018 r4sas <r4sas@i2pmail.org> - 2.18.0
|
||||||
- Initial i2pd-git based on i2pd 2.18.0-1 spec
|
- Initial i2pd-git based on i2pd 2.18.0-1 spec
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
../i2pd.service
|
|
||||||
@@ -1,29 +1,30 @@
|
|||||||
Name: i2pd
|
Name: i2pd
|
||||||
Version: 2.21.1
|
Version: 2.37.0
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
Summary: I2P router written in C++
|
Summary: I2P router written in C++
|
||||||
Conflicts: i2pd-git
|
Conflicts: i2pd-git
|
||||||
|
|
||||||
License: BSD
|
License: BSD
|
||||||
URL: https://github.com/PurpleI2P/i2pd
|
URL: https://github.com/PurpleI2P/i2pd
|
||||||
Source0: https://github.com/PurpleI2P/i2pd/archive/%{version}/%name-%version.tar.gz
|
Source0: https://github.com/PurpleI2P/i2pd/archive/%{version}/%name-%version.tar.gz
|
||||||
|
|
||||||
%if 0%{?rhel} == 7
|
%if 0%{?rhel} == 7
|
||||||
BuildRequires: cmake3
|
BuildRequires: cmake3
|
||||||
%else
|
%else
|
||||||
BuildRequires: cmake
|
BuildRequires: cmake
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
BuildRequires: chrpath
|
BuildRequires: chrpath
|
||||||
BuildRequires: gcc-c++
|
BuildRequires: gcc-c++
|
||||||
BuildRequires: zlib-devel
|
BuildRequires: zlib-devel
|
||||||
BuildRequires: boost-devel
|
BuildRequires: boost-devel
|
||||||
BuildRequires: openssl-devel
|
BuildRequires: openssl-devel
|
||||||
BuildRequires: miniupnpc-devel
|
BuildRequires: miniupnpc-devel
|
||||||
BuildRequires: systemd-units
|
BuildRequires: systemd-units
|
||||||
|
|
||||||
Requires: systemd
|
Requires: logrotate
|
||||||
Requires(pre): %{_sbindir}/useradd %{_sbindir}/groupadd
|
Requires: systemd
|
||||||
|
Requires(pre): %{_sbindir}/useradd %{_sbindir}/groupadd
|
||||||
|
|
||||||
%description
|
%description
|
||||||
C++ implementation of I2P.
|
C++ implementation of I2P.
|
||||||
@@ -45,23 +46,56 @@ cd build
|
|||||||
-DWITH_LIBRARY=OFF \
|
-DWITH_LIBRARY=OFF \
|
||||||
-DWITH_UPNP=ON \
|
-DWITH_UPNP=ON \
|
||||||
-DWITH_HARDENING=ON \
|
-DWITH_HARDENING=ON \
|
||||||
|
%if 0%{?fedora} > 29
|
||||||
|
-DBUILD_SHARED_LIBS:BOOL=OFF \
|
||||||
|
.
|
||||||
|
%else
|
||||||
-DBUILD_SHARED_LIBS:BOOL=OFF
|
-DBUILD_SHARED_LIBS:BOOL=OFF
|
||||||
%endif
|
%endif
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if 0%{?fedora} >= 33
|
||||||
|
pushd %{_target_platform}
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if 0%{?mageia} > 7
|
||||||
|
pushd build
|
||||||
|
%endif
|
||||||
|
|
||||||
make %{?_smp_mflags}
|
make %{?_smp_mflags}
|
||||||
|
|
||||||
|
%if 0%{?fedora} >= 33
|
||||||
|
popd
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if 0%{?mageia} > 7
|
||||||
|
popd
|
||||||
|
%endif
|
||||||
|
|
||||||
%install
|
%install
|
||||||
cd build
|
pushd build
|
||||||
|
|
||||||
|
%if 0%{?fedora} >= 33
|
||||||
|
pushd %{_target_platform}
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if 0%{?mageia}
|
||||||
|
pushd build
|
||||||
|
%endif
|
||||||
|
|
||||||
chrpath -d i2pd
|
chrpath -d i2pd
|
||||||
install -D -m 755 i2pd %{buildroot}%{_sbindir}/i2pd
|
%{__install} -D -m 755 i2pd %{buildroot}%{_sbindir}/i2pd
|
||||||
install -D -m 755 %{_builddir}/%{name}-%{version}/contrib/i2pd.conf %{buildroot}%{_sysconfdir}/i2pd/i2pd.conf
|
%{__install} -d -m 755 %{buildroot}%{_datadir}/i2pd
|
||||||
install -D -m 755 %{_builddir}/%{name}-%{version}/contrib/tunnels.conf %{buildroot}%{_sysconfdir}/i2pd/tunnels.conf
|
%{__install} -d -m 700 %{buildroot}%{_sharedstatedir}/i2pd
|
||||||
install -d -m 755 %{buildroot}%{_datadir}/i2pd
|
%{__install} -d -m 700 %{buildroot}%{_localstatedir}/log/i2pd
|
||||||
|
%{__install} -D -m 644 %{_builddir}/%{name}-%{version}/contrib/i2pd.conf %{buildroot}%{_sysconfdir}/i2pd/i2pd.conf
|
||||||
|
%{__install} -D -m 644 %{_builddir}/%{name}-%{version}/contrib/subscriptions.txt %{buildroot}%{_sysconfdir}/i2pd/subscriptions.txt
|
||||||
|
%{__install} -D -m 644 %{_builddir}/%{name}-%{version}/contrib/tunnels.conf %{buildroot}%{_sysconfdir}/i2pd/tunnels.conf
|
||||||
|
%{__install} -D -m 644 %{_builddir}/%{name}-%{version}/contrib/i2pd.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/i2pd
|
||||||
|
%{__install} -D -m 644 %{_builddir}/%{name}-%{version}/contrib/i2pd.service %{buildroot}%{_unitdir}/i2pd.service
|
||||||
|
%{__install} -D -m 644 %{_builddir}/%{name}-%{version}/debian/i2pd.1 %{buildroot}%{_mandir}/man1/i2pd.1
|
||||||
%{__cp} -r %{_builddir}/%{name}-%{version}/contrib/certificates/ %{buildroot}%{_datadir}/i2pd/certificates
|
%{__cp} -r %{_builddir}/%{name}-%{version}/contrib/certificates/ %{buildroot}%{_datadir}/i2pd/certificates
|
||||||
install -D -m 644 %{_builddir}/%{name}-%{version}/contrib/rpm/i2pd.service %{buildroot}%{_unitdir}/i2pd.service
|
%{__cp} -r %{_builddir}/%{name}-%{version}/contrib/tunnels.d/ %{buildroot}%{_sysconfdir}/i2pd/tunnels.conf.d
|
||||||
install -d -m 700 %{buildroot}%{_sharedstatedir}/i2pd
|
|
||||||
install -d -m 700 %{buildroot}%{_localstatedir}/log/i2pd
|
|
||||||
ln -s %{_datadir}/%{name}/certificates %{buildroot}%{_sharedstatedir}/i2pd/certificates
|
ln -s %{_datadir}/%{name}/certificates %{buildroot}%{_sharedstatedir}/i2pd/certificates
|
||||||
|
|
||||||
|
|
||||||
@@ -85,18 +119,79 @@ getent passwd i2pd >/dev/null || \
|
|||||||
|
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%doc LICENSE README.md
|
%doc LICENSE README.md contrib/i2pd.conf contrib/subscriptions.txt contrib/tunnels.conf contrib/tunnels.d
|
||||||
%{_sbindir}/i2pd
|
%{_sbindir}/i2pd
|
||||||
%{_datadir}/i2pd/certificates
|
%config(noreplace) %{_sysconfdir}/i2pd/*.conf
|
||||||
%config(noreplace) %{_sysconfdir}/i2pd/*
|
%config(noreplace) %{_sysconfdir}/i2pd/tunnels.conf.d/*.conf
|
||||||
/%{_unitdir}/i2pd.service
|
%config %{_sysconfdir}/i2pd/subscriptions.txt
|
||||||
%dir %attr(0700,i2pd,i2pd) %{_localstatedir}/log/i2pd
|
%doc %{_sysconfdir}/i2pd/tunnels.conf.d/README
|
||||||
|
%{_sysconfdir}/logrotate.d/i2pd
|
||||||
|
%{_unitdir}/i2pd.service
|
||||||
|
%{_mandir}/man1/i2pd.1*
|
||||||
%dir %attr(0700,i2pd,i2pd) %{_sharedstatedir}/i2pd
|
%dir %attr(0700,i2pd,i2pd) %{_sharedstatedir}/i2pd
|
||||||
|
%dir %attr(0700,i2pd,i2pd) %{_localstatedir}/log/i2pd
|
||||||
|
%{_datadir}/i2pd/certificates
|
||||||
%{_sharedstatedir}/i2pd/certificates
|
%{_sharedstatedir}/i2pd/certificates
|
||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Thu Oct 22 2018 orignal <i2porignal@yandex.ru> - 2.21.1
|
* Mon Mar 15 2021 orignal <i2porignal@yandex.ru> - 2.37.0
|
||||||
|
- update to 2.37.0
|
||||||
|
|
||||||
|
* Mon Feb 15 2021 orignal <i2porignal@yandex.ru> - 2.36.0
|
||||||
|
- update to 2.36.0
|
||||||
|
|
||||||
|
* Mon Nov 30 2020 orignal <i2porignal@yandex.ru> - 2.35.0
|
||||||
|
- update to 2.35.0
|
||||||
|
|
||||||
|
* Tue Oct 27 2020 orignal <i2porignal@yandex.ru> - 2.34.0
|
||||||
|
- update to 2.34.0
|
||||||
|
|
||||||
|
* Mon Aug 24 2020 orignal <i2porignal@yandex.ru> - 2.33.0
|
||||||
|
- update to 2.33.0
|
||||||
|
|
||||||
|
* Tue Jun 02 2020 r4sas <r4sas@i2pmail.org> - 2.32.1
|
||||||
|
- update to 2.32.1
|
||||||
|
|
||||||
|
* Mon May 25 2020 r4sas <r4sas@i2pmail.org> - 2.32.0
|
||||||
|
- update to 2.32.0
|
||||||
|
- updated systemd service file (#1394)
|
||||||
|
|
||||||
|
* Thu May 7 2020 Anatolii Vorona <vorona.tolik@gmail.com> - 2.31.0-3
|
||||||
|
- added RPM logrotate config
|
||||||
|
|
||||||
|
* Fri Apr 10 2020 orignal <i2porignal@yandex.ru> - 2.31.0
|
||||||
|
- update to 2.31.0
|
||||||
|
|
||||||
|
* Tue Feb 25 2020 orignal <i2porignal@yandex.ru> - 2.30.0
|
||||||
|
- update to 2.30.0
|
||||||
|
|
||||||
|
* Mon Oct 21 2019 orignal <i2porignal@yandex.ru> - 2.29.0
|
||||||
|
- update to 2.29.0
|
||||||
|
|
||||||
|
* Tue Aug 27 2019 orignal <i2porignal@yandex.ru> - 2.28.0
|
||||||
|
- update to 2.28.0
|
||||||
|
|
||||||
|
* Wed Jul 3 2019 orignal <i2porignal@yandex.ru> - 2.27.0
|
||||||
|
- update to 2.27.0
|
||||||
|
|
||||||
|
* Fri Jun 7 2019 orignal <i2porignal@yandex.ru> - 2.26.0
|
||||||
|
- update to 2.26.0
|
||||||
|
|
||||||
|
* Thu May 9 2019 orignal <i2porignal@yandex.ru> - 2.25.0
|
||||||
|
- update to 2.25.0
|
||||||
|
|
||||||
|
* Thu Mar 21 2019 orignal <i2porignal@yandex.ru> - 2.24.0
|
||||||
|
- update to 2.24.0
|
||||||
|
|
||||||
|
* Mon Jan 21 2019 orignal <i2porignal@yandex.ru> - 2.23.0
|
||||||
|
- update to 2.23.0
|
||||||
|
|
||||||
|
* Fri Nov 09 2018 r4sas <r4sas@i2pmail.org> - 2.22.0
|
||||||
|
- update to 2.22.0
|
||||||
|
- add support of tunnelsdir option
|
||||||
|
|
||||||
|
* Mon Oct 22 2018 orignal <i2porignal@yandex.ru> - 2.21.1
|
||||||
- update to 2.21.1
|
- update to 2.21.1
|
||||||
|
|
||||||
* Thu Oct 4 2018 orignal <i2porignal@yandex.ru> - 2.21.0
|
* Thu Oct 4 2018 orignal <i2porignal@yandex.ru> - 2.21.0
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
http://inr.i2p/export/alive-hosts.txt
|
http://reg.i2p/hosts.txt
|
||||||
|
http://identiguy.i2p/hosts.txt
|
||||||
http://stats.i2p/cgi-bin/newhosts.txt
|
http://stats.i2p/cgi-bin/newhosts.txt
|
||||||
http://i2p-projekt.i2p/hosts.txt
|
http://i2p-projekt.i2p/hosts.txt
|
||||||
|
|||||||
7
contrib/tunnels.d/IRC-Ilita.conf
Normal file
7
contrib/tunnels.d/IRC-Ilita.conf
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#[IRC-ILITA]
|
||||||
|
#type = client
|
||||||
|
#address = 127.0.0.1
|
||||||
|
#port = 6669
|
||||||
|
#destination = irc.ilita.i2p
|
||||||
|
#destinationport = 6667
|
||||||
|
#keys = irc-keys.dat
|
||||||
7
contrib/tunnels.d/IRC-Irc2P.conf
Normal file
7
contrib/tunnels.d/IRC-Irc2P.conf
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#[IRC-IRC2P]
|
||||||
|
#type = client
|
||||||
|
#address = 127.0.0.1
|
||||||
|
#port = 6668
|
||||||
|
#destination = irc.postman.i2p
|
||||||
|
#destinationport = 6667
|
||||||
|
#keys = irc-keys.dat
|
||||||
4
contrib/tunnels.d/README
Normal file
4
contrib/tunnels.d/README
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# In that directory you can store separated config files for every tunnel.
|
||||||
|
# Please read documentation for more info.
|
||||||
|
#
|
||||||
|
# You can find examples in /usr/share/doc/i2pd/tunnels.d directory
|
||||||
@@ -1,3 +1,11 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013-2020, The PurpleI2P Project
|
||||||
|
*
|
||||||
|
* This file is part of Purple i2pd project and licensed under BSD3
|
||||||
|
*
|
||||||
|
* See full license text in LICENSE file at top of project tree
|
||||||
|
*/
|
||||||
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@@ -9,7 +17,6 @@
|
|||||||
#include "Base.h"
|
#include "Base.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "Transports.h"
|
#include "Transports.h"
|
||||||
#include "NTCPSession.h"
|
|
||||||
#include "RouterInfo.h"
|
#include "RouterInfo.h"
|
||||||
#include "RouterContext.h"
|
#include "RouterContext.h"
|
||||||
#include "Tunnel.h"
|
#include "Tunnel.h"
|
||||||
@@ -23,365 +30,445 @@
|
|||||||
#include "ClientContext.h"
|
#include "ClientContext.h"
|
||||||
#include "Crypto.h"
|
#include "Crypto.h"
|
||||||
#include "UPnP.h"
|
#include "UPnP.h"
|
||||||
|
#include "Timestamp.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#include "Event.h"
|
|
||||||
#include "Websocket.h"
|
|
||||||
|
|
||||||
namespace i2p
|
namespace i2p
|
||||||
{
|
{
|
||||||
namespace util
|
namespace util
|
||||||
|
{
|
||||||
|
class Daemon_Singleton::Daemon_Singleton_Private
|
||||||
{
|
{
|
||||||
class Daemon_Singleton::Daemon_Singleton_Private
|
public:
|
||||||
{
|
Daemon_Singleton_Private() {};
|
||||||
public:
|
~Daemon_Singleton_Private() {};
|
||||||
Daemon_Singleton_Private() {};
|
|
||||||
~Daemon_Singleton_Private() {};
|
|
||||||
|
|
||||||
std::unique_ptr<i2p::http::HTTPServer> httpServer;
|
std::unique_ptr<i2p::http::HTTPServer> httpServer;
|
||||||
std::unique_ptr<i2p::client::I2PControlService> m_I2PControlService;
|
std::unique_ptr<i2p::client::I2PControlService> m_I2PControlService;
|
||||||
std::unique_ptr<i2p::transport::UPnP> UPnP;
|
std::unique_ptr<i2p::transport::UPnP> UPnP;
|
||||||
#ifdef WITH_EVENTS
|
std::unique_ptr<i2p::util::NTPTimeSync> m_NTPSync;
|
||||||
std::unique_ptr<i2p::event::WebsocketServer> m_WebsocketServer;
|
};
|
||||||
|
|
||||||
|
Daemon_Singleton::Daemon_Singleton() : isDaemon(false), running(true), d(*new Daemon_Singleton_Private()) {}
|
||||||
|
Daemon_Singleton::~Daemon_Singleton() {
|
||||||
|
delete &d;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Daemon_Singleton::IsService () const
|
||||||
|
{
|
||||||
|
bool service = false;
|
||||||
|
#ifndef _WIN32
|
||||||
|
i2p::config::GetOption("service", service);
|
||||||
#endif
|
#endif
|
||||||
};
|
return service;
|
||||||
|
}
|
||||||
|
|
||||||
Daemon_Singleton::Daemon_Singleton() : isDaemon(false), running(true), d(*new Daemon_Singleton_Private()) {}
|
bool Daemon_Singleton::init(int argc, char* argv[]) {
|
||||||
Daemon_Singleton::~Daemon_Singleton() {
|
return init(argc, argv, nullptr);
|
||||||
delete &d;
|
}
|
||||||
|
|
||||||
|
bool Daemon_Singleton::init(int argc, char* argv[], std::shared_ptr<std::ostream> logstream)
|
||||||
|
{
|
||||||
|
i2p::config::Init();
|
||||||
|
i2p::config::ParseCmdline(argc, argv);
|
||||||
|
|
||||||
|
std::string config; i2p::config::GetOption("conf", config);
|
||||||
|
std::string datadir; i2p::config::GetOption("datadir", datadir);
|
||||||
|
i2p::fs::DetectDataDir(datadir, IsService());
|
||||||
|
i2p::fs::Init();
|
||||||
|
|
||||||
|
datadir = i2p::fs::GetDataDir();
|
||||||
|
|
||||||
|
if (config == "")
|
||||||
|
{
|
||||||
|
config = i2p::fs::DataDirPath("i2pd.conf");
|
||||||
|
if (!i2p::fs::Exists (config)) {
|
||||||
|
// use i2pd.conf only if exists
|
||||||
|
config = ""; /* reset */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Daemon_Singleton::IsService () const
|
i2p::config::ParseConfig(config);
|
||||||
{
|
i2p::config::Finalize();
|
||||||
bool service = false;
|
|
||||||
#ifndef _WIN32
|
i2p::config::GetOption("daemon", isDaemon);
|
||||||
i2p::config::GetOption("service", service);
|
|
||||||
|
std::string logs = ""; i2p::config::GetOption("log", logs);
|
||||||
|
std::string logfile = ""; i2p::config::GetOption("logfile", logfile);
|
||||||
|
std::string loglevel = ""; i2p::config::GetOption("loglevel", loglevel);
|
||||||
|
bool logclftime; i2p::config::GetOption("logclftime", logclftime);
|
||||||
|
|
||||||
|
/* setup logging */
|
||||||
|
if (logclftime)
|
||||||
|
i2p::log::Logger().SetTimeFormat ("[%d/%b/%Y:%H:%M:%S %z]");
|
||||||
|
|
||||||
|
#ifdef WIN32_APP
|
||||||
|
// Win32 app with GUI supports only logging to file
|
||||||
|
logs = "file";
|
||||||
|
#else
|
||||||
|
if (isDaemon && (logs == "" || logs == "stdout"))
|
||||||
|
logs = "file";
|
||||||
#endif
|
#endif
|
||||||
return service;
|
|
||||||
|
i2p::log::Logger().SetLogLevel(loglevel);
|
||||||
|
if (logstream) {
|
||||||
|
LogPrint(eLogInfo, "Log: will send messages to std::ostream");
|
||||||
|
i2p::log::Logger().SendTo (logstream);
|
||||||
|
} else if (logs == "file") {
|
||||||
|
if (logfile == "")
|
||||||
|
logfile = i2p::fs::DataDirPath("i2pd.log");
|
||||||
|
LogPrint(eLogInfo, "Log: will send messages to ", logfile);
|
||||||
|
i2p::log::Logger().SendTo (logfile);
|
||||||
|
#ifndef _WIN32
|
||||||
|
} else if (logs == "syslog") {
|
||||||
|
LogPrint(eLogInfo, "Log: will send messages to syslog");
|
||||||
|
i2p::log::Logger().SendTo("i2pd", LOG_DAEMON);
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
// use stdout -- default
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Daemon_Singleton::init(int argc, char* argv[]) {
|
LogPrint(eLogNone, "i2pd v", VERSION, " starting");
|
||||||
return init(argc, argv, nullptr);
|
LogPrint(eLogDebug, "FS: main config file: ", config);
|
||||||
}
|
LogPrint(eLogDebug, "FS: data directory: ", datadir);
|
||||||
|
|
||||||
bool Daemon_Singleton::init(int argc, char* argv[], std::shared_ptr<std::ostream> logstream)
|
bool precomputation; i2p::config::GetOption("precomputation.elgamal", precomputation);
|
||||||
{
|
bool aesni; i2p::config::GetOption("cpuext.aesni", aesni);
|
||||||
i2p::config::Init();
|
bool avx; i2p::config::GetOption("cpuext.avx", avx);
|
||||||
i2p::config::ParseCmdline(argc, argv);
|
bool forceCpuExt; i2p::config::GetOption("cpuext.force", forceCpuExt);
|
||||||
|
i2p::crypto::InitCrypto (precomputation, aesni, avx, forceCpuExt);
|
||||||
|
|
||||||
std::string config; i2p::config::GetOption("conf", config);
|
int netID; i2p::config::GetOption("netid", netID);
|
||||||
std::string datadir; i2p::config::GetOption("datadir", datadir);
|
i2p::context.SetNetID (netID);
|
||||||
i2p::fs::DetectDataDir(datadir, IsService());
|
i2p::context.Init ();
|
||||||
i2p::fs::Init();
|
|
||||||
|
|
||||||
datadir = i2p::fs::GetDataDir();
|
bool ipv6; i2p::config::GetOption("ipv6", ipv6);
|
||||||
// TODO: drop old name detection in v2.8.0
|
bool ipv4; i2p::config::GetOption("ipv4", ipv4);
|
||||||
if (config == "")
|
|
||||||
{
|
|
||||||
config = i2p::fs::DataDirPath("i2p.conf");
|
|
||||||
if (i2p::fs::Exists (config)) {
|
|
||||||
LogPrint(eLogWarning, "Daemon: please rename i2p.conf to i2pd.conf here: ", config);
|
|
||||||
} else {
|
|
||||||
config = i2p::fs::DataDirPath("i2pd.conf");
|
|
||||||
if (!i2p::fs::Exists (config)) {
|
|
||||||
// use i2pd.conf only if exists
|
|
||||||
config = ""; /* reset */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
i2p::config::ParseConfig(config);
|
|
||||||
i2p::config::Finalize();
|
|
||||||
|
|
||||||
i2p::config::GetOption("daemon", isDaemon);
|
|
||||||
|
|
||||||
std::string logs = ""; i2p::config::GetOption("log", logs);
|
|
||||||
std::string logfile = ""; i2p::config::GetOption("logfile", logfile);
|
|
||||||
std::string loglevel = ""; i2p::config::GetOption("loglevel", loglevel);
|
|
||||||
bool logclftime; i2p::config::GetOption("logclftime", logclftime);
|
|
||||||
|
|
||||||
/* setup logging */
|
|
||||||
if (logclftime)
|
|
||||||
i2p::log::Logger().SetTimeFormat ("[%d/%b/%Y:%H:%M:%S %z]");
|
|
||||||
|
|
||||||
if (isDaemon && (logs == "" || logs == "stdout"))
|
|
||||||
logs = "file";
|
|
||||||
|
|
||||||
i2p::log::Logger().SetLogLevel(loglevel);
|
|
||||||
if (logstream) {
|
|
||||||
LogPrint(eLogInfo, "Log: will send messages to std::ostream");
|
|
||||||
i2p::log::Logger().SendTo (logstream);
|
|
||||||
} else if (logs == "file") {
|
|
||||||
if (logfile == "")
|
|
||||||
logfile = i2p::fs::DataDirPath("i2pd.log");
|
|
||||||
LogPrint(eLogInfo, "Log: will send messages to ", logfile);
|
|
||||||
i2p::log::Logger().SendTo (logfile);
|
|
||||||
#ifndef _WIN32
|
|
||||||
} else if (logs == "syslog") {
|
|
||||||
LogPrint(eLogInfo, "Log: will send messages to syslog");
|
|
||||||
i2p::log::Logger().SendTo("i2pd", LOG_DAEMON);
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
// use stdout -- default
|
|
||||||
}
|
|
||||||
|
|
||||||
LogPrint(eLogInfo, "i2pd v", VERSION, " starting");
|
|
||||||
LogPrint(eLogDebug, "FS: main config file: ", config);
|
|
||||||
LogPrint(eLogDebug, "FS: data directory: ", datadir);
|
|
||||||
|
|
||||||
bool precomputation; i2p::config::GetOption("precomputation.elgamal", precomputation);
|
|
||||||
i2p::crypto::InitCrypto (precomputation);
|
|
||||||
|
|
||||||
int netID; i2p::config::GetOption("netid", netID);
|
|
||||||
i2p::context.SetNetID (netID);
|
|
||||||
i2p::context.Init ();
|
|
||||||
|
|
||||||
bool ipv6; i2p::config::GetOption("ipv6", ipv6);
|
|
||||||
bool ipv4; i2p::config::GetOption("ipv4", ipv4);
|
|
||||||
#ifdef MESHNET
|
#ifdef MESHNET
|
||||||
// manual override for meshnet
|
// manual override for meshnet
|
||||||
ipv4 = false;
|
ipv4 = false;
|
||||||
ipv6 = true;
|
ipv6 = true;
|
||||||
#endif
|
#endif
|
||||||
uint16_t port; i2p::config::GetOption("port", port);
|
// ifname -> address
|
||||||
if (!i2p::config::IsDefault("port"))
|
std::string ifname; i2p::config::GetOption("ifname", ifname);
|
||||||
{
|
if (ipv4 && i2p::config::IsDefault ("address4"))
|
||||||
LogPrint(eLogInfo, "Daemon: accepting incoming connections at port ", port);
|
{
|
||||||
i2p::context.UpdatePort (port);
|
std::string ifname4; i2p::config::GetOption("ifname4", ifname4);
|
||||||
}
|
if (!ifname4.empty ())
|
||||||
i2p::context.SetSupportsV6 (ipv6);
|
i2p::config::SetOption ("address4", i2p::util::net::GetInterfaceAddress(ifname4, false).to_string ()); // v4
|
||||||
i2p::context.SetSupportsV4 (ipv4);
|
else if (!ifname.empty ())
|
||||||
|
i2p::config::SetOption ("address4", i2p::util::net::GetInterfaceAddress(ifname, false).to_string ()); // v4
|
||||||
bool ntcp2; i2p::config::GetOption("ntcp2.enabled", ntcp2);
|
}
|
||||||
if (ntcp2)
|
if (ipv6 && i2p::config::IsDefault ("address6"))
|
||||||
{
|
{
|
||||||
bool published; i2p::config::GetOption("ntcp2.published", published);
|
std::string ifname6; i2p::config::GetOption("ifname6", ifname6);
|
||||||
if (published)
|
if (!ifname6.empty ())
|
||||||
{
|
i2p::config::SetOption ("address6", i2p::util::net::GetInterfaceAddress(ifname6, true).to_string ()); // v6
|
||||||
uint16_t port; i2p::config::GetOption("ntcp2.port", port);
|
else if (!ifname.empty ())
|
||||||
i2p::context.PublishNTCP2Address (port, true); // publish
|
i2p::config::SetOption ("address6", i2p::util::net::GetInterfaceAddress(ifname, true).to_string ()); // v6
|
||||||
}
|
|
||||||
else
|
|
||||||
i2p::context.PublishNTCP2Address (port, false); // unpublish
|
|
||||||
}
|
|
||||||
|
|
||||||
bool transit; i2p::config::GetOption("notransit", transit);
|
|
||||||
i2p::context.SetAcceptsTunnels (!transit);
|
|
||||||
uint16_t transitTunnels; i2p::config::GetOption("limits.transittunnels", transitTunnels);
|
|
||||||
SetMaxNumTransitTunnels (transitTunnels);
|
|
||||||
|
|
||||||
bool isFloodfill; i2p::config::GetOption("floodfill", isFloodfill);
|
|
||||||
if (isFloodfill) {
|
|
||||||
LogPrint(eLogInfo, "Daemon: router will be floodfill");
|
|
||||||
i2p::context.SetFloodfill (true);
|
|
||||||
} else {
|
|
||||||
i2p::context.SetFloodfill (false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* this section also honors 'floodfill' flag, if set above */
|
|
||||||
std::string bandwidth; i2p::config::GetOption("bandwidth", bandwidth);
|
|
||||||
if (bandwidth.length () > 0)
|
|
||||||
{
|
|
||||||
if (bandwidth[0] >= 'K' && bandwidth[0] <= 'X')
|
|
||||||
{
|
|
||||||
i2p::context.SetBandwidth (bandwidth[0]);
|
|
||||||
LogPrint(eLogInfo, "Daemon: bandwidth set to ", i2p::context.GetBandwidthLimit (), "KBps");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
auto value = std::atoi(bandwidth.c_str());
|
|
||||||
if (value > 0)
|
|
||||||
{
|
|
||||||
i2p::context.SetBandwidth (value);
|
|
||||||
LogPrint(eLogInfo, "Daemon: bandwidth set to ", i2p::context.GetBandwidthLimit (), " KBps");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LogPrint(eLogInfo, "Daemon: unexpected bandwidth ", bandwidth, ". Set to 'low'");
|
|
||||||
i2p::context.SetBandwidth (i2p::data::CAPS_FLAG_LOW_BANDWIDTH2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (isFloodfill)
|
|
||||||
{
|
|
||||||
LogPrint(eLogInfo, "Daemon: floodfill bandwidth set to 'extra'");
|
|
||||||
i2p::context.SetBandwidth (i2p::data::CAPS_FLAG_EXTRA_BANDWIDTH1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LogPrint(eLogInfo, "Daemon: bandwidth set to 'low'");
|
|
||||||
i2p::context.SetBandwidth (i2p::data::CAPS_FLAG_LOW_BANDWIDTH2);
|
|
||||||
}
|
|
||||||
|
|
||||||
int shareRatio; i2p::config::GetOption("share", shareRatio);
|
|
||||||
i2p::context.SetShareRatio (shareRatio);
|
|
||||||
|
|
||||||
std::string family; i2p::config::GetOption("family", family);
|
|
||||||
i2p::context.SetFamily (family);
|
|
||||||
if (family.length () > 0)
|
|
||||||
LogPrint(eLogInfo, "Daemon: family set to ", family);
|
|
||||||
|
|
||||||
bool trust; i2p::config::GetOption("trust.enabled", trust);
|
|
||||||
if (trust)
|
|
||||||
{
|
|
||||||
LogPrint(eLogInfo, "Daemon: explicit trust enabled");
|
|
||||||
std::string fam; i2p::config::GetOption("trust.family", fam);
|
|
||||||
std::string routers; i2p::config::GetOption("trust.routers", routers);
|
|
||||||
bool restricted = false;
|
|
||||||
if (fam.length() > 0)
|
|
||||||
{
|
|
||||||
std::set<std::string> fams;
|
|
||||||
size_t pos = 0, comma;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
comma = fam.find (',', pos);
|
|
||||||
fams.insert (fam.substr (pos, comma != std::string::npos ? comma - pos : std::string::npos));
|
|
||||||
pos = comma + 1;
|
|
||||||
}
|
|
||||||
while (comma != std::string::npos);
|
|
||||||
i2p::transport::transports.RestrictRoutesToFamilies(fams);
|
|
||||||
restricted = fams.size() > 0;
|
|
||||||
}
|
|
||||||
if (routers.length() > 0) {
|
|
||||||
std::set<i2p::data::IdentHash> idents;
|
|
||||||
size_t pos = 0, comma;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
comma = routers.find (',', pos);
|
|
||||||
i2p::data::IdentHash ident;
|
|
||||||
ident.FromBase64 (routers.substr (pos, comma != std::string::npos ? comma - pos : std::string::npos));
|
|
||||||
idents.insert (ident);
|
|
||||||
pos = comma + 1;
|
|
||||||
}
|
|
||||||
while (comma != std::string::npos);
|
|
||||||
LogPrint(eLogInfo, "Daemon: setting restricted routes to use ", idents.size(), " trusted routesrs");
|
|
||||||
i2p::transport::transports.RestrictRoutesToRouters(idents);
|
|
||||||
restricted = idents.size() > 0;
|
|
||||||
}
|
|
||||||
if(!restricted)
|
|
||||||
LogPrint(eLogError, "Daemon: no trusted routers of families specififed");
|
|
||||||
}
|
|
||||||
bool hidden; i2p::config::GetOption("trust.hidden", hidden);
|
|
||||||
if (hidden)
|
|
||||||
{
|
|
||||||
LogPrint(eLogInfo, "Daemon: using hidden mode");
|
|
||||||
i2p::data::netdb.SetHidden(true);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Daemon_Singleton::start()
|
bool ygg; i2p::config::GetOption("meshnets.yggdrasil", ygg);
|
||||||
|
boost::asio::ip::address_v6 yggaddr;
|
||||||
|
if (ygg)
|
||||||
{
|
{
|
||||||
i2p::log::Logger().Start();
|
std::string yggaddress; i2p::config::GetOption ("meshnets.yggaddress", yggaddress);
|
||||||
LogPrint(eLogInfo, "Daemon: starting NetDB");
|
if (!yggaddress.empty ())
|
||||||
i2p::data::netdb.Start();
|
{
|
||||||
|
yggaddr = boost::asio::ip::address_v6::from_string (yggaddress);
|
||||||
bool upnp; i2p::config::GetOption("upnp.enabled", upnp);
|
if (yggaddr.is_unspecified () || !i2p::util::net::IsYggdrasilAddress (yggaddr) ||
|
||||||
if (upnp) {
|
!i2p::util::net::IsLocalAddress (yggaddr))
|
||||||
d.UPnP = std::unique_ptr<i2p::transport::UPnP>(new i2p::transport::UPnP);
|
{
|
||||||
d.UPnP->Start ();
|
LogPrint(eLogWarning, "Daemon: Can't find Yggdrasil address ", yggaddress);
|
||||||
|
ygg = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ntcp; i2p::config::GetOption("ntcp", ntcp);
|
|
||||||
bool ssu; i2p::config::GetOption("ssu", ssu);
|
|
||||||
LogPrint(eLogInfo, "Daemon: starting Transports");
|
|
||||||
if(!ssu) LogPrint(eLogInfo, "Daemon: ssu disabled");
|
|
||||||
if(!ntcp) LogPrint(eLogInfo, "Daemon: ntcp disabled");
|
|
||||||
|
|
||||||
i2p::transport::transports.Start(ntcp, ssu);
|
|
||||||
if (i2p::transport::transports.IsBoundNTCP() || i2p::transport::transports.IsBoundSSU() || i2p::transport::transports.IsBoundNTCP2())
|
|
||||||
LogPrint(eLogInfo, "Daemon: Transports started");
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogPrint(eLogError, "Daemon: failed to start Transports");
|
yggaddr = i2p::util::net::GetYggdrasilAddress ();
|
||||||
/** shut down netdb right away */
|
if (yggaddr.is_unspecified ())
|
||||||
i2p::transport::transports.Stop();
|
{
|
||||||
i2p::data::netdb.Stop();
|
LogPrint(eLogWarning, "Daemon: Yggdrasil is not running. Disabled");
|
||||||
return false;
|
ygg = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool http; i2p::config::GetOption("http.enabled", http);
|
uint16_t port; i2p::config::GetOption("port", port);
|
||||||
if (http) {
|
if (!i2p::config::IsDefault("port"))
|
||||||
std::string httpAddr; i2p::config::GetOption("http.address", httpAddr);
|
{
|
||||||
uint16_t httpPort; i2p::config::GetOption("http.port", httpPort);
|
LogPrint(eLogInfo, "Daemon: accepting incoming connections at port ", port);
|
||||||
LogPrint(eLogInfo, "Daemon: starting HTTP Server at ", httpAddr, ":", httpPort);
|
i2p::context.UpdatePort (port);
|
||||||
|
}
|
||||||
|
i2p::context.SetSupportsV6 (ipv6);
|
||||||
|
i2p::context.SetSupportsV4 (ipv4);
|
||||||
|
i2p::context.SetSupportsMesh (ygg, yggaddr);
|
||||||
|
|
||||||
|
i2p::context.RemoveNTCPAddress (!ipv6); // TODO: remove later
|
||||||
|
bool ntcp2; i2p::config::GetOption("ntcp2.enabled", ntcp2);
|
||||||
|
if (ntcp2)
|
||||||
|
{
|
||||||
|
bool published; i2p::config::GetOption("ntcp2.published", published);
|
||||||
|
if (published)
|
||||||
|
{
|
||||||
|
std::string ntcp2proxy; i2p::config::GetOption("ntcp2.proxy", ntcp2proxy);
|
||||||
|
if (!ntcp2proxy.empty ()) published = false;
|
||||||
|
}
|
||||||
|
if (published)
|
||||||
|
{
|
||||||
|
uint16_t ntcp2port; i2p::config::GetOption("ntcp2.port", ntcp2port);
|
||||||
|
if (!ntcp2port) ntcp2port = port; // use standard port
|
||||||
|
i2p::context.PublishNTCP2Address (ntcp2port, true); // publish
|
||||||
|
if (ipv6)
|
||||||
|
{
|
||||||
|
std::string ipv6Addr; i2p::config::GetOption("ntcp2.addressv6", ipv6Addr);
|
||||||
|
auto addr = boost::asio::ip::address_v6::from_string (ipv6Addr);
|
||||||
|
if (!addr.is_unspecified () && addr != boost::asio::ip::address_v6::any ())
|
||||||
|
i2p::context.UpdateNTCP2V6Address (addr); // set ipv6 address if configured
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
i2p::context.PublishNTCP2Address (port, false); // unpublish
|
||||||
|
}
|
||||||
|
if (ygg)
|
||||||
|
{
|
||||||
|
if (!ntcp2)
|
||||||
|
i2p::context.PublishNTCP2Address (port, true);
|
||||||
|
i2p::context.UpdateNTCP2V6Address (yggaddr);
|
||||||
|
if (!ipv4 && !ipv6)
|
||||||
|
i2p::context.SetStatus (eRouterStatusMesh);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool transit; i2p::config::GetOption("notransit", transit);
|
||||||
|
i2p::context.SetAcceptsTunnels (!transit);
|
||||||
|
uint16_t transitTunnels; i2p::config::GetOption("limits.transittunnels", transitTunnels);
|
||||||
|
SetMaxNumTransitTunnels (transitTunnels);
|
||||||
|
|
||||||
|
bool isFloodfill; i2p::config::GetOption("floodfill", isFloodfill);
|
||||||
|
if (isFloodfill) {
|
||||||
|
LogPrint(eLogInfo, "Daemon: router will be floodfill");
|
||||||
|
i2p::context.SetFloodfill (true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
i2p::context.SetFloodfill (false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* this section also honors 'floodfill' flag, if set above */
|
||||||
|
std::string bandwidth; i2p::config::GetOption("bandwidth", bandwidth);
|
||||||
|
if (bandwidth.length () > 0)
|
||||||
|
{
|
||||||
|
if (bandwidth[0] >= 'K' && bandwidth[0] <= 'X')
|
||||||
|
{
|
||||||
|
i2p::context.SetBandwidth (bandwidth[0]);
|
||||||
|
LogPrint(eLogInfo, "Daemon: bandwidth set to ", i2p::context.GetBandwidthLimit (), "KBps");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto value = std::atoi(bandwidth.c_str());
|
||||||
|
if (value > 0)
|
||||||
|
{
|
||||||
|
i2p::context.SetBandwidth (value);
|
||||||
|
LogPrint(eLogInfo, "Daemon: bandwidth set to ", i2p::context.GetBandwidthLimit (), " KBps");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogPrint(eLogInfo, "Daemon: unexpected bandwidth ", bandwidth, ". Set to 'low'");
|
||||||
|
i2p::context.SetBandwidth (i2p::data::CAPS_FLAG_LOW_BANDWIDTH2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (isFloodfill)
|
||||||
|
{
|
||||||
|
LogPrint(eLogInfo, "Daemon: floodfill bandwidth set to 'extra'");
|
||||||
|
i2p::context.SetBandwidth (i2p::data::CAPS_FLAG_EXTRA_BANDWIDTH1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogPrint(eLogInfo, "Daemon: bandwidth set to 'low'");
|
||||||
|
i2p::context.SetBandwidth (i2p::data::CAPS_FLAG_LOW_BANDWIDTH2);
|
||||||
|
}
|
||||||
|
|
||||||
|
int shareRatio; i2p::config::GetOption("share", shareRatio);
|
||||||
|
i2p::context.SetShareRatio (shareRatio);
|
||||||
|
|
||||||
|
std::string family; i2p::config::GetOption("family", family);
|
||||||
|
i2p::context.SetFamily (family);
|
||||||
|
if (family.length () > 0)
|
||||||
|
LogPrint(eLogInfo, "Daemon: family set to ", family);
|
||||||
|
|
||||||
|
bool trust; i2p::config::GetOption("trust.enabled", trust);
|
||||||
|
if (trust)
|
||||||
|
{
|
||||||
|
LogPrint(eLogInfo, "Daemon: explicit trust enabled");
|
||||||
|
std::string fam; i2p::config::GetOption("trust.family", fam);
|
||||||
|
std::string routers; i2p::config::GetOption("trust.routers", routers);
|
||||||
|
bool restricted = false;
|
||||||
|
if (fam.length() > 0)
|
||||||
|
{
|
||||||
|
std::set<std::string> fams;
|
||||||
|
size_t pos = 0, comma;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
comma = fam.find (',', pos);
|
||||||
|
fams.insert (fam.substr (pos, comma != std::string::npos ? comma - pos : std::string::npos));
|
||||||
|
pos = comma + 1;
|
||||||
|
}
|
||||||
|
while (comma != std::string::npos);
|
||||||
|
i2p::transport::transports.RestrictRoutesToFamilies(fams);
|
||||||
|
restricted = fams.size() > 0;
|
||||||
|
}
|
||||||
|
if (routers.length() > 0) {
|
||||||
|
std::set<i2p::data::IdentHash> idents;
|
||||||
|
size_t pos = 0, comma;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
comma = routers.find (',', pos);
|
||||||
|
i2p::data::IdentHash ident;
|
||||||
|
ident.FromBase64 (routers.substr (pos, comma != std::string::npos ? comma - pos : std::string::npos));
|
||||||
|
idents.insert (ident);
|
||||||
|
pos = comma + 1;
|
||||||
|
}
|
||||||
|
while (comma != std::string::npos);
|
||||||
|
LogPrint(eLogInfo, "Daemon: setting restricted routes to use ", idents.size(), " trusted routers");
|
||||||
|
i2p::transport::transports.RestrictRoutesToRouters(idents);
|
||||||
|
restricted = idents.size() > 0;
|
||||||
|
}
|
||||||
|
if(!restricted)
|
||||||
|
LogPrint(eLogError, "Daemon: no trusted routers of families specified");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool hidden; i2p::config::GetOption("trust.hidden", hidden);
|
||||||
|
if (hidden)
|
||||||
|
{
|
||||||
|
LogPrint(eLogInfo, "Daemon: using hidden mode");
|
||||||
|
i2p::data::netdb.SetHidden(true);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Daemon_Singleton::start()
|
||||||
|
{
|
||||||
|
i2p::log::Logger().Start();
|
||||||
|
LogPrint(eLogInfo, "Daemon: starting NetDB");
|
||||||
|
i2p::data::netdb.Start();
|
||||||
|
|
||||||
|
bool upnp; i2p::config::GetOption("upnp.enabled", upnp);
|
||||||
|
if (upnp) {
|
||||||
|
d.UPnP = std::unique_ptr<i2p::transport::UPnP>(new i2p::transport::UPnP);
|
||||||
|
d.UPnP->Start ();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nettime; i2p::config::GetOption("nettime.enabled", nettime);
|
||||||
|
if (nettime)
|
||||||
|
{
|
||||||
|
d.m_NTPSync = std::unique_ptr<i2p::util::NTPTimeSync>(new i2p::util::NTPTimeSync);
|
||||||
|
d.m_NTPSync->Start ();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ntcp2; i2p::config::GetOption("ntcp2.enabled", ntcp2);
|
||||||
|
bool ssu; i2p::config::GetOption("ssu", ssu);
|
||||||
|
bool checkInReserved; i2p::config::GetOption("reservedrange", checkInReserved);
|
||||||
|
LogPrint(eLogInfo, "Daemon: starting Transports");
|
||||||
|
if(!ssu) LogPrint(eLogInfo, "Daemon: ssu disabled");
|
||||||
|
if(!ntcp2) LogPrint(eLogInfo, "Daemon: ntcp2 disabled");
|
||||||
|
|
||||||
|
i2p::transport::transports.SetCheckReserved(checkInReserved);
|
||||||
|
i2p::transport::transports.Start(ntcp2, ssu);
|
||||||
|
if (i2p::transport::transports.IsBoundSSU() || i2p::transport::transports.IsBoundNTCP2())
|
||||||
|
LogPrint(eLogInfo, "Daemon: Transports started");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogPrint(eLogError, "Daemon: failed to start Transports");
|
||||||
|
/** shut down netdb right away */
|
||||||
|
i2p::transport::transports.Stop();
|
||||||
|
i2p::data::netdb.Stop();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool http; i2p::config::GetOption("http.enabled", http);
|
||||||
|
if (http) {
|
||||||
|
std::string httpAddr; i2p::config::GetOption("http.address", httpAddr);
|
||||||
|
uint16_t httpPort; i2p::config::GetOption("http.port", httpPort);
|
||||||
|
LogPrint(eLogInfo, "Daemon: starting webconsole at ", httpAddr, ":", httpPort);
|
||||||
|
try
|
||||||
|
{
|
||||||
d.httpServer = std::unique_ptr<i2p::http::HTTPServer>(new i2p::http::HTTPServer(httpAddr, httpPort));
|
d.httpServer = std::unique_ptr<i2p::http::HTTPServer>(new i2p::http::HTTPServer(httpAddr, httpPort));
|
||||||
d.httpServer->Start();
|
d.httpServer->Start();
|
||||||
}
|
}
|
||||||
|
catch (std::exception& ex)
|
||||||
|
{
|
||||||
|
LogPrint (eLogError, "Daemon: failed to start webconsole: ", ex.what ());
|
||||||
|
ThrowFatal ("Unable to start webconsole at ", httpAddr, ":", httpPort, ": ", ex.what ());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
LogPrint(eLogInfo, "Daemon: starting Tunnels");
|
LogPrint(eLogInfo, "Daemon: starting Tunnels");
|
||||||
i2p::tunnel::tunnels.Start();
|
i2p::tunnel::tunnels.Start();
|
||||||
|
|
||||||
LogPrint(eLogInfo, "Daemon: starting Client");
|
LogPrint(eLogInfo, "Daemon: starting Client");
|
||||||
i2p::client::context.Start ();
|
i2p::client::context.Start ();
|
||||||
|
|
||||||
// I2P Control Protocol
|
// I2P Control Protocol
|
||||||
bool i2pcontrol; i2p::config::GetOption("i2pcontrol.enabled", i2pcontrol);
|
bool i2pcontrol; i2p::config::GetOption("i2pcontrol.enabled", i2pcontrol);
|
||||||
if (i2pcontrol) {
|
if (i2pcontrol) {
|
||||||
std::string i2pcpAddr; i2p::config::GetOption("i2pcontrol.address", i2pcpAddr);
|
std::string i2pcpAddr; i2p::config::GetOption("i2pcontrol.address", i2pcpAddr);
|
||||||
uint16_t i2pcpPort; i2p::config::GetOption("i2pcontrol.port", i2pcpPort);
|
uint16_t i2pcpPort; i2p::config::GetOption("i2pcontrol.port", i2pcpPort);
|
||||||
LogPrint(eLogInfo, "Daemon: starting I2PControl at ", i2pcpAddr, ":", i2pcpPort);
|
LogPrint(eLogInfo, "Daemon: starting I2PControl at ", i2pcpAddr, ":", i2pcpPort);
|
||||||
|
try
|
||||||
|
{
|
||||||
d.m_I2PControlService = std::unique_ptr<i2p::client::I2PControlService>(new i2p::client::I2PControlService (i2pcpAddr, i2pcpPort));
|
d.m_I2PControlService = std::unique_ptr<i2p::client::I2PControlService>(new i2p::client::I2PControlService (i2pcpAddr, i2pcpPort));
|
||||||
d.m_I2PControlService->Start ();
|
d.m_I2PControlService->Start ();
|
||||||
}
|
}
|
||||||
#ifdef WITH_EVENTS
|
catch (std::exception& ex)
|
||||||
|
|
||||||
bool websocket; i2p::config::GetOption("websockets.enabled", websocket);
|
|
||||||
if(websocket) {
|
|
||||||
std::string websocketAddr; i2p::config::GetOption("websockets.address", websocketAddr);
|
|
||||||
uint16_t websocketPort; i2p::config::GetOption("websockets.port", websocketPort);
|
|
||||||
LogPrint(eLogInfo, "Daemon: starting Websocket server at ", websocketAddr, ":", websocketPort);
|
|
||||||
d.m_WebsocketServer = std::unique_ptr<i2p::event::WebsocketServer>(new i2p::event::WebsocketServer (websocketAddr, websocketPort));
|
|
||||||
d.m_WebsocketServer->Start();
|
|
||||||
i2p::event::core.SetListener(d.m_WebsocketServer->ToListener());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Daemon_Singleton::stop()
|
|
||||||
{
|
|
||||||
#ifdef WITH_EVENTS
|
|
||||||
i2p::event::core.SetListener(nullptr);
|
|
||||||
#endif
|
|
||||||
LogPrint(eLogInfo, "Daemon: shutting down");
|
|
||||||
LogPrint(eLogInfo, "Daemon: stopping Client");
|
|
||||||
i2p::client::context.Stop();
|
|
||||||
LogPrint(eLogInfo, "Daemon: stopping Tunnels");
|
|
||||||
i2p::tunnel::tunnels.Stop();
|
|
||||||
|
|
||||||
if (d.UPnP) {
|
|
||||||
d.UPnP->Stop ();
|
|
||||||
d.UPnP = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
LogPrint(eLogInfo, "Daemon: stopping Transports");
|
|
||||||
i2p::transport::transports.Stop();
|
|
||||||
LogPrint(eLogInfo, "Daemon: stopping NetDB");
|
|
||||||
i2p::data::netdb.Stop();
|
|
||||||
if (d.httpServer) {
|
|
||||||
LogPrint(eLogInfo, "Daemon: stopping HTTP Server");
|
|
||||||
d.httpServer->Stop();
|
|
||||||
d.httpServer = nullptr;
|
|
||||||
}
|
|
||||||
if (d.m_I2PControlService)
|
|
||||||
{
|
{
|
||||||
LogPrint(eLogInfo, "Daemon: stopping I2PControl");
|
LogPrint (eLogError, "Daemon: failed to start I2PControl: ", ex.what ());
|
||||||
d.m_I2PControlService->Stop ();
|
ThrowFatal ("Unable to start I2PControl service at ", i2pcpAddr, ":", i2pcpPort, ": ", ex.what ());
|
||||||
d.m_I2PControlService = nullptr;
|
|
||||||
}
|
}
|
||||||
#ifdef WITH_EVENTS
|
|
||||||
if (d.m_WebsocketServer) {
|
|
||||||
LogPrint(eLogInfo, "Daemon: stopping Websocket server");
|
|
||||||
d.m_WebsocketServer->Stop();
|
|
||||||
d.m_WebsocketServer = nullptr;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
i2p::crypto::TerminateCrypto ();
|
|
||||||
i2p::log::Logger().Stop();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Daemon_Singleton::stop()
|
||||||
|
{
|
||||||
|
LogPrint(eLogInfo, "Daemon: shutting down");
|
||||||
|
LogPrint(eLogInfo, "Daemon: stopping Client");
|
||||||
|
i2p::client::context.Stop();
|
||||||
|
LogPrint(eLogInfo, "Daemon: stopping Tunnels");
|
||||||
|
i2p::tunnel::tunnels.Stop();
|
||||||
|
|
||||||
|
if (d.UPnP)
|
||||||
|
{
|
||||||
|
d.UPnP->Stop ();
|
||||||
|
d.UPnP = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (d.m_NTPSync)
|
||||||
|
{
|
||||||
|
d.m_NTPSync->Stop ();
|
||||||
|
d.m_NTPSync = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
LogPrint(eLogInfo, "Daemon: stopping Transports");
|
||||||
|
i2p::transport::transports.Stop();
|
||||||
|
LogPrint(eLogInfo, "Daemon: stopping NetDB");
|
||||||
|
i2p::data::netdb.Stop();
|
||||||
|
if (d.httpServer) {
|
||||||
|
LogPrint(eLogInfo, "Daemon: stopping HTTP Server");
|
||||||
|
d.httpServer->Stop();
|
||||||
|
d.httpServer = nullptr;
|
||||||
|
}
|
||||||
|
if (d.m_I2PControlService)
|
||||||
|
{
|
||||||
|
LogPrint(eLogInfo, "Daemon: stopping I2PControl");
|
||||||
|
d.m_I2PControlService->Stop ();
|
||||||
|
d.m_I2PControlService = nullptr;
|
||||||
|
}
|
||||||
|
i2p::crypto::TerminateCrypto ();
|
||||||
|
i2p::log::Logger().Stop();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013-2020, The PurpleI2P Project
|
||||||
|
*
|
||||||
|
* This file is part of Purple i2pd project and licensed under BSD3
|
||||||
|
*
|
||||||
|
* See full license text in LICENSE file at top of project tree
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef DAEMON_H__
|
#ifndef DAEMON_H__
|
||||||
#define DAEMON_H__
|
#define DAEMON_H__
|
||||||
|
|
||||||
@@ -13,9 +21,10 @@ namespace util
|
|||||||
class Daemon_Singleton
|
class Daemon_Singleton
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual bool init(int argc, char* argv[], std::shared_ptr<std::ostream> logstream);
|
|
||||||
virtual bool init(int argc, char* argv[]);
|
virtual bool init(int argc, char* argv[], std::shared_ptr<std::ostream> logstream);
|
||||||
virtual bool start();
|
virtual bool init(int argc, char* argv[]);
|
||||||
|
virtual bool start();
|
||||||
virtual bool stop();
|
virtual bool stop();
|
||||||
virtual void run () {};
|
virtual void run () {};
|
||||||
|
|
||||||
@@ -23,6 +32,7 @@ namespace util
|
|||||||
bool running;
|
bool running;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
Daemon_Singleton();
|
Daemon_Singleton();
|
||||||
virtual ~Daemon_Singleton();
|
virtual ~Daemon_Singleton();
|
||||||
|
|
||||||
@@ -39,6 +49,7 @@ namespace util
|
|||||||
class DaemonQT: public i2p::util::Daemon_Singleton
|
class DaemonQT: public i2p::util::Daemon_Singleton
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static DaemonQT& Instance()
|
static DaemonQT& Instance()
|
||||||
{
|
{
|
||||||
static DaemonQT instance;
|
static DaemonQT instance;
|
||||||
@@ -51,6 +62,7 @@ namespace util
|
|||||||
class DaemonWin32 : public Daemon_Singleton
|
class DaemonWin32 : public Daemon_Singleton
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static DaemonWin32& Instance()
|
static DaemonWin32& Instance()
|
||||||
{
|
{
|
||||||
static DaemonWin32 instance;
|
static DaemonWin32 instance;
|
||||||
@@ -72,6 +84,7 @@ namespace util
|
|||||||
class DaemonAndroid: public i2p::util::Daemon_Singleton
|
class DaemonAndroid: public i2p::util::Daemon_Singleton
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static DaemonAndroid& Instance()
|
static DaemonAndroid& Instance()
|
||||||
{
|
{
|
||||||
static DaemonAndroid instance;
|
static DaemonAndroid instance;
|
||||||
@@ -83,6 +96,7 @@ namespace util
|
|||||||
class DaemonLinux : public Daemon_Singleton
|
class DaemonLinux : public Daemon_Singleton
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static DaemonLinux& Instance()
|
static DaemonLinux& Instance()
|
||||||
{
|
{
|
||||||
static DaemonLinux instance;
|
static DaemonLinux instance;
|
||||||
@@ -94,10 +108,12 @@ namespace util
|
|||||||
void run ();
|
void run ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::string pidfile;
|
std::string pidfile;
|
||||||
int pidFH;
|
int pidFH;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
int gracefulShutdownInterval; // in seconds
|
int gracefulShutdownInterval; // in seconds
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,11 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013-2020, The PurpleI2P Project
|
||||||
|
*
|
||||||
|
* This file is part of Purple i2pd project and licensed under BSD3
|
||||||
|
*
|
||||||
|
* See full license text in LICENSE file at top of project tree
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef HTTP_SERVER_H__
|
#ifndef HTTP_SERVER_H__
|
||||||
#define HTTP_SERVER_H__
|
#define HTTP_SERVER_H__
|
||||||
|
|
||||||
@@ -35,11 +43,11 @@ namespace http
|
|||||||
void HandlePage (const HTTPReq & req, HTTPRes & res, std::stringstream& data);
|
void HandlePage (const HTTPReq & req, HTTPRes & res, std::stringstream& data);
|
||||||
void HandleCommand (const HTTPReq & req, HTTPRes & res, std::stringstream& data);
|
void HandleCommand (const HTTPReq & req, HTTPRes & res, std::stringstream& data);
|
||||||
void SendReply (HTTPRes & res, std::string & content);
|
void SendReply (HTTPRes & res, std::string & content);
|
||||||
|
uint32_t CreateToken ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::shared_ptr<boost::asio::ip::tcp::socket> m_Socket;
|
std::shared_ptr<boost::asio::ip::tcp::socket> m_Socket;
|
||||||
boost::asio::deadline_timer m_Timer;
|
|
||||||
char m_Buffer[HTTP_CONNECTION_BUFFER_SIZE + 1];
|
char m_Buffer[HTTP_CONNECTION_BUFFER_SIZE + 1];
|
||||||
size_t m_BufferLen;
|
size_t m_BufferLen;
|
||||||
std::string m_SendBuffer;
|
std::string m_SendBuffer;
|
||||||
@@ -79,17 +87,19 @@ namespace http
|
|||||||
std::string m_Hostname;
|
std::string m_Hostname;
|
||||||
};
|
};
|
||||||
|
|
||||||
//all the below functions are also used by Qt GUI, see mainwindow.cpp -> getStatusPageHtml
|
//all the below functions are also used by Qt GUI, see mainwindow.cpp -> getStatusPageHtml
|
||||||
enum OutputFormatEnum { forWebConsole, forQtUi };
|
enum OutputFormatEnum { forWebConsole, forQtUi };
|
||||||
void ShowStatus (std::stringstream& s, bool includeHiddenContent, OutputFormatEnum outputFormat);
|
void ShowStatus (std::stringstream& s, bool includeHiddenContent, OutputFormatEnum outputFormat);
|
||||||
void ShowLocalDestinations (std::stringstream& s);
|
void ShowLocalDestinations (std::stringstream& s);
|
||||||
void ShowLeasesSets(std::stringstream& s);
|
void ShowLeasesSets(std::stringstream& s);
|
||||||
void ShowTunnels (std::stringstream& s);
|
void ShowTunnels (std::stringstream& s);
|
||||||
void ShowTransitTunnels (std::stringstream& s);
|
void ShowTransitTunnels (std::stringstream& s);
|
||||||
void ShowTransports (std::stringstream& s);
|
void ShowTransports (std::stringstream& s);
|
||||||
void ShowSAMSessions (std::stringstream& s);
|
void ShowSAMSessions (std::stringstream& s);
|
||||||
void ShowI2PTunnels (std::stringstream& s);
|
void ShowI2PTunnels (std::stringstream& s);
|
||||||
void ShowLocalDestination (std::stringstream& s, const std::string& b32);
|
void ShowLocalDestination (std::stringstream& s, const std::string& b32, uint32_t token);
|
||||||
|
void ShowSAMSession (std::stringstream& s, const std::string& id);
|
||||||
|
void ShowI2CPLocalDestination (std::stringstream& s, const std::string& id);
|
||||||
} // http
|
} // http
|
||||||
} // i2p
|
} // i2p
|
||||||
|
|
||||||
|
|||||||
@@ -6,12 +6,7 @@
|
|||||||
#include <boost/date_time/local_time/local_time.hpp>
|
#include <boost/date_time/local_time/local_time.hpp>
|
||||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||||
#include <boost/property_tree/ini_parser.hpp>
|
#include <boost/property_tree/ini_parser.hpp>
|
||||||
|
|
||||||
// There is bug in boost 1.49 with gcc 4.7 coming with Debian Wheezy
|
|
||||||
#define GCC47_BOOST149 ((BOOST_VERSION == 104900) && (__GNUC__ == 4) && (__GNUC_MINOR__ >= 7))
|
|
||||||
#if !GCC47_BOOST149
|
|
||||||
#include <boost/property_tree/json_parser.hpp>
|
#include <boost/property_tree/json_parser.hpp>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "Crypto.h"
|
#include "Crypto.h"
|
||||||
#include "FS.h"
|
#include "FS.h"
|
||||||
@@ -136,6 +131,8 @@ namespace client
|
|||||||
|
|
||||||
void I2PControlService::Run ()
|
void I2PControlService::Run ()
|
||||||
{
|
{
|
||||||
|
i2p::util::SetThreadName("I2PC");
|
||||||
|
|
||||||
while (m_IsRunning)
|
while (m_IsRunning)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -235,12 +232,6 @@ namespace client
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::ostringstream response;
|
std::ostringstream response;
|
||||||
#if GCC47_BOOST149
|
|
||||||
LogPrint (eLogError, "I2PControl: json_read is not supported due bug in boost 1.49 with gcc 4.7");
|
|
||||||
response << "{\"id\":null,\"error\":";
|
|
||||||
response << "{\"code\":-32603,\"message\":\"JSON requests is not supported with this version of boost\"},";
|
|
||||||
response << "\"jsonrpc\":\"2.0\"}";
|
|
||||||
#else
|
|
||||||
boost::property_tree::ptree pt;
|
boost::property_tree::ptree pt;
|
||||||
boost::property_tree::read_json (ss, pt);
|
boost::property_tree::read_json (ss, pt);
|
||||||
|
|
||||||
@@ -260,7 +251,6 @@ namespace client
|
|||||||
response << "{\"code\":-32601,\"message\":\"Method not found\"},";
|
response << "{\"code\":-32601,\"message\":\"Method not found\"},";
|
||||||
response << "\"jsonrpc\":\"2.0\"}";
|
response << "\"jsonrpc\":\"2.0\"}";
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
SendResponse (socket, buf, response, isHtml);
|
SendResponse (socket, buf, response, isHtml);
|
||||||
}
|
}
|
||||||
catch (std::exception& ex)
|
catch (std::exception& ex)
|
||||||
@@ -394,13 +384,15 @@ namespace client
|
|||||||
|
|
||||||
void I2PControlService::RouterInfoHandler (const boost::property_tree::ptree& params, std::ostringstream& results)
|
void I2PControlService::RouterInfoHandler (const boost::property_tree::ptree& params, std::ostringstream& results)
|
||||||
{
|
{
|
||||||
|
bool first = true;
|
||||||
for (auto it = params.begin (); it != params.end (); it++)
|
for (auto it = params.begin (); it != params.end (); it++)
|
||||||
{
|
{
|
||||||
LogPrint (eLogDebug, "I2PControl: RouterInfo request: ", it->first);
|
LogPrint (eLogDebug, "I2PControl: RouterInfo request: ", it->first);
|
||||||
auto it1 = m_RouterInfoHandlers.find (it->first);
|
auto it1 = m_RouterInfoHandlers.find (it->first);
|
||||||
if (it1 != m_RouterInfoHandlers.end ())
|
if (it1 != m_RouterInfoHandlers.end ())
|
||||||
{
|
{
|
||||||
if (it != params.begin ()) results << ",";
|
if (!first) results << ",";
|
||||||
|
else first = false;
|
||||||
(this->*(it1->second))(results);
|
(this->*(it1->second))(results);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -569,8 +561,8 @@ namespace client
|
|||||||
EVP_PKEY_assign_RSA (pkey, rsa);
|
EVP_PKEY_assign_RSA (pkey, rsa);
|
||||||
X509 * x509 = X509_new ();
|
X509 * x509 = X509_new ();
|
||||||
ASN1_INTEGER_set (X509_get_serialNumber (x509), 1);
|
ASN1_INTEGER_set (X509_get_serialNumber (x509), 1);
|
||||||
X509_gmtime_adj (X509_get_notBefore (x509), 0);
|
X509_gmtime_adj (X509_getm_notBefore (x509), 0);
|
||||||
X509_gmtime_adj (X509_get_notAfter (x509), I2P_CONTROL_CERTIFICATE_VALIDITY*24*60*60); // expiration
|
X509_gmtime_adj (X509_getm_notAfter (x509), I2P_CONTROL_CERTIFICATE_VALIDITY*24*60*60); // expiration
|
||||||
X509_set_pubkey (x509, pkey); // public key
|
X509_set_pubkey (x509, pkey); // public key
|
||||||
X509_NAME * name = X509_get_subject_name (x509);
|
X509_NAME * name = X509_get_subject_name (x509);
|
||||||
X509_NAME_add_entry_by_txt (name, "C", MBSTRING_ASC, (unsigned char *)"A1", -1, -1, 0); // country (Anonymous proxy)
|
X509_NAME_add_entry_by_txt (name, "C", MBSTRING_ASC, (unsigned char *)"A1", -1, -1, 0); // country (Anonymous proxy)
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013-2020, The PurpleI2P Project
|
||||||
|
*
|
||||||
|
* This file is part of Purple i2pd project and licensed under BSD3
|
||||||
|
*
|
||||||
|
* See full license text in LICENSE file at top of project tree
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef I2P_CONTROL_H__
|
#ifndef I2P_CONTROL_H__
|
||||||
#define I2P_CONTROL_H__
|
#define I2P_CONTROL_H__
|
||||||
|
|
||||||
@@ -27,6 +35,7 @@ namespace client
|
|||||||
class I2PControlService
|
class I2PControlService
|
||||||
{
|
{
|
||||||
typedef boost::asio::ssl::stream<boost::asio::ip::tcp::socket> ssl_socket;
|
typedef boost::asio::ssl::stream<boost::asio::ip::tcp::socket> ssl_socket;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
I2PControlService (const std::string& address, int port);
|
I2PControlService (const std::string& address, int port);
|
||||||
|
|||||||
148
daemon/UPnP.cpp
148
daemon/UPnP.cpp
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#include <boost/thread/thread.hpp>
|
#include <boost/thread/thread.hpp>
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
#include <boost/bind.hpp>
|
|
||||||
|
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
|
|
||||||
@@ -61,6 +60,8 @@ namespace transport
|
|||||||
|
|
||||||
void UPnP::Run ()
|
void UPnP::Run ()
|
||||||
{
|
{
|
||||||
|
i2p::util::SetThreadName("UPnP");
|
||||||
|
|
||||||
while (m_IsRunning)
|
while (m_IsRunning)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -79,43 +80,59 @@ namespace transport
|
|||||||
|
|
||||||
void UPnP::Discover ()
|
void UPnP::Discover ()
|
||||||
{
|
{
|
||||||
#if MINIUPNPC_API_VERSION >= 14
|
bool isError;
|
||||||
int nerror = 0;
|
int err;
|
||||||
m_Devlist = upnpDiscover (2000, m_MulticastIf, m_Minissdpdpath, 0, 0, 2, &nerror);
|
|
||||||
#elif ( MINIUPNPC_API_VERSION >= 8 || defined(UPNPDISCOVER_SUCCESS) )
|
#if ((MINIUPNPC_API_VERSION >= 8) || defined (UPNPDISCOVER_SUCCESS))
|
||||||
int nerror = 0;
|
err = UPNPDISCOVER_SUCCESS;
|
||||||
m_Devlist = upnpDiscover (2000, m_MulticastIf, m_Minissdpdpath, 0, 0, &nerror);
|
|
||||||
|
#if (MINIUPNPC_API_VERSION >= 14)
|
||||||
|
m_Devlist = upnpDiscover (UPNP_RESPONSE_TIMEOUT, NULL, NULL, 0, 0, 2, &err);
|
||||||
#else
|
#else
|
||||||
m_Devlist = upnpDiscover (2000, m_MulticastIf, m_Minissdpdpath, 0);
|
m_Devlist = upnpDiscover (UPNP_RESPONSE_TIMEOUT, NULL, NULL, 0, 0, &err);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
isError = err != UPNPDISCOVER_SUCCESS;
|
||||||
|
#else // MINIUPNPC_API_VERSION >= 8
|
||||||
|
err = 0;
|
||||||
|
m_Devlist = upnpDiscover (UPNP_RESPONSE_TIMEOUT, NULL, NULL, 0);
|
||||||
|
isError = m_Devlist == NULL;
|
||||||
|
#endif // MINIUPNPC_API_VERSION >= 8
|
||||||
{
|
{
|
||||||
// notify satrting thread
|
// notify starting thread
|
||||||
std::unique_lock<std::mutex> l(m_StartedMutex);
|
std::unique_lock<std::mutex> l(m_StartedMutex);
|
||||||
m_Started.notify_all ();
|
m_Started.notify_all ();
|
||||||
}
|
}
|
||||||
|
|
||||||
int r;
|
if (isError)
|
||||||
r = UPNP_GetValidIGD (m_Devlist, &m_upnpUrls, &m_upnpData, m_NetworkAddr, sizeof (m_NetworkAddr));
|
|
||||||
if (r == 1)
|
|
||||||
{
|
{
|
||||||
r = UPNP_GetExternalIPAddress (m_upnpUrls.controlURL, m_upnpData.first.servicetype, m_externalIPAddress);
|
LogPrint (eLogError, "UPnP: unable to discover Internet Gateway Devices: error ", err);
|
||||||
if(r != UPNPCOMMAND_SUCCESS)
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = UPNP_GetValidIGD (m_Devlist, &m_upnpUrls, &m_upnpData, m_NetworkAddr, sizeof (m_NetworkAddr));
|
||||||
|
m_upnpUrlsInitialized=err!=0;
|
||||||
|
if (err == UPNP_IGD_VALID_CONNECTED)
|
||||||
|
{
|
||||||
|
err = UPNP_GetExternalIPAddress (m_upnpUrls.controlURL, m_upnpData.first.servicetype, m_externalIPAddress);
|
||||||
|
if(err != UPNPCOMMAND_SUCCESS)
|
||||||
{
|
{
|
||||||
LogPrint (eLogError, "UPnP: UPNP_GetExternalIPAddress() returned ", r);
|
LogPrint (eLogError, "UPnP: unable to get external address: error ", err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
LogPrint (eLogError, "UPnP: found Internet Gateway Device ", m_upnpUrls.controlURL);
|
||||||
if (!m_externalIPAddress[0])
|
if (!m_externalIPAddress[0])
|
||||||
{
|
{
|
||||||
LogPrint (eLogError, "UPnP: GetExternalIPAddress() failed.");
|
LogPrint (eLogError, "UPnP: found Internet Gateway Device doesn't know our external address");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogPrint (eLogError, "UPnP: GetValidIGD() failed.");
|
LogPrint (eLogError, "UPnP: unable to find valid Internet Gateway Device: error ", err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,6 +143,20 @@ namespace transport
|
|||||||
PortMapping ();
|
PortMapping ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int UPnP::CheckMapping (const char* port, const char* type)
|
||||||
|
{
|
||||||
|
int err = UPNPCOMMAND_SUCCESS;
|
||||||
|
|
||||||
|
#if (MINIUPNPC_API_VERSION >= 10)
|
||||||
|
err = UPNP_GetSpecificPortMappingEntry(m_upnpUrls.controlURL, m_upnpData.first.servicetype, port, type, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
#elif ((MINIUPNPC_API_VERSION >= 8) || defined (UPNPDISCOVER_SUCCESS))
|
||||||
|
err = UPNP_GetSpecificPortMappingEntry(m_upnpUrls.controlURL, m_upnpData.first.servicetype, port, type, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
#else
|
||||||
|
err = UPNP_GetSpecificPortMappingEntry(m_upnpUrls.controlURL, m_upnpData.first.servicetype, port, type, NULL, NULL);
|
||||||
|
#endif
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
void UPnP::PortMapping ()
|
void UPnP::PortMapping ()
|
||||||
{
|
{
|
||||||
const auto& a = context.GetRouterInfo().GetAddresses();
|
const auto& a = context.GetRouterInfo().GetAddresses();
|
||||||
@@ -134,13 +165,47 @@ namespace transport
|
|||||||
if (!address->host.is_v6 () && address->port)
|
if (!address->host.is_v6 () && address->port)
|
||||||
TryPortMapping (address);
|
TryPortMapping (address);
|
||||||
}
|
}
|
||||||
m_Timer.expires_from_now (boost::posix_time::minutes(20)); // every 20 minutes
|
m_Timer.expires_from_now (boost::posix_time::minutes(20)); // every 20 minutes
|
||||||
m_Timer.async_wait ([this](const boost::system::error_code& ecode)
|
m_Timer.async_wait ([this](const boost::system::error_code& ecode)
|
||||||
{
|
{
|
||||||
if (ecode != boost::asio::error::operation_aborted)
|
if (ecode != boost::asio::error::operation_aborted)
|
||||||
PortMapping ();
|
PortMapping ();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void UPnP::TryPortMapping (std::shared_ptr<i2p::data::RouterInfo::Address> address)
|
||||||
|
{
|
||||||
|
std::string strType (GetProto (address)), strPort (std::to_string (address->port));
|
||||||
|
std::string strDesc; i2p::config::GetOption("upnp.name", strDesc);
|
||||||
|
int err = UPNPCOMMAND_SUCCESS;
|
||||||
|
|
||||||
|
// check for existing mapping
|
||||||
|
err = CheckMapping (strPort.c_str (), strType.c_str ());
|
||||||
|
if (err != UPNPCOMMAND_SUCCESS) // if mapping not found
|
||||||
|
{
|
||||||
|
LogPrint (eLogDebug, "UPnP: possibly port ", strPort, " is not forwarded: return code ", err);
|
||||||
|
|
||||||
|
#if ((MINIUPNPC_API_VERSION >= 8) || defined (UPNPDISCOVER_SUCCESS))
|
||||||
|
err = UPNP_AddPortMapping (m_upnpUrls.controlURL, m_upnpData.first.servicetype, strPort.c_str (), strPort.c_str (), m_NetworkAddr, strDesc.c_str (), strType.c_str (), NULL, NULL);
|
||||||
|
#else
|
||||||
|
err = UPNP_AddPortMapping (m_upnpUrls.controlURL, m_upnpData.first.servicetype, strPort.c_str (), strPort.c_str (), m_NetworkAddr, strDesc.c_str (), strType.c_str (), NULL);
|
||||||
|
#endif
|
||||||
|
if (err != UPNPCOMMAND_SUCCESS)
|
||||||
|
{
|
||||||
|
LogPrint (eLogError, "UPnP: port forwarding to ", m_NetworkAddr, ":", strPort, " failed: return code ", err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogPrint (eLogInfo, "UPnP: port successfully forwarded (", m_externalIPAddress ,":", strPort, " type ", strType, " -> ", m_NetworkAddr ,":", strPort ,")");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogPrint (eLogDebug, "UPnP: external forward from ", m_NetworkAddr, ":", strPort, " exists on current Internet Gateway Device");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UPnP::CloseMapping ()
|
void UPnP::CloseMapping ()
|
||||||
@@ -153,41 +218,30 @@ namespace transport
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UPnP::TryPortMapping (std::shared_ptr<i2p::data::RouterInfo::Address> address)
|
|
||||||
{
|
|
||||||
std::string strType (GetProto (address)), strPort (std::to_string (address->port));
|
|
||||||
int r;
|
|
||||||
std::string strDesc; i2p::config::GetOption("upnp.name", strDesc);
|
|
||||||
#ifdef UPNPDISCOVER_SUCCESS
|
|
||||||
r = UPNP_AddPortMapping (m_upnpUrls.controlURL, m_upnpData.first.servicetype, strPort.c_str (), strPort.c_str (), m_NetworkAddr, strDesc.c_str (), strType.c_str (), 0, "0");
|
|
||||||
#else
|
|
||||||
r = UPNP_AddPortMapping (m_upnpUrls.controlURL, m_upnpData.first.servicetype, strPort.c_str (), strPort.c_str (), m_NetworkAddr, strDesc.c_str (), strType.c_str (), 0);
|
|
||||||
#endif
|
|
||||||
if (r!=UPNPCOMMAND_SUCCESS)
|
|
||||||
{
|
|
||||||
LogPrint (eLogError, "UPnP: AddPortMapping (", m_NetworkAddr, ":", strPort, ") failed with code ", r);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LogPrint (eLogDebug, "UPnP: Port Mapping successful. (", m_NetworkAddr ,":", strPort, " type ", strType, " -> ", m_externalIPAddress ,":", strPort ,")");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void UPnP::CloseMapping (std::shared_ptr<i2p::data::RouterInfo::Address> address)
|
void UPnP::CloseMapping (std::shared_ptr<i2p::data::RouterInfo::Address> address)
|
||||||
{
|
{
|
||||||
|
if(!m_upnpUrlsInitialized) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
std::string strType (GetProto (address)), strPort (std::to_string (address->port));
|
std::string strType (GetProto (address)), strPort (std::to_string (address->port));
|
||||||
int r = 0;
|
int err = UPNPCOMMAND_SUCCESS;
|
||||||
r = UPNP_DeletePortMapping (m_upnpUrls.controlURL, m_upnpData.first.servicetype, strPort.c_str (), strType.c_str (), 0);
|
|
||||||
LogPrint (eLogError, "UPnP: DeletePortMapping() returned : ", r);
|
err = CheckMapping (strPort.c_str (), strType.c_str ());
|
||||||
|
if (err == UPNPCOMMAND_SUCCESS)
|
||||||
|
{
|
||||||
|
err = UPNP_DeletePortMapping (m_upnpUrls.controlURL, m_upnpData.first.servicetype, strPort.c_str (), strType.c_str (), NULL);
|
||||||
|
LogPrint (eLogError, "UPnP: DeletePortMapping() returned : ", err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UPnP::Close ()
|
void UPnP::Close ()
|
||||||
{
|
{
|
||||||
freeUPNPDevlist (m_Devlist);
|
freeUPNPDevlist (m_Devlist);
|
||||||
m_Devlist = 0;
|
m_Devlist = 0;
|
||||||
FreeUPNPUrls (&m_upnpUrls);
|
if(m_upnpUrlsInitialized){
|
||||||
|
FreeUPNPUrls (&m_upnpUrls);
|
||||||
|
m_upnpUrlsInitialized=false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string UPnP::GetProto (std::shared_ptr<i2p::data::RouterInfo::Address> address)
|
std::string UPnP::GetProto (std::shared_ptr<i2p::data::RouterInfo::Address> address)
|
||||||
@@ -195,11 +249,11 @@ namespace transport
|
|||||||
switch (address->transportStyle)
|
switch (address->transportStyle)
|
||||||
{
|
{
|
||||||
case i2p::data::RouterInfo::eTransportNTCP:
|
case i2p::data::RouterInfo::eTransportNTCP:
|
||||||
return "TCP";
|
return "TCP";
|
||||||
break;
|
break;
|
||||||
case i2p::data::RouterInfo::eTransportSSU:
|
case i2p::data::RouterInfo::eTransportSSU:
|
||||||
default:
|
default:
|
||||||
return "UDP";
|
return "UDP";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013-2020, The PurpleI2P Project
|
||||||
|
*
|
||||||
|
* This file is part of Purple i2pd project and licensed under BSD3
|
||||||
|
*
|
||||||
|
* See full license text in LICENSE file at top of project tree
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef __UPNP_H__
|
#ifndef __UPNP_H__
|
||||||
#define __UPNP_H__
|
#define __UPNP_H__
|
||||||
|
|
||||||
@@ -19,45 +27,55 @@ namespace i2p
|
|||||||
{
|
{
|
||||||
namespace transport
|
namespace transport
|
||||||
{
|
{
|
||||||
|
const int UPNP_RESPONSE_TIMEOUT = 2000; // in milliseconds
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
UPNP_IGD_NONE = 0,
|
||||||
|
UPNP_IGD_VALID_CONNECTED = 1,
|
||||||
|
UPNP_IGD_VALID_NOT_CONNECTED = 2,
|
||||||
|
UPNP_IGD_INVALID = 3
|
||||||
|
};
|
||||||
|
|
||||||
class UPnP
|
class UPnP
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
UPnP ();
|
UPnP ();
|
||||||
~UPnP ();
|
~UPnP ();
|
||||||
void Close ();
|
void Close ();
|
||||||
|
|
||||||
void Start ();
|
void Start ();
|
||||||
void Stop ();
|
void Stop ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void Discover ();
|
void Discover ();
|
||||||
void PortMapping ();
|
int CheckMapping (const char* port, const char* type);
|
||||||
void TryPortMapping (std::shared_ptr<i2p::data::RouterInfo::Address> address);
|
void PortMapping ();
|
||||||
void CloseMapping ();
|
void TryPortMapping (std::shared_ptr<i2p::data::RouterInfo::Address> address);
|
||||||
void CloseMapping (std::shared_ptr<i2p::data::RouterInfo::Address> address);
|
void CloseMapping ();
|
||||||
|
void CloseMapping (std::shared_ptr<i2p::data::RouterInfo::Address> address);
|
||||||
|
|
||||||
void Run ();
|
void Run ();
|
||||||
std::string GetProto (std::shared_ptr<i2p::data::RouterInfo::Address> address);
|
std::string GetProto (std::shared_ptr<i2p::data::RouterInfo::Address> address);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
bool m_IsRunning;
|
bool m_IsRunning;
|
||||||
std::unique_ptr<std::thread> m_Thread;
|
std::unique_ptr<std::thread> m_Thread;
|
||||||
std::condition_variable m_Started;
|
std::condition_variable m_Started;
|
||||||
std::mutex m_StartedMutex;
|
std::mutex m_StartedMutex;
|
||||||
boost::asio::io_service m_Service;
|
boost::asio::io_service m_Service;
|
||||||
boost::asio::deadline_timer m_Timer;
|
boost::asio::deadline_timer m_Timer;
|
||||||
struct UPNPUrls m_upnpUrls;
|
bool m_upnpUrlsInitialized = false;
|
||||||
struct IGDdatas m_upnpData;
|
struct UPNPUrls m_upnpUrls;
|
||||||
|
struct IGDdatas m_upnpData;
|
||||||
|
|
||||||
// For miniupnpc
|
// For miniupnpc
|
||||||
char * m_MulticastIf = 0;
|
struct UPNPDev * m_Devlist = 0;
|
||||||
char * m_Minissdpdpath = 0;
|
char m_NetworkAddr[64];
|
||||||
struct UPNPDev * m_Devlist = 0;
|
char m_externalIPAddress[40];
|
||||||
char m_NetworkAddr[64];
|
|
||||||
char m_externalIPAddress[40];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -65,14 +83,15 @@ namespace transport
|
|||||||
#else // USE_UPNP
|
#else // USE_UPNP
|
||||||
namespace i2p {
|
namespace i2p {
|
||||||
namespace transport {
|
namespace transport {
|
||||||
/* class stub */
|
/* class stub */
|
||||||
class UPnP {
|
class UPnP {
|
||||||
public:
|
public:
|
||||||
UPnP () {};
|
|
||||||
~UPnP () {};
|
UPnP () {};
|
||||||
void Start () { LogPrint(eLogWarning, "UPnP: this module was disabled at compile-time"); }
|
~UPnP () {};
|
||||||
void Stop () {};
|
void Start () { LogPrint(eLogWarning, "UPnP: this module was disabled at compile-time"); }
|
||||||
};
|
void Stop () {};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // USE_UPNP
|
#endif // USE_UPNP
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013-2020, The PurpleI2P Project
|
||||||
|
*
|
||||||
|
* This file is part of Purple i2pd project and licensed under BSD3
|
||||||
|
*
|
||||||
|
* See full license text in LICENSE file at top of project tree
|
||||||
|
*/
|
||||||
|
|
||||||
#include "Daemon.h"
|
#include "Daemon.h"
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
@@ -175,7 +183,6 @@ namespace i2p
|
|||||||
bool DaemonLinux::stop()
|
bool DaemonLinux::stop()
|
||||||
{
|
{
|
||||||
i2p::fs::Remove(pidfile);
|
i2p::fs::Remove(pidfile);
|
||||||
|
|
||||||
return Daemon_Singleton::stop();
|
return Daemon_Singleton::stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,5 +204,4 @@ namespace i2p
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,24 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013-2020, The PurpleI2P Project
|
||||||
|
*
|
||||||
|
* This file is part of Purple i2pd project and licensed under BSD3
|
||||||
|
*
|
||||||
|
* See full license text in LICENSE file at top of project tree
|
||||||
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "Daemon.h"
|
#include "Daemon.h"
|
||||||
|
|
||||||
#if defined(QT_GUI_LIB)
|
#if defined(QT_GUI_LIB)
|
||||||
|
|
||||||
namespace i2p
|
namespace i2p
|
||||||
{
|
{
|
||||||
namespace qt
|
namespace qt
|
||||||
{
|
{
|
||||||
int RunQT (int argc, char* argv[]);
|
int RunQT (int argc, char* argv[]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int main( int argc, char* argv[] )
|
|
||||||
{
|
|
||||||
return i2p::qt::RunQT (argc, argv);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
int main( int argc, char* argv[] )
|
||||||
|
{
|
||||||
|
return i2p::qt::RunQT (argc, argv);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
int main( int argc, char* argv[] )
|
int main( int argc, char* argv[] )
|
||||||
{
|
{
|
||||||
if (Daemon.init(argc, argv))
|
if (Daemon.init(argc, argv))
|
||||||
{
|
{
|
||||||
if (Daemon.start())
|
if (Daemon.start())
|
||||||
Daemon.run ();
|
Daemon.run ();
|
||||||
|
|||||||
4
debian/.gitignore
vendored
4
debian/.gitignore
vendored
@@ -1,9 +1,9 @@
|
|||||||
|
debhelper-build-stamp
|
||||||
files
|
files
|
||||||
i2pd-dbg.substvars
|
i2pd-dbg.substvars
|
||||||
i2pd-dbg/
|
|
||||||
i2pd.postinst.debhelper
|
i2pd.postinst.debhelper
|
||||||
i2pd.postrm.debhelper
|
i2pd.postrm.debhelper
|
||||||
i2pd.prerm.debhelper
|
i2pd.prerm.debhelper
|
||||||
i2pd.substvars
|
i2pd.substvars
|
||||||
i2pd/
|
i2pd/
|
||||||
|
i2pd-dbg/
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user