diff --git a/Cargo.lock b/Cargo.lock index 13bf2b6..705755b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 4 +version = 3 [[package]] name = "addr2line" @@ -50,9 +50,9 @@ dependencies = [ [[package]] name = "allocator-api2" -version = "0.2.18" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" +checksum = "45862d1c77f2228b9e10bc609d5bc203d86ebc9b87ad8d5d5167a6c9abf739d9" [[package]] name = "android-tzdata" @@ -120,9 +120,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.91" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c042108f3ed77fd83760a5fd79b53be043192bb3b9dba91d8c574c0ada7850c8" +checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" [[package]] name = "arraydeque" @@ -433,9 +433,9 @@ checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "bytemuck" -version = "1.19.0" +version = "1.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8334215b81e418a0a7bdb8ef0849474f40bb10c8b71f1c4ed315cff49f32494d" +checksum = "8b37c88a63ffd85d15b406896cc343916d7cf57838a847b3a6f2ca5d39a5695a" [[package]] name = "byteorder" @@ -445,9 +445,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" +checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b" [[package]] name = "cbc" @@ -460,9 +460,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.31" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e7962b54006dcfcc61cb72735f4d89bb97061dd6a7ed882ec6b8ee53714c6f" +checksum = "f34d93e62b03caf570cccc334cbc6c2fceca82f39211051345108adcba3eebdc" dependencies = [ "shlex", ] @@ -661,9 +661,9 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.14" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" +checksum = "16b80225097f2e5ae4e7179dd2266824648f3e2f49d9134d584b76389d31c4c3" dependencies = [ "libc", ] @@ -926,12 +926,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -958,9 +958,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" +checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" [[package]] name = "fedimint-tonic-lnd" @@ -1102,7 +1102,7 @@ checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" dependencies = [ "futures-core", "lock_api", - "parking_lot", + "parking_lot 0.12.3", ] [[package]] @@ -1221,9 +1221,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" +checksum = "ccae279728d634d083c00f6099cb58f01cc99c145b84b8be2f6c74618d79922e" dependencies = [ "atomic-waker", "bytes", @@ -1256,9 +1256,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.0" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" [[package]] name = "hashlink" @@ -1450,14 +1450,14 @@ dependencies = [ [[package]] name = "hyper" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a" +checksum = "97818827ef4f364230e16705d4706e2897df2bb60617d6ca15d598025a3c481f" dependencies = [ "bytes", "futures-channel", "futures-util", - "h2 0.4.6", + "h2 0.4.7", "http 1.1.0", "http-body 1.0.1", "httparse", @@ -1490,9 +1490,9 @@ checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" dependencies = [ "futures-util", "http 1.1.0", - "hyper 1.5.0", + "hyper 1.5.1", "hyper-util", - "rustls 0.23.15", + "rustls 0.23.19", "rustls-pki-types", "tokio", "tokio-rustls 0.26.0", @@ -1519,7 +1519,7 @@ checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", "http-body-util", - "hyper 1.5.0", + "hyper 1.5.1", "hyper-util", "native-tls", "tokio", @@ -1529,16 +1529,16 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b" +checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" dependencies = [ "bytes", "futures-channel", "futures-util", "http 1.1.0", "http-body 1.0.1", - "hyper 1.5.0", + "hyper 1.5.1", "pin-project-lite", "socket2", "tokio", @@ -1732,7 +1732,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown 0.15.0", + "hashbrown 0.15.2", "serde", ] @@ -1807,9 +1807,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.11" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "js-sys" @@ -1842,9 +1842,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.161" +version = "0.2.167" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" +checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc" [[package]] name = "libm" @@ -1863,6 +1863,32 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "libssh2-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dc8a030b787e2119a731f1951d6a773e2280c660f8ec4b0f5e1505a386e71ee" +dependencies = [ + "cc", + "libc", + "libz-sys", + "openssl-sys", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "libz-sys" +version = "1.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2d16453e800a8cf6dd2fc3eb4bc99b786a9b90c663b8559a5b1a041bf89e472" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "linux-raw-sys" version = "0.4.14" @@ -1896,6 +1922,7 @@ dependencies = [ "serde", "serde_json", "ssh-key", + "ssh2", "tokio", "urlencoding", ] @@ -2074,9 +2101,9 @@ dependencies = [ [[package]] name = "nostr" -version = "0.36.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14ad56c1d9a59f4edc46b17bc64a217b38b99baefddc0080f85ad98a0855336d" +checksum = "8aad4b767bbed24ac5eb4465bfb83bc1210522eb99d67cf4e547ec2ec7e47786" dependencies = [ "async-trait", "base64 0.22.1", @@ -2296,6 +2323,17 @@ version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core 0.8.6", +] + [[package]] name = "parking_lot" version = "0.12.3" @@ -2303,7 +2341,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ "lock_api", - "parking_lot_core", + "parking_lot_core 0.9.10", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall 0.2.16", + "smallvec", + "winapi", ] [[package]] @@ -2314,7 +2366,7 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.5.7", "smallvec", "windows-targets 0.52.6", ] @@ -2338,9 +2390,9 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pathdiff" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d61c5ce1153ab5b689d0c074c4e7fc613e942dfb7dd9eea5ab202d2ad91fe361" +checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3" [[package]] name = "pbkdf2" @@ -2561,9 +2613,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.89" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] @@ -2673,6 +2725,15 @@ dependencies = [ "getrandom", ] +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "redox_syscall" version = "0.5.7" @@ -2710,7 +2771,7 @@ checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.8", + "regex-automata 0.4.9", "regex-syntax 0.8.5", ] @@ -2725,9 +2786,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", @@ -2748,20 +2809,20 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reqwest" -version = "0.12.8" +version = "0.12.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f713147fbe92361e52392c73b8c9e48c04c6625bce969ef54dc901e58e042a7b" +checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f" dependencies = [ "base64 0.22.1", "bytes", "encoding_rs", "futures-core", "futures-util", - "h2 0.4.6", + "h2 0.4.7", "http 1.1.0", "http-body 1.0.1", "http-body-util", - "hyper 1.5.0", + "hyper 1.5.1", "hyper-rustls 0.27.3", "hyper-tls", "hyper-util", @@ -2777,7 +2838,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "sync_wrapper 1.0.1", + "sync_wrapper 1.0.2", "system-configuration", "tokio", "tokio-native-tls", @@ -2833,7 +2894,7 @@ dependencies = [ "memchr", "multer", "num_cpus", - "parking_lot", + "parking_lot 0.12.3", "pin-project-lite", "rand", "ref-cast", @@ -2910,9 +2971,9 @@ dependencies = [ [[package]] name = "rsa" -version = "0.9.6" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0e5124fcb30e76a7e79bfee683a2746db83784b86289f6251b54b7950a0dfc" +checksum = "47c75d7c5c6b673e58bf54d8544a9f432e3a925b0e80f7cd3602ab5c50c55519" dependencies = [ "const-oid", "digest", @@ -2947,9 +3008,9 @@ checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustix" -version = "0.38.37" +version = "0.38.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" +checksum = "d7f649912bc1495e167a6edee79151c84b1bad49748cb4f1f1167f459f6224f6" dependencies = [ "bitflags 2.6.0", "errno", @@ -2972,9 +3033,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.15" +version = "0.23.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fbb44d7acc4e873d613422379f69f237a1b141928c02f6bc6ccfddddc2d7993" +checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1" dependencies = [ "once_cell", "rustls-pki-types", @@ -3051,9 +3112,9 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01227be5826fa0690321a2ba6c5cd57a19cf3f6a09e76973b58e61de6ab9d1c1" +checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" dependencies = [ "windows-sys 0.59.0", ] @@ -3142,9 +3203,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.12.0" +version = "2.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea4a292869320c0272d7bc55a5a6aafaff59b4f63404a003887b679a2e05b4b6" +checksum = "fa39c7303dc58b5543c94d22c1766b0d31f2ee58306363ea622b10bbc075eaa2" dependencies = [ "core-foundation-sys", "libc", @@ -3152,18 +3213,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.213" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ea7893ff5e2466df8d720bb615088341b295f849602c6956047f8f80f0e9bc1" +checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.213" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e85ad2009c50b58e87caa8cd6dac16bdf511bbfb7af6c33df902396aa480fa5" +checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", @@ -3172,9 +3233,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.132" +version = "1.0.133" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" +checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" dependencies = [ "indexmap 2.6.0", "itoa", @@ -3310,9 +3371,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" dependencies = [ "libc", "windows-sys 0.52.0", @@ -3586,6 +3647,18 @@ dependencies = [ "zeroize", ] +[[package]] +name = "ssh2" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7fe461910559f6d5604c3731d00d2aafc4a83d1665922e280f42f9a168d5455" +dependencies = [ + "bitflags 1.3.2", + "libc", + "libssh2-sys", + "parking_lot 0.11.2", +] + [[package]] name = "stable-pattern" version = "0.1.0" @@ -3635,9 +3708,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.85" +version = "2.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56" +checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" dependencies = [ "proc-macro2", "quote", @@ -3652,9 +3725,9 @@ checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" [[package]] name = "sync_wrapper" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" dependencies = [ "futures-core", ] @@ -3693,9 +3766,9 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.13.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" +checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" dependencies = [ "cfg-if", "fastrand", @@ -3715,18 +3788,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.65" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d11abd9594d9b38965ef50805c5e469ca9cc6f197f883f717e0269a3057b3d5" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.65" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae71770322cbd277e69d762a16c444af02aa0575ac0d174f0b9562d3b37f8602" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", @@ -3810,9 +3883,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.41.0" +version = "1.41.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "145f3413504347a2be84393cc8a7d2fb4d863b375909ea59f2158261aa258bbb" +checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" dependencies = [ "backtrace", "bytes", @@ -3872,7 +3945,7 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls 0.23.15", + "rustls 0.23.19", "rustls-pki-types", "tokio", ] @@ -4012,9 +4085,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "log", "pin-project-lite", @@ -4024,9 +4097,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", @@ -4035,9 +4108,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", "valuable", @@ -4117,9 +4190,9 @@ checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" [[package]] name = "unicode-ident" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" +checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" [[package]] name = "unicode-normalization" @@ -4328,7 +4401,7 @@ version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "372d5b87f58ec45c384ba03563b03544dc5fadc3983e434b286913f5b4a9bb6d" dependencies = [ - "redox_syscall", + "redox_syscall 0.5.7", "wasite", ] diff --git a/Cargo.toml b/Cargo.toml index 849d228..2812ba6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,23 +6,25 @@ edition = "2021" [[bin]] name = "api" + [dependencies] lnvps_db = { path = "lnvps_db" } tokio = { version = "1.37.0", features = ["rt", "rt-multi-thread", "macros"] } anyhow = "1.0.83" -log = "0.4.21" config = { version = "0.14.0", features = ["yaml"] } +log = "0.4.21" pretty_env_logger = "0.5.0" serde = { version = "1.0.213", features = ["derive"] } reqwest = { version = "0.12.8" } serde_json = "1.0.132" rocket = { version = "0.5.1", features = ["json"] } chrono = { version = "0.4.38", features = ["serde"] } -nostr = { version = "0.36.0", default-features = false, features = ["std"] } +nostr = { version = "0.37.0", default-features = false, features = ["std"] } base64 = "0.22.1" -ssh-key = "0.6.7" urlencoding = "2.1.3" fedimint-tonic-lnd = { version = "0.2.0", default-features = false, features = ["invoicesrpc"] } ipnetwork = "0.20.0" rand = "0.8.5" clap = { version = "4.5.21", features = ["derive"] } +ssh2 = "0.9.4" +ssh-key = "0.6.7" diff --git a/config.yaml b/config.yaml index 2d160f7..a7d8809 100644 --- a/config.yaml +++ b/config.yaml @@ -6,9 +6,11 @@ lnd: provisioner: proxmox: read_only: false - bios: "ovmf" - machine: "q35" - os_type: "l26" - bridge: "vmbr0" - cpu: "kvm64" - vlan: 100 \ No newline at end of file + qemu: + bios: "ovmf" + machine: "q35" + os_type: "l26" + bridge: "vmbr0" + cpu: "kvm64" + vlan: 100 + kvm: false \ No newline at end of file diff --git a/src/host/proxmox.rs b/src/host/proxmox.rs index 3fc50ed..802a34f 100644 --- a/src/host/proxmox.rs +++ b/src/host/proxmox.rs @@ -1,6 +1,6 @@ use anyhow::{anyhow, bail, Result}; -use log::{error, info}; -use reqwest::{ClientBuilder, Url}; +use log::{debug, error, info}; +use reqwest::{ClientBuilder, Method, Url}; use serde::de::DeserializeOwned; use serde::{Deserialize, Serialize}; use std::fmt::Debug; @@ -62,15 +62,23 @@ impl ProxmoxClient { } pub async fn list_storage(&self, node: &str) -> Result> { - let rsp: ResponseBase> = - self.get(&format!("/api2/json/nodes/{node}/storage")).await?; + let rsp: ResponseBase> = self + .get(&format!("/api2/json/nodes/{node}/storage")) + .await?; Ok(rsp.data) } /// List files in a storage pool - pub async fn list_storage_files(&self, node: &str, storage: &str) -> Result> { - let rsp: ResponseBase> = - self.get(&format!("/api2/json/nodes/{node}/storage/{storage}/content")).await?; + pub async fn list_storage_files( + &self, + node: &str, + storage: &str, + ) -> Result> { + let rsp: ResponseBase> = self + .get(&format!( + "/api2/json/nodes/{node}/storage/{storage}/content" + )) + .await?; Ok(rsp.data) } @@ -78,7 +86,6 @@ impl ProxmoxClient { /// /// https://pve.proxmox.com/pve-docs/api-viewer/?ref=public_apis#/nodes/{node}/qemu pub async fn create_vm(&self, req: CreateVm) -> Result { - info!("{}", serde_json::to_string_pretty(&req)?); let rsp: ResponseBase> = self .post(&format!("/api2/json/nodes/{}/qemu", req.node), &req) .await?; @@ -93,7 +100,6 @@ impl ProxmoxClient { /// /// https://pve.proxmox.com/pve-docs/api-viewer/?ref=public_apis#/nodes/{node}/qemu/{vmid}/config pub async fn configure_vm(&self, req: ConfigureVm) -> Result { - info!("{}", serde_json::to_string_pretty(&req)?); let rsp: ResponseBase> = self .post( &format!("/api2/json/nodes/{}/qemu/{}/config", req.node, req.vm_id), @@ -149,7 +155,39 @@ impl ProxmoxClient { &req, ) .await?; - Ok(TaskId { id: rsp.data, node: req.node }) + Ok(TaskId { + id: rsp.data, + node: req.node, + }) + } + + /// Resize a disk on a VM + pub async fn resize_disk(&self, req: ResizeDiskRequest) -> Result { + let rsp: ResponseBase = self + .put( + Method::PUT, + &format!("/api2/json/nodes/{}/qemu/{}/resize", &req.node, &req.vm_id), + &req, + ) + .await?; + Ok(TaskId { + id: rsp.data, + node: req.node, + }) + } + + /// Start a VM + pub async fn start_vm(&self, node: &str, vm: u64) -> Result { + let rsp: ResponseBase = self + .post( + &format!("/api2/json/nodes/{}/qemu/{}/status/start", node, vm), + (), + ) + .await?; + Ok(TaskId { + id: rsp.data, + node: node.to_string(), + }) } async fn get(&self, path: &str) -> Result { @@ -162,7 +200,7 @@ impl ProxmoxClient { let status = rsp.status(); let text = rsp.text().await?; #[cfg(debug_assertions)] - info!("<< {}", text); + debug!("<< {}", text); if status.is_success() { Ok(serde_json::from_str(&text)?) } else { @@ -171,19 +209,30 @@ impl ProxmoxClient { } async fn post(&self, path: &str, body: R) -> Result { + self.put(Method::POST, path, body).await + } + + async fn put( + &self, + method: Method, + path: &str, + body: R, + ) -> Result { + let body = serde_json::to_string(&body)?; + debug!("{}", &body); let rsp = self .client - .post(self.base.join(path)?) + .request(method, self.base.join(path)?) .header("Authorization", format!("PVEAPIToken={}", self.token)) .header("Content-Type", "application/json") .header("Accept", "application/json") - .body(serde_json::to_string(&body)?) + .body(body) .send() .await?; let status = rsp.status(); let text = rsp.text().await?; #[cfg(debug_assertions)] - info!("<< {}", text); + debug!("<< {}", text); if status.is_success() { Ok(serde_json::from_str(&text)?) } else { @@ -307,7 +356,7 @@ pub struct VmInfo { pub enum StorageType { LVMThin, Dir, - ZFSPool + ZFSPool, } #[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] @@ -374,6 +423,19 @@ pub struct StorageContentEntry { pub vm_id: Option, } +#[derive(Debug, Deserialize, Serialize, Default)] +pub struct ResizeDiskRequest { + pub node: String, + #[serde(rename = "vmid")] + pub vm_id: i32, + pub disk: String, + /// The new size. + /// + /// With the `+` sign the value is added to the actual size of the volume and without it, + /// the value is taken as an absolute one. Shrinking disk size is not supported. + pub size: String, +} + #[derive(Debug, Deserialize, Serialize)] #[serde(rename_all = "lowercase")] pub enum VmBios { @@ -450,4 +512,6 @@ pub struct VmConfig { #[serde(rename = "efidisk0")] #[serde(skip_serializing_if = "Option::is_none")] pub efi_disk_0: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub kvm: Option, } diff --git a/src/lib.rs b/src/lib.rs index afdd874..24aebe6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,3 +9,4 @@ pub mod settings; pub mod status; pub mod worker; pub mod router; +pub mod ssh_client; diff --git a/src/provisioner/lnvps.rs b/src/provisioner/lnvps.rs index aeb6f7d..da4c614 100644 --- a/src/provisioner/lnvps.rs +++ b/src/provisioner/lnvps.rs @@ -1,10 +1,11 @@ use crate::exchange::{ExchangeRateCache, Ticker}; use crate::host::proxmox::{ - ConfigureVm, CreateVm, DownloadUrlRequest, ProxmoxClient, StorageContent, TaskState, VmBios, - VmConfig, + ConfigureVm, CreateVm, DownloadUrlRequest, ProxmoxClient, ResizeDiskRequest, StorageContent, + TaskState, VmBios, VmConfig, }; use crate::provisioner::Provisioner; -use crate::settings::QemuConfig; +use crate::settings::{QemuConfig, SshConfig}; +use crate::ssh_client::SshClient; use anyhow::{bail, Result}; use chrono::{Days, Months, Utc}; use fedimint_tonic_lnd::lnrpc::Invoice; @@ -32,12 +33,16 @@ pub struct LNVpsProvisioner { db: Box, lnd: Client, rates: ExchangeRateCache, + read_only: bool, config: QemuConfig, + ssh: Option, } impl LNVpsProvisioner { pub fn new( + read_only: bool, config: QemuConfig, + ssh: Option, db: impl LNVpsDb + 'static, lnd: Client, rates: ExchangeRateCache, @@ -47,6 +52,8 @@ impl LNVpsProvisioner { lnd, rates, config, + read_only, + ssh, } } @@ -282,7 +289,7 @@ impl Provisioner for LNVpsProvisioner { } async fn spawn_vm(&self, vm_id: u64) -> Result<()> { - if self.config.read_only { + if self.read_only { bail!("Cant spawn VM's in read-only mode"); } let vm = self.db.get_vm(vm_id).await?; @@ -337,17 +344,20 @@ impl Provisioner for LNVpsProvisioner { net.push(format!("tag={}", t)); } + let vm_id = 100 + vm.id as i32; + // create VM let t_create = client .create_vm(CreateVm { node: host.name.clone(), - vm_id: (vm.id + 100) as i32, + vm_id, config: VmConfig { on_boot: Some(true), bios: Some(VmBios::OVMF), boot: Some("order=scsi0".to_string()), cores: Some(vm.cpu as i32), cpu: Some(self.config.cpu.clone()), + kvm: Some(self.config.kvm), ip_config: Some(ip_config.join(",")), machine: Some(self.config.machine.clone()), memory: Some((vm.memory / 1024 / 1024).to_string()), @@ -363,7 +373,49 @@ impl Provisioner for LNVpsProvisioner { .await?; client.wait_for_task(&t_create).await?; - // TODO: Find a way to automate importing disk + // import the disk + // TODO: find a way to avoid using SSH + if let Some(ssh_config) = &self.ssh { + let image = self.db.get_os_image(vm.image_id).await?; + let host_addr: Url = host.ip.parse()?; + let mut ses = SshClient::new()?; + ses.connect( + (host_addr.host().unwrap().to_string(), 22), + &ssh_config.user, + &ssh_config.key, + ) + .await?; + + let cmd = format!( + "/usr/sbin/qm set {} --scsi0 {}:0,import-from=/var/lib/vz/template/iso/{}", + vm_id, + &drive.name, + &image.filename()? + ); + let (code, rsp) = ses.execute(cmd.as_str()).await?; + info!("{}", rsp); + + if code != 0 { + bail!("Failed to import disk, exit-code {}", code); + } + } else { + bail!("Cannot complete, no method available to import disk, consider configuring ssh") + } + + // resize disk + let j_resize = client + .resize_disk(ResizeDiskRequest { + node: host.name.clone(), + vm_id, + disk: "scsi0".to_string(), + size: vm.disk_size.to_string(), + }) + .await?; + client.wait_for_task(&j_resize).await?; + + let j_start = client.start_vm(&host.name, vm_id as u64).await?; + client.wait_for_task(&j_start).await?; + Ok(()) } } diff --git a/src/settings.rs b/src/settings.rs index f709775..0bc0b8d 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -23,14 +23,26 @@ pub struct LndConfig { #[derive(Debug, Deserialize, Serialize)] pub enum ProvisionerConfig { - Proxmox(QemuConfig), + Proxmox { + /// Readonly mode, don't spawn any VM's + read_only: bool, + /// Generic VM configuration + qemu: QemuConfig, + /// SSH config for issuing commands via CLI + ssh: Option, + }, +} + +#[derive(Debug, Clone, Deserialize, Serialize)] +pub struct SshConfig { + /// Location of SSH key used to run commands on the host + pub key: PathBuf, + /// Username used to run commands on the host, default = root + pub user: String, } #[derive(Debug, Clone, Deserialize, Serialize)] pub struct QemuConfig { - /// Readonly mode, don't spawn any VM's - pub read_only: bool, - /// Machine type (q35) pub machine: String, @@ -44,7 +56,10 @@ pub struct QemuConfig { pub cpu: String, /// VLAN tag all spawned VM's - pub vlan: Option + pub vlan: Option, + + /// Enable virtualization inside VM + pub kvm: bool, } impl ProvisionerConfig { @@ -55,7 +70,11 @@ impl ProvisionerConfig { exchange: ExchangeRateCache, ) -> impl Provisioner + 'static { match self { - ProvisionerConfig::Proxmox(c) => LNVpsProvisioner::new(c.clone(), db, lnd, exchange), + ProvisionerConfig::Proxmox { + qemu, + ssh, + read_only, + } => LNVpsProvisioner::new(*read_only, qemu.clone(), ssh.clone(), db, lnd, exchange), } } } diff --git a/src/ssh_client.rs b/src/ssh_client.rs new file mode 100644 index 0000000..55f475d --- /dev/null +++ b/src/ssh_client.rs @@ -0,0 +1,40 @@ +use anyhow::Result; +use log::info; +use std::io::Read; +use std::path::PathBuf; +use tokio::net::{TcpStream, ToSocketAddrs}; + +pub struct SshClient { + session: ssh2::Session, +} + +impl SshClient { + pub fn new() -> Result { + let session = ssh2::Session::new()?; + Ok(SshClient { session }) + } + + pub async fn connect( + &mut self, + host: impl ToSocketAddrs, + username: &str, + key: &PathBuf, + ) -> Result<()> { + let tcp = TcpStream::connect(host).await?; + self.session.set_tcp_stream(tcp); + self.session.handshake()?; + self.session + .userauth_pubkey_file(username, None, key, None)?; + Ok(()) + } + + pub async fn execute(&mut self, command: &str) -> Result<(i32, String)> { + info!("Executing command: {}", command); + let mut channel = self.session.channel_session()?; + channel.exec(command)?; + let mut s = String::new(); + channel.read_to_string(&mut s)?; + channel.wait_close()?; + Ok((channel.exit_status()?, s)) + } +}