diff options
| -rw-r--r-- | .woodpecker.yaml | 4 | ||||
| -rw-r--r-- | Cargo.lock | 964 | ||||
| -rw-r--r-- | Cargo.toml | 4 | ||||
| -rw-r--r-- | doc/quickstart.md | 116 | ||||
| -rw-r--r-- | src/cfg/config.rs | 38 | ||||
| -rw-r--r-- | src/main.rs | 4 | ||||
| -rw-r--r-- | src/net/emissary_i2p.rs | 60 | ||||
| -rw-r--r-- | src/net/http_package.rs | 2 | ||||
| -rw-r--r-- | src/net/i2p_package.rs | 1 | ||||
| -rw-r--r-- | src/net/i2p_tools.rs | 0 | ||||
| -rw-r--r-- | src/net/mod.rs | 4 | ||||
| -rw-r--r-- | src/pkgtoolkit/pkgtools.rs | 176 | ||||
| -rw-r--r-- | tests/pkgtoolkit_funcs.rs | 13 | ||||
| -rw-r--r-- | tests/shared.rs | 1 |
14 files changed, 303 insertions, 1084 deletions
diff --git a/.woodpecker.yaml b/.woodpecker.yaml index 14ad9df..b8f5086 100644 --- a/.woodpecker.yaml +++ b/.woodpecker.yaml @@ -29,7 +29,7 @@ steps: commands: - rustup component add clippy rustfmt - cargo fmt --all -- --check - - cargo clippy --jobs 2 -- -D clippy::all + - cargo clippy --jobs 2 -- -D clippy::all -D warnings when: branch: main event: [ push, pull_request ] @@ -41,7 +41,7 @@ steps: CARGO_TERM_COLOR: always MESK_CONFIG_TOML: "[repo]\nrepo_url = \"https://mesk.anthrill.i2p/repo/x86_64/\"\nauto_update = true\ndestination = (\"mesk\", \"mesk\")" commands: - - cargo test --verbose --jobs 2 + - cargo test --verbose --jobs 2 -- --test-threads=2 when: branch: main event: [ push, pull_request ]
\ No newline at end of file @@ -9,27 +9,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" [[package]] -name = "aead" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" -dependencies = [ - "crypto-common", - "generic-array", -] - -[[package]] -name = "aes" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures", -] - -[[package]] name = "aho-corasick" version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -39,12 +18,6 @@ dependencies = [ ] [[package]] -name = "allocator-api2" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" - -[[package]] name = "anstream" version = "0.6.21" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -95,15 +68,6 @@ dependencies = [ ] [[package]] -name = "arbitrary" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1" -dependencies = [ - "derive_arbitrary", -] - -[[package]] name = "assert-json-diff" version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -142,89 +106,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] -name = "autocfg" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" - -[[package]] -name = "base16ct" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" - -[[package]] name = "base64" version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] -name = "base64ct" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" - -[[package]] name = "bitflags" version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" [[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] name = "bumpalo" version = "3.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" [[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] name = "bytes" version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" [[package]] -name = "bzip2" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3a53fac24f34a81bc9954b5d6cfce0c21e18ec6959f44f56e8e90e4bb7c346c" -dependencies = [ - "libbz2-rs-sys", -] - -[[package]] -name = "cbc" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6" -dependencies = [ - "cipher", -] - -[[package]] name = "cc" version = "1.2.48" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c481bdbf0ed3b892f6f806287d72acd515b352a4ec27a208489b8c1bc839633a" dependencies = [ "find-msvc-tools", - "jobserver", - "libc", "shlex", ] @@ -235,41 +146,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] -name = "chacha20" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures", -] - -[[package]] -name = "chacha20poly1305" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" -dependencies = [ - "aead", - "chacha20", - "cipher", - "poly1305", - "zeroize", -] - -[[package]] -name = "cipher" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" -dependencies = [ - "crypto-common", - "inout", - "zeroize", -] - -[[package]] name = "clap" version = "4.5.53" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -338,18 +214,6 @@ dependencies = [ ] [[package]] -name = "const-oid" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" - -[[package]] -name = "constant_time_eq" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" - -[[package]] name = "core-foundation" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -366,30 +230,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] -name = "cpufeatures" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" -dependencies = [ - "libc", -] - -[[package]] -name = "crc" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eb8a2a1cd12ab0d987a5d5e825195d372001a4094a0376319d5a0ad71c1ba0d" -dependencies = [ - "crc-catalog", -] - -[[package]] -name = "crc-catalog" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" - -[[package]] name = "crc32fast" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -399,130 +239,6 @@ dependencies = [ ] [[package]] -name = "crunchy" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" - -[[package]] -name = "crypto-bigint" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" -dependencies = [ - "generic-array", - "rand_core 0.6.4", - "subtle", - "zeroize", -] - -[[package]] -name = "crypto-common" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "curve25519-dalek" -version = "4.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" -dependencies = [ - "cfg-if", - "cpufeatures", - "curve25519-dalek-derive", - "digest", - "fiat-crypto", - "rustc_version", - "subtle", - "zeroize", -] - -[[package]] -name = "curve25519-dalek-derive" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "curve25519-elligator2" -version = "0.1.0-alpha.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4df656f503077758f9f06de6e111e921ec8f08f6ce203bd880bc058a47d9d3db" -dependencies = [ - "cfg-if", - "cpufeatures", - "curve25519-dalek-derive", - "fiat-crypto", - "rustc_version", - "subtle", - "zeroize", -] - -[[package]] -name = "data-encoding" -version = "2.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476" - -[[package]] -name = "deflate64" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26bf8fc351c5ed29b5c2f0cbbac1b209b74f60ecd62e675a998df72c49af5204" - -[[package]] -name = "der" -version = "0.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" -dependencies = [ - "const-oid", - "zeroize", -] - -[[package]] -name = "deranged" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ececcb659e7ba858fb4f10388c250a7252eb0a27373f1a72b8748afdd248e587" -dependencies = [ - "powerfmt", -] - -[[package]] -name = "derive_arbitrary" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e567bd82dcff979e4b03460c307b3cdc9e96fde3d73bed1496d2bc75d9dd62a" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "const-oid", - "crypto-common", - "subtle", -] - -[[package]] name = "displaydoc" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -534,111 +250,6 @@ dependencies = [ ] [[package]] -name = "ecb" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a8bfa975b1aec2145850fcaa1c6fe269a16578c44705a532ae3edc92b8881c7" -dependencies = [ - "cipher", -] - -[[package]] -name = "ecdsa" -version = "0.16.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" -dependencies = [ - "der", - "digest", - "elliptic-curve", - "rfc6979", - "signature", - "spki", -] - -[[package]] -name = "ed25519" -version = "2.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" -dependencies = [ - "pkcs8", - "signature", -] - -[[package]] -name = "ed25519-dalek" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" -dependencies = [ - "curve25519-dalek", - "ed25519", - "rand_core 0.6.4", - "serde", - "sha2", - "subtle", - "zeroize", -] - -[[package]] -name = "elliptic-curve" -version = "0.13.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" -dependencies = [ - "base16ct", - "crypto-bigint", - "digest", - "ff", - "generic-array", - "group", - "pkcs8", - "rand_core 0.6.4", - "sec1", - "subtle", - "zeroize", -] - -[[package]] -name = "emissary-core" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bad60901866902a05a64edd3429576c11dc7c118d7d2c25bcf86676345cf3dbe" -dependencies = [ - "aes", - "bytes", - "cbc", - "chacha20", - "chacha20poly1305", - "curve25519-elligator2", - "data-encoding", - "ecb", - "ed25519-dalek", - "ethbloom", - "futures-channel", - "futures-util", - "hashbrown 0.15.5", - "hmac", - "lazy_static", - "nom", - "num-bigint", - "num-traits", - "p256", - "parking_lot", - "rand_core 0.6.4", - "sha1", - "sha2", - "siphasher", - "subtle", - "thingbuf", - "tracing", - "uint", - "x25519-dalek", - "zeroize", -] - -[[package]] name = "encode_unicode" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -693,39 +304,12 @@ dependencies = [ ] [[package]] -name = "ethbloom" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c321610643004cf908ec0f5f2aa0d8f1f8e14b540562a2887a1111ff1ecbf7b" -dependencies = [ - "crunchy", - "fixed-hash", - "tiny-keccak", -] - -[[package]] name = "fastrand" version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] -name = "ff" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" -dependencies = [ - "rand_core 0.6.4", - "subtle", -] - -[[package]] -name = "fiat-crypto" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" - -[[package]] name = "filetime" version = "0.2.26" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -744,22 +328,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844" [[package]] -name = "fixed-hash" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" -dependencies = [ - "static_assertions", -] - -[[package]] name = "flate2" version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfe33edd8e85a12a67454e37f8c75e730830d83e313556ab9ebf9ee7fbeb3bfb" dependencies = [ "crc32fast", - "libz-rs-sys", "miniz_oxide", ] @@ -770,12 +344,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] -name = "foldhash" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" - -[[package]] name = "foreign-types" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -889,17 +457,6 @@ dependencies = [ ] [[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", - "zeroize", -] - -[[package]] name = "getrandom" version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -923,17 +480,6 @@ dependencies = [ ] [[package]] -name = "group" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" -dependencies = [ - "ff", - "rand_core 0.6.4", - "subtle", -] - -[[package]] name = "h2" version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -954,17 +500,6 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" -dependencies = [ - "allocator-api2", - "equivalent", - "foldhash", -] - -[[package]] -name = "hashbrown" version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" @@ -976,21 +511,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest", -] - -[[package]] name = "http" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1225,7 +745,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2" dependencies = [ "equivalent", - "hashbrown 0.16.1", + "hashbrown", ] [[package]] @@ -1242,15 +762,6 @@ dependencies = [ ] [[package]] -name = "inout" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" -dependencies = [ - "generic-array", -] - -[[package]] name = "ipnet" version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1303,16 +814,6 @@ dependencies = [ ] [[package]] -name = "jobserver" -version = "0.1.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" -dependencies = [ - "getrandom 0.3.4", - "libc", -] - -[[package]] name = "js-sys" version = "0.3.83" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1323,18 +824,6 @@ dependencies = [ ] [[package]] -name = "lazy_static" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" - -[[package]] -name = "libbz2-rs-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c4a545a15244c7d945065b5d392b2d2d7f21526fba56ce51467b06ed445e8f7" - -[[package]] name = "libc" version = "0.2.177" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1352,15 +841,6 @@ dependencies = [ ] [[package]] -name = "libz-rs-sys" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "840db8cf39d9ec4dd794376f38acc40d0fc65eec2a8f484f7fd375b84602becd" -dependencies = [ - "zlib-rs", -] - -[[package]] name = "linux-raw-sys" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1388,16 +868,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" [[package]] -name = "lzma-rust2" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c60a23ffb90d527e23192f1246b14746e2f7f071cb84476dd879071696c18a4a" -dependencies = [ - "crc", - "sha2", -] - -[[package]] name = "memchr" version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1409,7 +879,6 @@ version = "0.0.1" dependencies = [ "cc", "clap", - "emissary-core", "env_logger", "flate2", "futures-util", @@ -1418,7 +887,7 @@ dependencies = [ "mockito", "reqwest", "serde", - "sqlite", + "serial_test", "tar", "tempfile", "tokio", @@ -1426,7 +895,6 @@ dependencies = [ "toml", "url", "yosemite", - "zip", ] [[package]] @@ -1515,40 +983,6 @@ dependencies = [ ] [[package]] -name = "num-bigint" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" -dependencies = [ - "num-integer", - "num-traits", -] - -[[package]] -name = "num-conv" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" - -[[package]] -name = "num-integer" -version = "0.1.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - -[[package]] name = "once_cell" version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1561,12 +995,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" [[package]] -name = "opaque-debug" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" - -[[package]] name = "openssl" version = "0.10.75" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1611,18 +1039,6 @@ dependencies = [ ] [[package]] -name = "p256" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" -dependencies = [ - "ecdsa", - "elliptic-curve", - "primeorder", - "sha2", -] - -[[package]] name = "parking_lot" version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1646,42 +1062,12 @@ dependencies = [ ] [[package]] -name = "pbkdf2" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" -dependencies = [ - "digest", - "hmac", -] - -[[package]] name = "percent-encoding" version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] -name = "pin-project" -version = "1.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] name = "pin-project-lite" version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1694,33 +1080,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] -name = "pkcs8" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" -dependencies = [ - "der", - "spki", -] - -[[package]] name = "pkg-config" version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] -name = "poly1305" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" -dependencies = [ - "cpufeatures", - "opaque-debug", - "universal-hash", -] - -[[package]] name = "portable-atomic" version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1745,18 +1110,6 @@ dependencies = [ ] [[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" - -[[package]] -name = "ppmd-rust" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d558c559f0450f16f2a27a1f017ef38468c1090c9ce63c8e51366232d53717b4" - -[[package]] name = "ppv-lite86" version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1766,15 +1119,6 @@ dependencies = [ ] [[package]] -name = "primeorder" -version = "0.13.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" -dependencies = [ - "elliptic-curve", -] - -[[package]] name = "proc-macro2" version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1939,16 +1283,6 @@ dependencies = [ ] [[package]] -name = "rfc6979" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" -dependencies = [ - "hmac", - "subtle", -] - -[[package]] name = "ring" version = "0.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1963,15 +1297,6 @@ dependencies = [ ] [[package]] -name = "rustc_version" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" -dependencies = [ - "semver", -] - -[[package]] name = "rustix" version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2030,6 +1355,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] +name = "scc" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46e6f046b7fef48e2660c57ed794263155d713de679057f2d0c169bfc6e756cc" +dependencies = [ + "sdd", +] + +[[package]] name = "schannel" version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2045,18 +1379,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] -name = "sec1" -version = "0.7.3" +name = "sdd" +version = "3.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" -dependencies = [ - "base16ct", - "der", - "generic-array", - "pkcs8", - "subtle", - "zeroize", -] +checksum = "490dcfcbfef26be6800d11870ff2df8774fa6e86d047e3e8c8a76b25655e41ca" [[package]] name = "security-framework" @@ -2082,12 +1408,6 @@ dependencies = [ ] [[package]] -name = "semver" -version = "1.0.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" - -[[package]] name = "serde" version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2152,25 +1472,28 @@ dependencies = [ ] [[package]] -name = "sha1" -version = "0.10.6" +name = "serial_test" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +checksum = "1b258109f244e1d6891bf1053a55d63a5cd4f8f4c30cf9a1280989f80e7a1fa9" dependencies = [ - "cfg-if", - "cpufeatures", - "digest", + "futures", + "log", + "once_cell", + "parking_lot", + "scc", + "serial_test_derive", ] [[package]] -name = "sha2" -version = "0.10.9" +name = "serial_test_derive" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +checksum = "5d69265a08751de7844521fd15003ae0a888e035773ba05695c5c759a6f89eef" dependencies = [ - "cfg-if", - "cpufeatures", - "digest", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -2180,16 +1503,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] -name = "signature" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" -dependencies = [ - "digest", - "rand_core 0.6.4", -] - -[[package]] name = "simd-adler32" version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2202,12 +1515,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbbb5d9659141646ae647b42fe094daf6c6192d1620870b449d9557f748b2daa" [[package]] -name = "siphasher" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" - -[[package]] name = "slab" version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2230,56 +1537,12 @@ dependencies = [ ] [[package]] -name = "spki" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" -dependencies = [ - "base64ct", - "der", -] - -[[package]] -name = "sqlite" -version = "0.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f66e9c01a11936154f3910dbba732c01f8b591543bc4d6672bddee79fd9c4783" -dependencies = [ - "sqlite3-sys", -] - -[[package]] -name = "sqlite3-src" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5b6d3c860886b0a33e69e421796a5f4a27f23597a182c2450f6d7ace5103120" -dependencies = [ - "cc", - "pkg-config", -] - -[[package]] -name = "sqlite3-sys" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7781d97adc13a1d5081127a9ee29afad8427f3757bd984daf814d8265267039" -dependencies = [ - "sqlite3-src", -] - -[[package]] name = "stable_deref_trait" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] name = "strsim" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2368,15 +1631,6 @@ dependencies = [ ] [[package]] -name = "thingbuf" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "662b54ef6f7b4e71f683dadc787bbb2d8e8ef2f91b682ebed3164a5a7abca905" -dependencies = [ - "pin-project", -] - -[[package]] name = "thiserror" version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2397,34 +1651,6 @@ dependencies = [ ] [[package]] -name = "time" -version = "0.3.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" -dependencies = [ - "deranged", - "num-conv", - "powerfmt", - "serde", - "time-core", -] - -[[package]] -name = "time-core" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" - -[[package]] -name = "tiny-keccak" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] - -[[package]] name = "tinystr" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2641,24 +1867,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] -name = "typenum" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" - -[[package]] -name = "uint" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" -dependencies = [ - "byteorder", - "crunchy", - "hex", - "static_assertions", -] - -[[package]] name = "unicode-ident" version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2677,16 +1885,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81e544489bf3d8ef66c953931f56617f423cd4b5494be343d9b9d3dda037b9a3" [[package]] -name = "universal-hash" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" -dependencies = [ - "crypto-common", - "subtle", -] - -[[package]] name = "untrusted" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2723,12 +1921,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] name = "want" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3053,17 +2245,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" [[package]] -name = "x25519-dalek" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" -dependencies = [ - "curve25519-dalek", - "rand_core 0.6.4", - "zeroize", -] - -[[package]] name = "xattr" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3156,20 +2337,6 @@ name = "zeroize" version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] [[package]] name = "zerotrie" @@ -3203,76 +2370,3 @@ dependencies = [ "quote", "syn", ] - -[[package]] -name = "zip" -version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb2a05c7c36fde6c09b08576c9f7fb4cda705990f73b58fe011abf7dfb24168b" -dependencies = [ - "aes", - "arbitrary", - "bzip2", - "constant_time_eq", - "crc32fast", - "deflate64", - "flate2", - "getrandom 0.3.4", - "hmac", - "indexmap", - "lzma-rust2", - "memchr", - "pbkdf2", - "ppmd-rust", - "sha1", - "time", - "zeroize", - "zopfli", - "zstd", -] - -[[package]] -name = "zlib-rs" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f06ae92f42f5e5c42443fd094f245eb656abf56dd7cce9b8b263236565e00f2" - -[[package]] -name = "zopfli" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f05cd8797d63865425ff89b5c4a48804f35ba0ce8d125800027ad6017d2b5249" -dependencies = [ - "bumpalo", - "crc32fast", - "log", - "simd-adler32", -] - -[[package]] -name = "zstd" -version = "0.13.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91ee311a569c327171651566e07972200e76fcfe2242a4fa446149a3881c08a" -dependencies = [ - "zstd-safe", -] - -[[package]] -name = "zstd-safe" -version = "7.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f49c4d5f0abb602a93fb8736af2a4f4dd9512e36f7f570d66e65ff867ed3b9d" -dependencies = [ - "zstd-sys", -] - -[[package]] -name = "zstd-sys" -version = "2.0.16+zstd.1.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e19ebc2adc8f83e43039e79776e3fda8ca919132d68a1fed6a5faca2683748" -dependencies = [ - "cc", - "pkg-config", -] @@ -17,15 +17,12 @@ tokio = { version = "1.48.0", features = ["fs", "io-util", "macros", "rt"] } reqwest = { version = "0.12.24", features = ["stream"] } flate2 = "1.1.5" log = "0.4.28" -sqlite = "0.37.0" tar = "0.4.44" -emissary-core = "0.2.0" yosemite = "0.6.1" cc = "1.2.48" url = "2.5.7" indicatif = "0.18.3" futures-util = "0.3.31" -zip = "6.0.0" [dev-dependencies] env_logger = "0.11.8" @@ -33,4 +30,5 @@ log = "0.4.28" mockito = "1.7.1" tempfile = "3.23.0" tokio-test = "0.4.4" +serial_test = "3.2.0" diff --git a/doc/quickstart.md b/doc/quickstart.md new file mode 100644 index 0000000..a8ebcc4 --- /dev/null +++ b/doc/quickstart.md @@ -0,0 +1,116 @@ +# Mesk & Anthrill project generally + +Initially, **Anthrill is conceived as a distribution developed by enthusiasts for complete security in the system** (for example, a minimum number of proprietary software, an analog of HVM from Qubes, etc.) **and on the network, which is implemented through pre-installed and pre-configured networking utilities, as well as i2p.** (Like zapret deep packet inspection bypasses, firewalls, vpn/proxy tools like sing-box/XRay) + +**Mesk, on the other hand, is designed as a completely free manager and repositories that should guarantee the user complete freedom and security in such standard operations.** + +It is important to clarify that this desire for anonymity and security is not caused by paranoia, but by a situation that the world is approaching. + +I didn't "suck it out of my finger" or how else to aptly put it about the blatantly made-up news on the Internet that is spreading exponentially. Below, I will leave a list of sources. If you interested in this research you can check web3privacy.md + +# External logic +This paragraph should explain to you how the package is installed, deleted, updated, as well as an explanation for the main files and manifests that will be created during operation. + +As you may have already read, **the package itself is a `tar.gz` archive, we use `.mesk` for convenience**. + +Mesk supports two types of packages, Binary and provided as program source code. + +TOML manifests are used for assembly, there are three of them in total, they are variable and depend on your specific case. +``` +# Example file-tree of package.mesk +. +├── BUILD # Mesk manifests -> BUILD, INSTALL, SETTS +├── INSTALL +├── SETTS +├── LICENSE +├── Makefile +└── src + ├── some_code.c + └── some_code.rs +``` + +Of these, only INSTALL is required, it is required in order to specify where and how to install the package. + +- `BUILD` - build parameters if the package is provided as source code +- `SETTS` - It is used after installation, for example, if you need to set some environment variables, execute a script, etc. + +## Examles: +### INSTALL + +```toml +[package] +name = "my-package" +version = "1.0.0" +arch = "x86_64" +descr = "Just example INSTALL script" +license = "BSD-2-Clause" + +[install] +path = "/usr/bin/my-package" +dependencies = ["package", "i2pd", "llvm-19-devel", "etc..."] # Leave it empty if there are no dependencies +user = "root" +group = "root" +mode = "755" + +# Also [install] can be +# path = "/usr/bin/my-package" +# user = "root" +# group = "root" +# mode = "755" +# custom_script = "./install.sh" OR +# custom_script = """ +# echo "Installing my-package" +# tar xvf /var/cache/mesk/my-package/SOURCES.tar.gz -C /usr/bin/ +# """ +``` + +During installation, files are generated with information about which files belong to a particular package for further cleaning (`.config`, `/etc`, and other configs are ignored) +In other words, in the `[package]` section, it is important to specify the valid version of the package, the architecture (in lowercase) and the name. + +`descr` - package description, optional. Feel free to skip it. + +The license is not being processed, but must be specified due to the fact that there will be in the search + +In `[install]`, all fields are optional except for `custom_script`, it can be used if the package cannot be assembled automatically via mesk or you do not want to give it to automation. It is important to note that it cancels the previous `[install]` fields except for `dependencies`. + +- `path` - where should I install the final executable? (will be reworked later because many packages require additional directories like /usr/include etc..) +- `dependencies` - an array of names of other packages in the mesk repositories on which your +- `user` - access for users +- `group` - access for groups +- `mode` - file permissions, as in chmod + +### BUILD + +```toml +# This field required, but its will change nothing if script = "" specified. +build_system = "CMake" + +# Environment variables, can be empty or removed +env = """ + export SHELL=/usr/bin/zsh + """ +# Custom script like from INSTALL +script = """ + make -j6 -f build/Makefile all + """ + +``` + +- `build_system` - pointing to the build system to execute it automatically +Now supported build enum: + +```Rust +pub enum BuildSystems { + Make, + CMake, + Meson, + Cargo, +} +``` + +- `env` - export environment variables for assembly if required + +- `script` - bash build script if the automatic one can't handle it + +Also you can check [examples](https://codeberg.org/NamelessTeam/mesk/src/branch/main/examples) + diff --git a/src/cfg/config.rs b/src/cfg/config.rs index 687c415..f14ec93 100644 --- a/src/cfg/config.rs +++ b/src/cfg/config.rs @@ -49,24 +49,29 @@ pub struct Paths { pub cache_dir: String, #[serde(rename = "build_dir")] pub build_dir: String, + pub installed_db: String, } impl Config { - /// Parse the /etc/mesk.toml file and return the Config object. + /// Parse configuration and return the Config object. /// - /// This function reads the /etc/mesk.toml file, parses it and returns the Config object. - /// If the file is not available, it falls back to the `MESK_CONFIG_TOML` environment - /// variable containing the full TOML configuration. + /// This function first tries to read the `MESK_CONFIG_TOML` environment variable + /// containing the full TOML configuration. If it is not set, it falls back to + /// reading the `/etc/mesk/mesk.toml` file. pub fn parse() -> Result<Config, toml::de::Error> { - let contents = match fs::read_to_string("/etc/mesk/mesk.toml") { - Ok(c) => c, - Err(_e) => std::env::var("MESK_CONFIG_TOML").map_err(|env_err| { - DeError::custom(format!( - "Failed to read /etc/mesk/mesk.toml and MESK_CONFIG_TOML is not set: {}", - env_err - )) - })?, - }; + // Prefer an explicit in-memory config for tests and overrides. + if let Ok(env_contents) = std::env::var("MESK_CONFIG_TOML") { + let result: Config = toml::from_str(&env_contents)?; + return Ok(result); + } + + // Fallback to the system-wide config file. + let contents = fs::read_to_string("/etc/mesk/mesk.toml").map_err(|io_err| { + DeError::custom(format!( + "Failed to read /etc/mesk/mesk.toml and MESK_CONFIG_TOML is not set: {}", + io_err + )) + })?; let result: Config = toml::from_str(&contents)?; Ok(result) @@ -97,6 +102,7 @@ impl Config { paths: Paths { cache_dir: String::from("/var/cache/mesk"), build_dir: String::from("/var/lib/mesk"), + installed_db: String::from("/var/lib/mesk/pkgdb"), }, }; @@ -108,6 +114,7 @@ impl Config { repo: &Option<String>, cachedir: &Option<String>, buildir: &Option<String>, + installed_db: &Option<String>, ) -> Result<String, toml::ser::Error> { let generator: Config = Config { repo: Repo { @@ -135,6 +142,11 @@ impl Config { } else { buildir.clone().unwrap() }, + installed_db: if installed_db.is_none() { + String::from("/var/cache/mesk/pkgdb") + } else { + installed_db.clone().unwrap() + }, /* FIXME: I can leave this parameter, but I think it would be better to make the build path in the /var/cache/mesk/$pkgname-$pkgver/BUILD/ diff --git a/src/main.rs b/src/main.rs index 2cff8d4..b9328a0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -45,6 +45,7 @@ enum Commands { repo: Option<String>, cachedir: Option<String>, buildir: Option<String>, + installed_db: Option<String>, }, #[command(about = "Maintaners, links, developers and more info")] Credits, @@ -145,6 +146,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { repo, cachedir, buildir, + installed_db, } => { println!("Generating config file"); if cachedir.is_none() && repo.is_none() && buildir.is_none() { @@ -162,7 +164,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { file.write_all(config.as_bytes())?; println!("Config tool ending work."); } else { - let config = Config::generate(repo, cachedir, buildir).unwrap(); + let config = Config::generate(repo, cachedir, buildir, installed_db).unwrap(); println!("---- Start of generated config ----"); println!("{:?}", config); diff --git a/src/net/emissary_i2p.rs b/src/net/emissary_i2p.rs deleted file mode 100644 index b9e5967..0000000 --- a/src/net/emissary_i2p.rs +++ /dev/null @@ -1,60 +0,0 @@ -use emissary_core::{ - I2cpConfig, - Ntcp2Config -}; - - -use crate::pkgtoolkit::pkgtools::Package; -use crate::Config; - -use indicatif::{ProgressBar, ProgressStyle}; -use std::{collections::HashMap, path::Path}; -use tokio::io::{AsyncReadExt, AsyncWriteExt, BufReader}; - -pub struct I2PPackage { - pub config: Config, - pub i2p_config: emissary_core::Config, - pub index_packages: Option<HashMap<String, Package>>, -} - -impl I2PPackage { - pub fn new(cfg: Config, i2p_cfg: emissary_core::Config) -> Self { - I2PPackage { - config: cfg, - i2p_config: i2p_cfg, - index_packages: None, - } - } - - pub async fn fetch_index(&mut self) -> Result<(), Box<dyn std::error::Error>> { - let cfg = Config::parse()?; - - let repo_url = &self.config.repo.repo_url; - let cache_dir = &self.config.paths.cache_dir; - - let utl = url::Url::parse(repo_url).unwrap(); - let host = utl.host_str().ok_or("No host in URL")?; - - let request_path = utl.path(); - let request_path = if request_path.ends_with(".tar.gz") { - request_path.to_string() - } else { - format!("{}/INDEX.tar.gz", request_path.trim_end_matches('/')) - }; - - - let StorageBundle { - ntcp2_iv, - ntcp2_key, - profiles, - router_info, - routers, - signing_key, - static_key, - ssu2_intro_key, - ssu2_static_key, - } = storage.load().await; - - Ok(()) - } -}
\ No newline at end of file diff --git a/src/net/http_package.rs b/src/net/http_package.rs index 4b2aefa..8fb2e19 100644 --- a/src/net/http_package.rs +++ b/src/net/http_package.rs @@ -1,3 +1,5 @@ +// TODO: Add signatures checking and fix mixed sync/async use. + use crate::cfg::config::Config; use crate::pkgtoolkit::pkgtools::Package; use flate2::read::GzDecoder; diff --git a/src/net/i2p_package.rs b/src/net/i2p_package.rs index 2b847d6..f46ddc7 100644 --- a/src/net/i2p_package.rs +++ b/src/net/i2p_package.rs @@ -191,7 +191,6 @@ impl I2PPackage { content_length: u64, description: &str, ) -> Result<(), Box<dyn std::error::Error>> { - // Прогресс-бар для загрузки let pb = if content_length > 0 { let pb = ProgressBar::new(content_length); pb.set_style(ProgressStyle::default_bar() diff --git a/src/net/i2p_tools.rs b/src/net/i2p_tools.rs deleted file mode 100644 index e69de29..0000000 --- a/src/net/i2p_tools.rs +++ /dev/null diff --git a/src/net/mod.rs b/src/net/mod.rs index 20a050e..1a04189 100644 --- a/src/net/mod.rs +++ b/src/net/mod.rs @@ -1,6 +1,2 @@ pub mod http_package; pub mod i2p_package; -// unimplemented -// now i rewritting with emissary, SAMv3 not for download files btw -// but yosemite one of docemented lib for i2p (SAMv3 only), it-s better i try to use it -// pub mod emissary_i2p;
\ No newline at end of file diff --git a/src/pkgtoolkit/pkgtools.rs b/src/pkgtoolkit/pkgtools.rs index a0433ac..2a8a18e 100644 --- a/src/pkgtoolkit/pkgtools.rs +++ b/src/pkgtoolkit/pkgtools.rs @@ -1,17 +1,13 @@ -// I think I should split this file into a few smaller ones. - use crate::cfg::config::Config; use std::{ - fs::{self, File, create_dir_all}, + fs::{self, File, Permissions, create_dir_all, set_permissions}, io, os::unix::fs::PermissionsExt, - path::Path, + path::{Path, StripPrefixError}, process::Command, str, }; - // use emissary_core::i2np::tunnel::build; - use flate2::read::GzDecoder; use serde::{Deserialize, Serialize}; use tar::Archive; @@ -38,12 +34,13 @@ pub struct Package { #[derive(Deserialize, Debug, Clone)] pub struct InstallMeta { - path: String, - user: String, - group: String, - mode: String, + pub path: String, + pub user: String, + pub group: String, + pub mode: String, // Cancels the previous fields and installs them using the shell script - custom_script: Option<String>, + pub custom_script: Option<String>, + // pub files: Option<Vec<String>>, } #[allow(dead_code)] @@ -51,6 +48,8 @@ pub struct InstallMeta { struct Install { package: Package, install: InstallMeta, + #[serde(default)] + files: Vec<String>, } #[allow(dead_code)] @@ -70,6 +69,13 @@ pub enum BuildSystems { Cargo, } +#[derive(Serialize, Deserialize, Debug, Clone)] +pub struct PackageManifest { + pub name: String, + pub version: String, + pub all_files: Vec<String>, +} + #[allow(dead_code)] #[derive(Deserialize)] struct Build { @@ -153,6 +159,36 @@ impl Package { Ok(()) } + /// Recursively collects all files from a directory and its subdirectories + /// and returns them as a vector of strings. + /// + /// # Arguments + /// + /// * `root`: The root directory from which to collect files. + /// * `base`: The base directory from which to strip the prefix from the file paths. + /// + /// # Returns + /// + /// A vector of strings containing the file paths relative to the `base` directory. + fn collect_files_from_dir(root: &Path, base: &Path) -> Result<Vec<String>, std::io::Error> { + let mut files = Vec::new(); + for entry in fs::read_dir(root)? { + let entry = entry?; + let path = entry.path(); + if path.is_dir() { + files.extend(Self::collect_files_from_dir(&path, base)?); + } else { + let rel_path = path + .strip_prefix(base) + .map_err(|e: StripPrefixError| io::Error::new(io::ErrorKind::InvalidData, e))? + .to_string_lossy() + .to_string(); + files.push(rel_path); + } + } + Ok(files) + } + /// Extracts a .tar.gz archive to the cache directory specified in Config. /// /// This function handles opening the archive file, decompressing it with GzDecoder, @@ -165,22 +201,19 @@ impl Package { /// * `Ok(())` if the archive is successfully unpacked. /// * `Err(std::io::Error)` if there's an issue opening, reading, or unpacking the archive. pub fn extract_archive(path_to_archive: &str) -> Result<(), std::io::Error> { - let config = Config::parse().unwrap(); + let config = Config::parse().map_err(|e| std::io::Error::other(e.to_string()))?; let cache_dir = &config.paths.cache_dir; create_dir_all(cache_dir)?; - // Очистим возможные мета-файлы предыдущих распаковок, чтобы не было утечек состояния for meta_name in ["INSTALL", "SETTS", "BUILD"] { let meta_path = Path::new(cache_dir).join(meta_name); if meta_path.exists() { - let _ = fs::remove_file(&meta_path); + fs::remove_file(&meta_path)?; } } - let file = File::open(path_to_archive)?; let gz = GzDecoder::new(file); let mut archive = Archive::new(gz); - // Unpack directly into the cache directory. Игнорируем AlreadyExists, чтобы не мешать валидации. match archive.unpack(cache_dir) { Ok(()) => Ok(()), @@ -206,7 +239,7 @@ impl Package { #[allow(clippy::type_complexity)] fn loadmeta( minimal_package_meta: &mut Self, - ) -> Result<(Install, Option<Setts>, Option<Build>), Box<dyn std::error::Error>> { + ) -> Result<(Install, Option<Setts>, Option<Build>), std::io::Error> { // Changed return type for more flexibility /* Example INSTALL format: @@ -234,7 +267,7 @@ impl Package { # """ */ - let config = Config::parse()?; // Propagate error if parsing fails + let config = Config::parse().map_err(|e| std::io::Error::other(e.to_string()))?; // Propagate error if parsing fails // Ensure the cache directory exists fs::create_dir_all(&config.paths.cache_dir)?; @@ -245,43 +278,41 @@ impl Package { let setts_path = Path::new(cache_dir).join(format!("{}/SETTS", minimal_package_meta.name)); let build_path = Path::new(cache_dir).join(format!("{}/BUILD", minimal_package_meta.name)); - // Check for required 'INSTALL' file if !install_path.exists() { return Err(io::Error::new( io::ErrorKind::NotFound, "File INSTALL not found in cache directory", - ) - .into()); // Convert to Box<dyn Error> + )); } - // Read and deserialize the INSTALL file let install_content = fs::read_to_string(&install_path)?; - let install_meta: Install = toml::from_str(&install_content)?; + let install_meta: Install = toml::from_str(&install_content) + .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?; - // Initialize optional structures as None let mut setts_meta: Option<Setts> = None; let mut build_meta: Option<Build> = None; - // Attempt to read and deserialize the SETTS file if it exists if setts_path.exists() { let setts_content = fs::read_to_string(&setts_path)?; - setts_meta = Some(toml::from_str(&setts_content)?); + setts_meta = Some( + toml::from_str(&setts_content) + .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?, + ); } - // Attempt to read and deserialize the BUILD file if it exists if build_path.exists() { let build_content = fs::read_to_string(&build_path)?; - build_meta = Some(toml::from_str(&build_content)?); + build_meta = Some( + toml::from_str(&build_content) + .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?, + ); } - // Log if custom script is present if let Some(ref _script) = install_meta.install.custom_script { println!( "Custom script found for package: {}", install_meta.package.name ); - // Consider logging the script content or just its presence based on verbosity - // e.g., log::debug!("Custom script content: {}", script); } else { println!( "No custom script for package: {}", @@ -305,12 +336,11 @@ impl Package { pub fn check(path_to_archive: String) -> Result<bool, std::io::Error> { Self::extract_archive(&path_to_archive)?; - let archive_path = Path::new(&path_to_archive); - let archive_dir = archive_path.parent().unwrap_or_else(|| Path::new(".")); + let config = Config::parse().map_err(|e| std::io::Error::other(e.to_string()))?; - let install_path = archive_dir.join("INSTALL"); - let setts_path = archive_dir.join("SETTS"); - let build_path = archive_dir.join("BUILD"); + let install_path = Path::new(&config.paths.cache_dir).join("INSTALL"); + let setts_path = Path::new(&config.paths.cache_dir).join("SETTS"); + let build_path = Path::new(&config.paths.cache_dir).join("BUILD"); if !install_path.exists() { return Err(std::io::Error::new( @@ -352,7 +382,6 @@ impl Package { let install_content: Result<Install, toml::de::Error> = toml::from_str(&content); log::info!("Validating arch..."); - let install_parsed = match install_content { Ok(v) => v, Err(e) => { @@ -363,7 +392,6 @@ impl Package { )); } }; - if std::env::consts::ARCH != install_parsed.package.arch.as_str() { let pkg_arch = &install_parsed.package.arch; log::error!( @@ -392,7 +420,7 @@ impl Package { /// /// Returns an error if the BUILD file is invalid or if the build or install hook fails. pub fn build(&mut self) -> Result<bool, std::io::Error> { - let meta = Self::loadmeta(self).unwrap(); + let meta = Self::loadmeta(self)?; let install_meta = meta.0; // let setts_meta = meta.1; let build_meta = meta.2; @@ -449,8 +477,12 @@ impl Package { /// Returns an error if the BUILD file is invalid or if the build or install hook fails. pub fn install(&mut self) -> Result<bool, std::io::Error> { let config = Config::parse().map_err(|e| std::io::Error::other(e.to_string()))?; - let (install_meta, _setts_meta, build_meta) = - Self::loadmeta(self).map_err(|e| std::io::Error::other(e.to_string()))?; + let (install_meta, _setts_meta, build_meta) = Self::loadmeta(self)?; + + let installed_db = Path::new(&config.paths.installed_db); + create_dir_all(installed_db)?; + + let mut all_files: Vec<String> = Vec::new(); let is_build_present_and_not_empty = build_meta.is_some(); @@ -462,29 +494,29 @@ impl Package { let build_meta_ref = build_meta.as_ref().unwrap(); let _ = self.execute_build(build_meta_ref); - if matches!(build_meta_ref.build_system, BuildSystems::Make) { - log::info!("Running 'make install' for package: {}", self.name); - let build_dir = Path::new(&config.paths.cache_dir) - .join(format!("{}-{}", self.name, self.version)); - let output = Command::new("make") - .arg("install") - .current_dir(&build_dir) - .output() - .map_err(|e| std::io::Error::other(format!("'make install' failed: {}", e)))?; - - if !output.status.success() { - let stderr = String::from_utf8_lossy(&output.stderr); - return Err(std::io::Error::other(format!( - "'make install' failed:\n{}", - stderr - ))); + let staging_dir = Path::new(&config.paths.cache_dir).join("staging"); + create_dir_all(&staging_dir)?; + all_files = Self::collect_files_from_dir(&staging_dir, &staging_dir)? + .iter() + .map(|rel| format!("/{}", rel)) // Преобразуйте в абсолютные пути (предполагаем root=/) + .collect(); + + for file in &all_files { + let src = staging_dir.join(file.trim_start_matches('/')); + let dest = Path::new(file); + if let Some(parent) = dest.parent() { + create_dir_all(parent)?; } + fs::copy(&src, dest)?; + // TODO: Permission } + + // Cleanup staging + fs::remove_dir_all(&staging_dir)?; } else { log::info!( "No BUILD file or it's empty. Treating as binary package. Installing via INSTALL config or custom script." ); - // Установка бинарного пакета if let Some(ref script) = install_meta.install.custom_script { log::info!( "Executing custom install script for {}", @@ -502,6 +534,11 @@ impl Package { if !status.success() { return Err(std::io::Error::other("Custom install script failed")); } + + log::warn!( + "Custom script used; file list may be incomplete. Add manual tracking if needed." + ); + // Опционально: all_files = vec![]; или сканируйте систему (не рекомендуется) } else { log::info!( "No custom script. Running default install hook for {}", @@ -528,8 +565,8 @@ impl Package { "Invalid mode string in INSTALL", ) })?; - let perms = PermissionsExt::from_mode(mode); - fs::set_permissions(dest_path, perms).map_err(|e| { + let perms = Permissions::from_mode(mode); + set_permissions(dest_path, perms).map_err(|e| { std::io::Error::other(format!("Failed to set permissions: {}", e)) })?; @@ -549,12 +586,29 @@ impl Package { stderr ); } + + all_files = install_meta.files; } } - log::info!("Package {} installed successfully.", self.name); + let manifest = PackageManifest { + name: self.name.clone(), + version: self.version.clone(), + all_files, + }; + let manifest_path = installed_db.join(format!("{}-{}.toml", self.name, self.version)); + let manifest_toml = + toml::to_string(&manifest).map_err(|e| std::io::Error::other(e.to_string()))?; + fs::write(&manifest_path, manifest_toml)?; + + log::info!( + "Package {} installed successfully. Manifest generated at {:?}", + self.name, + manifest_path + ); Ok(true) } + pub fn gen_index() -> Result<bool, std::io::Error> { todo!(); } diff --git a/tests/pkgtoolkit_funcs.rs b/tests/pkgtoolkit_funcs.rs index 4e7f877..9e92e21 100644 --- a/tests/pkgtoolkit_funcs.rs +++ b/tests/pkgtoolkit_funcs.rs @@ -4,8 +4,8 @@ use mesk::pkgtoolkit::pkgtools::{Archs, Package}; mod shared; use shared::create_test_config; +use serial_test::serial; use tempfile::TempDir; -use tokio; // Pkg toolkit tests #[cfg(test)] @@ -15,6 +15,7 @@ mod package_tests { use std::io::Write; #[test] + #[serial] fn test_archs_as_str() { assert_eq!(Archs::X86_64.as_str(), "x86_64"); assert_eq!(Archs::Aarch64.as_str(), "aarch64"); @@ -24,6 +25,7 @@ mod package_tests { } #[tokio::test] + #[serial] async fn test_extract_archive() { let temp_dir = TempDir::new().unwrap(); let _config = create_test_config(temp_dir.path().to_str().unwrap()); @@ -51,7 +53,6 @@ mod package_tests { assert_eq!(content, test_file_content); } Err(e) if e.kind() == std::io::ErrorKind::PermissionDenied => { - // допустимый исход для запуска без root return; } Err(e) => panic!("unexpected error in extract_archive: {e}"), @@ -59,6 +60,7 @@ mod package_tests { } #[tokio::test] + #[serial] async fn test_package_check_valid() { let temp_dir = TempDir::new().unwrap(); let _config = create_test_config(temp_dir.path().to_str().unwrap()); @@ -105,8 +107,10 @@ mode = "755" } #[tokio::test] + #[serial] async fn test_package_check_missing_install() { let temp_dir = TempDir::new().unwrap(); + let _config = create_test_config(temp_dir.path().to_str().unwrap()); let archive_path = temp_dir.path().join("test_pkg_without_install.tar.gz"); let file = fs::File::create(&archive_path).unwrap(); @@ -126,7 +130,6 @@ mode = "755" panic!("expected error, got Ok"); } Err(e) if e.kind() == std::io::ErrorKind::PermissionDenied => { - // допустимый исход для запуска без root return; } Err(err) => { @@ -137,8 +140,10 @@ mode = "755" } #[tokio::test] + #[serial] async fn test_package_check_empty_install() { let temp_dir = TempDir::new().unwrap(); + let _config = create_test_config(temp_dir.path().to_str().unwrap()); let install_path = temp_dir.path().join("INSTALL"); fs::write(&install_path, "").unwrap(); @@ -158,7 +163,6 @@ mode = "755" panic!("expected error, got Ok"); } Err(e) if e.kind() == std::io::ErrorKind::PermissionDenied => { - // допустимый исход для запуска без root return; } Err(err) => { @@ -169,6 +173,7 @@ mode = "755" } #[tokio::test] + #[serial] async fn test_package_check_arch_mismatch() { let temp_dir = TempDir::new().unwrap(); let _config = create_test_config(temp_dir.path().to_str().unwrap()); diff --git a/tests/shared.rs b/tests/shared.rs index 9a192c1..574e8cd 100644 --- a/tests/shared.rs +++ b/tests/shared.rs @@ -16,6 +16,7 @@ pub fn create_test_config(temp_dir_path: &str) -> Config { paths: Paths { cache_dir: String::from(temp_dir_path), build_dir: String::from(format!("{}/build", String::from(temp_dir_path))), + installed_db: String::from(format!("{}/pkgdb", String::from(temp_dir_path))), }, }; |
