diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..e97ea473 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,15 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: weekly + - package-ecosystem: "cargo" + directory: "/" + schedule: + interval: weekly diff --git a/Cargo.lock b/Cargo.lock index eb9f7c3f..2a666e46 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,28 +4,28 @@ version = 3 [[package]] name = "aead" -version = "0.5.0-pre.2" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd885afa9fa966b7715dc1c46bf47330b9156eec79a09d2003c5af03d153ba0" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" dependencies = [ "crypto-common", "generic-array", ] [[package]] -name = "ansi_term" -version = "0.12.1" +name = "aho-corasick" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" dependencies = [ - "winapi", + "memchr", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "atty" @@ -46,9 +46,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "base64" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "bitflags" @@ -58,18 +58,18 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "blake2" -version = "0.10.4" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9cf849ee05b2ee5fba5e36f97ff8ec2533916700fc0758d40d92136a42f3388" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" dependencies = [ "digest", ] [[package]] name = "block-buffer" -version = "0.10.2" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ "generic-array", ] @@ -99,7 +99,7 @@ dependencies = [ "thiserror", "tracing", "tracing-subscriber", - "untrusted 0.9.0", + "untrusted", "x25519-dalek", ] @@ -108,51 +108,24 @@ name = "boringtun-cli" version = "0.6.0" dependencies = [ "boringtun", - "clap 3.2.8", + "clap 3.2.25", "daemonize", "tracing", "tracing-appender", "tracing-subscriber", ] -[[package]] -name = "boxfnonce" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5988cb1d626264ac94100be357308f29ff7cbdd3b36bda27f450a4ee3f713426" - -[[package]] -name = "bstr" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" -dependencies = [ - "lazy_static", - "memchr", - "regex-automata", - "serde", -] - [[package]] name = "bumpalo" -version = "3.12.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "bytes" -version = "1.1.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" - -[[package]] -name = "cast" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c24dab4283a142afa2fdca129b80ad2c6284e073930f964c3a1293c225ee39a" -dependencies = [ - "rustc_version", -] +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "cast" @@ -162,9 +135,12 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.0.73" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] [[package]] name = "cesu8" @@ -180,9 +156,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chacha20" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7fc89c7c5b9e7a02dfe45cd2367bae382f9ed31c61ca8debe5f827c420a2f08" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" dependencies = [ "cfg-if", "cipher", @@ -191,9 +167,9 @@ dependencies = [ [[package]] name = "chacha20poly1305" -version = "0.10.0-pre.1" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa5c8884b2dd73aa47cd73fff4ebee4f962cb9b8b07eba70251500e9fd756832" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" dependencies = [ "aead", "chacha20", @@ -204,9 +180,9 @@ dependencies = [ [[package]] name = "cipher" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1873270f8f7942c191139cb8a40fd228da6c3fd2fc376d7e92d47aa14aeb59e" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" dependencies = [ "crypto-common", "inout", @@ -226,9 +202,9 @@ dependencies = [ [[package]] name = "clap" -version = "3.2.8" +version = "3.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190814073e85d238f31ff738fcb0bf6910cedeb73376c87cd69291028966fd83" +checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" dependencies = [ "atty", "bitflags", @@ -236,7 +212,7 @@ dependencies = [ "indexmap", "strsim", "termcolor", - "textwrap 0.15.0", + "textwrap 0.16.0", ] [[package]] @@ -250,9 +226,9 @@ dependencies = [ [[package]] name = "combine" -version = "4.6.4" +version = "4.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a604e93b79d1808327a6fca85a6f2d69de66461e7620f5a4cbf5fb4d1d7c948" +checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" dependencies = [ "bytes", "memchr", @@ -260,9 +236,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.9" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" dependencies = [ "libc", ] @@ -274,7 +250,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b01d6de93b2b6c65e17c634a26653a29d107b3c98c607c765bf38d041531cd8f" dependencies = [ "atty", - "cast 0.3.0", + "cast", "clap 2.34.0", "criterion-plot", "csv", @@ -295,19 +271,19 @@ dependencies = [ [[package]] name = "criterion-plot" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d00996de9f2f7559f7f4dc286073197f83e92256a59ed395f9aac01fe717da57" +checksum = "2673cc8207403546f45f5fd319a974b1e6983ad1a3ee7e6041650013be041876" dependencies = [ - "cast 0.2.7", + "cast", "itertools", ] [[package]] name = "crossbeam-channel" -version = "0.5.5" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c02a4d71819009c192cf4872265391563fd6a84c81ff2c0f2a7026ca4c1d85c" +checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" dependencies = [ "cfg-if", "crossbeam-utils", @@ -315,9 +291,9 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.8.1" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" +checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" dependencies = [ "cfg-if", "crossbeam-epoch", @@ -326,33 +302,31 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.9" +version = "0.9.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07db9d94cbd326813772c968ccd25999e5f8ae22f4f8d1b11effa37ef6ce281d" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", "memoffset", - "once_cell", "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.10" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d82ee10ce34d7bc12c2122495e7593a9c41347ecdd64185af4ecf72cb1a7f83" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" dependencies = [ "cfg-if", - "once_cell", ] [[package]] name = "crypto-common" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ccfd8c0ee4cce11e45b3fd6f9d5e69e0cc62912aa6a0cb1bf4617b0eba5a12f" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", "rand_core", @@ -361,31 +335,30 @@ dependencies = [ [[package]] name = "csv" -version = "1.1.6" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" +checksum = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe" dependencies = [ - "bstr", "csv-core", - "itoa 0.4.8", + "itoa", "ryu", "serde", ] [[package]] name = "csv-core" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" +checksum = "5efa2b3d7902f4b634a20cae3c9c4e6209dc4779feb6863329607560143efa70" dependencies = [ "memchr", ] [[package]] name = "curve25519-dalek" -version = "4.0.0" +version = "4.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f711ade317dd348950a9910f81c5947e3d8907ebd2b83f76203ff1807e6a2bc2" +checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" dependencies = [ "cfg-if", "cpufeatures", @@ -399,30 +372,38 @@ dependencies = [ [[package]] name = "curve25519-dalek-derive" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.23", + "syn", ] [[package]] name = "daemonize" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70c24513e34f53b640819f0ac9f705b673fcf4006d7aab8778bee72ebfc89815" +checksum = "ab8bfdaacb3c887a54d41bdf48d3af8873b3f5566469f8ba21b92057509f116e" dependencies = [ - "boxfnonce", "libc", ] +[[package]] +name = "deranged" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +dependencies = [ + "powerfmt", +] + [[package]] name = "digest" -version = "0.10.3" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", @@ -431,30 +412,30 @@ dependencies = [ [[package]] name = "either" -version = "1.7.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "etherparse" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcb08c4aab4e2985045305551e67126b43f1b6b136bc4e1cd87fb0327877a611" +checksum = "827292ea592108849932ad8e30218f8b1f21c0dfd0696698a18b5d0aed62d990" dependencies = [ "arrayvec", ] [[package]] name = "fiat-crypto" -version = "0.1.20" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e825f6987101665dea6ec934c09ec6d721de7bc1bf92248e1d5810c8cd636b77" +checksum = "27573eac26f4dd11e2b1916c3fe1baa56407c83c71a773a8ba17ec0bca03b6b7" [[package]] name = "generic-array" -version = "0.14.5" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", @@ -462,9 +443,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.7" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" +checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" dependencies = [ "cfg-if", "libc", @@ -479,9 +460,9 @@ checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" [[package]] name = "hashbrown" -version = "0.12.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "607c8a29735385251a339424dd462993c0fed8fa09d378f259377df08c126022" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hermit-abi" @@ -509,9 +490,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.1" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", "hashbrown", @@ -550,24 +531,18 @@ checksum = "8e537132deb99c0eb4b752f0346b6a836200eaaa3516dd7e5514b63930a09e5d" [[package]] name = "itertools" -version = "0.10.3" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" dependencies = [ "either", ] [[package]] name = "itoa" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" - -[[package]] -name = "itoa" -version = "1.0.2" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "jni" @@ -591,9 +566,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "js-sys" -version = "0.3.58" +version = "0.3.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27" +checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" dependencies = [ "wasm-bindgen", ] @@ -606,15 +581,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.132" +version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "lock_api" -version = "0.4.7" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ "autocfg", "scopeguard", @@ -622,39 +597,36 @@ dependencies = [ [[package]] name = "log" -version = "0.4.17" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "memoffset" -version = "0.6.5" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" dependencies = [ "autocfg", ] [[package]] name = "mock_instant" -version = "0.2.1" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "717e29a243b81f8130e31e24e04fb151b04a44b5a7d05370935f7d937e9de06d" +checksum = "6c1a54de846c4006b88b1516731cc1f6026eb5dc4bcb186aa071ef66d40524ec" [[package]] name = "nix" -version = "0.25.0" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e322c04a9e3440c327fca7b6c8a63e6890a32fa2ad689db972425f07e0d22abb" +checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" dependencies = [ "autocfg", "bitflags", @@ -663,38 +635,29 @@ dependencies = [ ] [[package]] -name = "num-traits" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.13.1" +name = "nu-ansi-term" +version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" dependencies = [ - "hermit-abi", - "libc", + "overload", + "winapi", ] [[package]] -name = "num_threads" -version = "0.1.6" +name = "num-traits" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ - "libc", + "autocfg", ] [[package]] name = "once_cell" -version = "1.13.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "oorandom" @@ -710,9 +673,15 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "os_str_bytes" -version = "6.1.0" +version = "6.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" + +[[package]] +name = "overload" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21326818e99cfe6ce1e524c2a805c189a99b5ae555a35d19f9a284b427d86afa" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "parking_lot" @@ -726,34 +695,34 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.3" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-sys", + "windows-targets", ] [[package]] name = "pin-project-lite" -version = "0.2.9" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "platforms" -version = "3.0.2" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d7ddaed09e0eb771a79ab0fd64609ba0afb0a8366421957936ad14cbd13630" +checksum = "14e6ab3f592e6fb464fc9712d8d6e6912de6473954635fd76a589d832cffcbb0" [[package]] name = "plotters" -version = "0.3.2" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9428003b84df1496fb9d6eeee9c5f8145cb41ca375eb0dad204328888832811f" +checksum = "d2c224ba00d7cadd4d5c660deaf2098e5e80e07846537c51f9cfa4be50c1fd45" dependencies = [ "num-traits", "plotters-backend", @@ -764,124 +733,133 @@ dependencies = [ [[package]] name = "plotters-backend" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "193228616381fecdc1224c62e96946dfbc73ff4384fba576e052ff8c1bea8142" +checksum = "9e76628b4d3a7581389a35d5b6e2139607ad7c75b17aed325f210aa91f4a9609" [[package]] name = "plotters-svg" -version = "0.3.2" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0918736323d1baff32ee0eade54984f6f201ad7e97d5cfb5d6ab4a358529615" +checksum = "38f6d39893cca0701371e3c27294f09797214b86f1fb951b89ade8ec04e2abab" dependencies = [ "plotters-backend", ] [[package]] name = "poly1305" -version = "0.7.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" dependencies = [ "cpufeatures", "opaque-debug", "universal-hash", ] +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "proc-macro2" -version = "1.0.63" +version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" +checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.29" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] [[package]] name = "rand_core" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ "getrandom", ] [[package]] name = "rayon" -version = "1.5.3" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" +checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" dependencies = [ - "autocfg", - "crossbeam-deque", "either", "rayon-core", ] [[package]] name = "rayon-core" -version = "1.9.3" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" +checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" dependencies = [ - "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", - "num_cpus", ] [[package]] name = "redox_syscall" -version = "0.2.13" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ "bitflags", ] [[package]] name = "regex" -version = "1.6.0" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", "regex-syntax", ] [[package]] name = "regex-automata" -version = "0.1.10" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] [[package]] name = "regex-syntax" -version = "0.6.27" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "ring" -version = "0.16.20" +version = "0.17.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +checksum = "684d5e6e18f669ccebf64a92236bb7db9a34f07be010e3627368182027180866" dependencies = [ "cc", + "getrandom", "libc", - "once_cell", "spin", - "untrusted 0.7.1", - "web-sys", - "winapi", + "untrusted", + "windows-sys", ] [[package]] @@ -895,9 +873,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.10" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "same-file" @@ -910,21 +888,21 @@ dependencies = [ [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "semver" -version = "1.0.12" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1" +checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" [[package]] name = "serde" -version = "1.0.139" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0171ebb889e45aa68b44aee0859b3eede84c6f5f5c228e6f140c0b2a0a46cad6" +checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" dependencies = [ "serde_derive", ] @@ -941,46 +919,46 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.139" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc1d3230c1de7932af58ad8ffbe1d784bd55efd5a9d84ac24f69c72d83543dfb" +checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", - "syn 1.0.98", + "syn", ] [[package]] name = "serde_json" -version = "1.0.82" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ - "itoa 1.0.2", + "itoa", "ryu", "serde", ] [[package]] name = "sharded-slab" -version = "0.1.4" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" dependencies = [ "lazy_static", ] [[package]] name = "smallvec" -version = "1.9.0" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" +checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" [[package]] name = "socket2" -version = "0.4.7" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" dependencies = [ "libc", "winapi", @@ -988,9 +966,9 @@ dependencies = [ [[package]] name = "spin" -version = "0.5.2" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "strsim" @@ -1000,49 +978,26 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "subtle" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "syn" -version = "1.0.98" +version = "2.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] -[[package]] -name = "syn" -version = "2.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59fb7d6d8281a51045d62b8eb3a7d1ce347b76f312af50cd3dc0af39c87c1737" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "synstructure" -version = "0.12.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.98", - "unicode-xid", -] - [[package]] name = "termcolor" -version = "1.1.3" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" dependencies = [ "winapi-util", ] @@ -1058,48 +1013,67 @@ dependencies = [ [[package]] name = "textwrap" -version = "0.15.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" +checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" [[package]] name = "thiserror" -version = "1.0.31" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.31" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 1.0.98", + "syn", ] [[package]] name = "thread_local" -version = "1.1.4" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" dependencies = [ + "cfg-if", "once_cell", ] [[package]] name = "time" -version = "0.3.11" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72c91f41dcb2f096c05f0873d667dceec1087ce5bcf984ec8ffb19acddbb3217" +checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" dependencies = [ - "itoa 1.0.2", - "libc", - "num_threads", + "deranged", + "itoa", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +dependencies = [ + "time-core", ] [[package]] @@ -1114,11 +1088,10 @@ dependencies = [ [[package]] name = "tracing" -version = "0.1.35" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a400e31aa60b9d44a52a8ee0343b5b18566b03a8321e0d321f695cf56e940160" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "cfg-if", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -1126,31 +1099,32 @@ dependencies = [ [[package]] name = "tracing-appender" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d48f71a791638519505cefafe162606f706c25592e4bde4d97600c0195312e" +checksum = "3566e8ce28cc0a3fe42519fc80e6b4c943cc4c8cef275620eb8dac2d3d4e06cf" dependencies = [ "crossbeam-channel", + "thiserror", "time", "tracing-subscriber", ] [[package]] name = "tracing-attributes" -version = "0.1.22" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11c75893af559bc8e10716548bdef5cb2b983f8e637db9d0e15126b61b484ee2" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 1.0.98", + "syn", ] [[package]] name = "tracing-core" -version = "0.1.28" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b7358be39f2f274f322d2aaed611acc57f382e8eb1e5b48cb9ae30933495ce7" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", "valuable", @@ -1158,22 +1132,22 @@ dependencies = [ [[package]] name = "tracing-log" -version = "0.1.3" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" dependencies = [ - "lazy_static", "log", + "once_cell", "tracing-core", ] [[package]] name = "tracing-subscriber" -version = "0.3.14" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a713421342a5a666b7577783721d3117f1b69a393df803ee17bb73b1e122a59" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" dependencies = [ - "ansi_term", + "nu-ansi-term", "sharded-slab", "smallvec", "thread_local", @@ -1183,44 +1157,32 @@ dependencies = [ [[package]] name = "typenum" -version = "1.15.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicode-ident" -version = "1.0.1" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-width" -version = "0.1.9" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" - -[[package]] -name = "unicode-xid" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04" +checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" [[package]] name = "universal-hash" -version = "0.4.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" dependencies = [ - "generic-array", + "crypto-common", "subtle", ] -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - [[package]] name = "untrusted" version = "0.9.0" @@ -1241,12 +1203,11 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "walkdir" -version = "2.3.2" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" dependencies = [ "same-file", - "winapi", "winapi-util", ] @@ -1258,9 +1219,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.81" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994" +checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -1268,24 +1229,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.81" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a" +checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" dependencies = [ "bumpalo", - "lazy_static", "log", + "once_cell", "proc-macro2", "quote", - "syn 1.0.98", + "syn", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.81" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa" +checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1293,28 +1254,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.81" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048" +checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", - "syn 1.0.98", + "syn", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.81" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be" +checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" [[package]] name = "web-sys" -version = "0.3.58" +version = "0.3.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fed94beee57daf8dd7d51f2b15dc2bcde92d7a72304cdf662a4371008b71b90" +checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" dependencies = [ "js-sys", "wasm-bindgen", @@ -1338,9 +1299,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ "winapi", ] @@ -1353,46 +1314,69 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-sys" -version = "0.36.1" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ + "windows_aarch64_gnullvm", "windows_aarch64_msvc", "windows_i686_gnu", "windows_i686_msvc", "windows_x86_64_gnu", + "windows_x86_64_gnullvm", "windows_x86_64_msvc", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + [[package]] name = "windows_aarch64_msvc" -version = "0.36.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" -version = "0.36.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" -version = "0.36.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" -version = "0.36.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" -version = "0.36.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "x25519-dalek" @@ -1408,21 +1392,20 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.5.6" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20b578acffd8516a6c3f2a1bdefc1ec37e547bb4e0fb8b6b01a4cafc886b4442" +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" dependencies = [ "zeroize_derive", ] [[package]] name = "zeroize_derive" -version = "1.3.2" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 1.0.98", - "synstructure", + "syn", ] diff --git a/Cargo.toml b/Cargo.toml index d6f8adea..83cc9259 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,6 @@ [workspace] members = ["boringtun", "boringtun-cli"] +resolver = "2" [profile.release] lto = true # Enable full link-time optimization. diff --git a/boringtun-cli/Cargo.toml b/boringtun-cli/Cargo.toml index 18c7917e..108e5e04 100644 --- a/boringtun-cli/Cargo.toml +++ b/boringtun-cli/Cargo.toml @@ -9,9 +9,9 @@ documentation = "https://docs.rs/boringtun/0.5.2/boringtun/" edition = "2021" [dependencies] -daemonize = "0.4.1" +daemonize = "0.5.0" clap = { version = "3.1.6", features = ["env"] } -tracing = "0.1.31" +tracing = "0.1.40" tracing-subscriber = "0.3.9" tracing-appender = "0.2.1" diff --git a/boringtun-cli/src/main.rs b/boringtun-cli/src/main.rs index 026ec29a..e043e2ed 100644 --- a/boringtun-cli/src/main.rs +++ b/boringtun-cli/src/main.rs @@ -4,14 +4,14 @@ use boringtun::device::drop_privileges::drop_privileges; use boringtun::device::{DeviceConfig, DeviceHandle}; use clap::{Arg, Command}; -use daemonize::Daemonize; -use std::fs::File; +use daemonize::{Daemonize, Outcome}; +use std::fs::OpenOptions; use std::os::unix::net::UnixDatagram; use std::process::exit; use tracing::Level; fn check_tun_name(_v: String) -> Result<(), String> { - #[cfg(any(target_os = "macos", target_os = "ios"))] + #[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))] { if boringtun::device::tun::parse_utun_name(&_v).is_ok() { Ok(()) @@ -59,6 +59,17 @@ fn main() { .env("WG_UAPI_FD") .help("File descriptor for the user API") .default_value("-1"), + Arg::new("pid-file") + .takes_value(true) + .long("pid-file") + .env("WG_PID_FILE") + .help("Write the process ID to a file"), + Arg::new("work-dir") + .takes_value(true) + .long("work-dir") + .env("WG_WORK_DIR") + .help("Working directory, default is /tmp") + .default_value("/tmp"), Arg::new("tun-fd") .long("tun-fd") .env("WG_TUN_FD") @@ -100,43 +111,54 @@ fn main() { let (sock1, sock2) = UnixDatagram::pair().unwrap(); let _ = sock1.set_nonblocking(true); - let _guard; + let log = matches.value_of("log").unwrap(); if background { - let log = matches.value_of("log").unwrap(); + let mut daemonize = + Daemonize::new().working_directory(matches.value_of("work-dir").unwrap()); - let log_file = - File::create(log).unwrap_or_else(|_| panic!("Could not create log file {}", log)); - - let (non_blocking, guard) = tracing_appender::non_blocking(log_file); + if let Some(pid_file) = matches.value_of("pid-file") { + daemonize = daemonize.pid_file(pid_file); + } - _guard = guard; + let outcome = daemonize.execute(); - tracing_subscriber::fmt() - .with_max_level(log_level) - .with_writer(non_blocking) - .with_ansi(false) - .init(); + match outcome { + Outcome::Parent(Ok(parent))=> { - let daemonize = Daemonize::new() - .working_directory("/tmp") - .exit_action(move || { let mut b = [0u8; 1]; if sock2.recv(&mut b).is_ok() && b[0] == 1 { - println!("BoringTun started successfully"); + eprintln!("BoringTun started successfully"); + exit(parent.first_child_exit_code); } else { eprintln!("BoringTun failed to start"); exit(1); }; - }); - - match daemonize.start() { - Ok(_) => tracing::info!("BoringTun started successfully"), - Err(e) => { - tracing::error!(error = ?e); + } + Outcome::Child(Ok(_)) => { + let log_file = OpenOptions::new() + .create(true) + .append(true) + .open(log) + .unwrap_or_else(move |_| panic!("Could not create log file {}", &log)); + + let (non_blocking, _guard) = tracing_appender::non_blocking(log_file); + + tracing_subscriber::fmt() + .with_thread_ids(true) + .with_max_level(log_level) + .with_writer(non_blocking) + .with_ansi(false) + .init(); + + tracing::info!(message = "Started BoringTun child process"); + } + Outcome::Parent(Err(e)) | Outcome::Child(Err(e)) => { + eprintln!("BoringTun failed to daemonize: {}", e); exit(1); } - } + }; + } else { tracing_subscriber::fmt() .pretty() @@ -175,7 +197,5 @@ fn main() { sock1.send(&[1]).unwrap(); drop(sock1); - tracing::info!("BoringTun started successfully"); - device_handle.wait(); } diff --git a/boringtun/Cargo.toml b/boringtun/Cargo.toml index 36f2ee13..1c528e75 100644 --- a/boringtun/Cargo.toml +++ b/boringtun/Cargo.toml @@ -26,22 +26,22 @@ hex = "0.4" untrusted = "0.9.0" libc = "0.2" parking_lot = "0.12" -tracing = "0.1.29" +tracing = "0.1.40" tracing-subscriber = { version = "0.3", features = ["fmt"], optional = true } ip_network = "0.4.1" ip_network_table = "0.2.0" -ring = "0.16" +ring = "0.17" x25519-dalek = { version = "2.0.0", features = [ "reusable_secrets", "static_secrets", ] } -rand_core = { version = "0.6.3", features = ["getrandom"] } +rand_core = { version = "0.6.4", features = ["getrandom"] } chacha20poly1305 = "0.10.0-pre.1" aead = "0.5.0-pre.2" blake2 = "0.10" hmac = "0.12" jni = { version = "0.19.0", optional = true } -mock_instant = { version = "0.2", optional = true } +mock_instant = { version = "0.3", optional = true } socket2 = { version = "0.4.7", features = ["all"], optional = true } thiserror = { version = "1", optional = true } @@ -52,7 +52,7 @@ nix = { version = "0.25", default-features = false, features = [ ] } [dev-dependencies] -etherparse = "0.12" +etherparse = "0.13" tracing-subscriber = "0.3" criterion = { version = "0.3.5", features = ["html_reports"] } diff --git a/boringtun/benches/crypto_benches/x25519_shared_key_benching.rs b/boringtun/benches/crypto_benches/x25519_shared_key_benching.rs index 0ba90625..a3c1145e 100644 --- a/boringtun/benches/crypto_benches/x25519_shared_key_benching.rs +++ b/boringtun/benches/crypto_benches/x25519_shared_key_benching.rs @@ -37,13 +37,8 @@ pub fn bench_x25519_shared_key(c: &mut Criterion) { .unwrap() }, |my_private_key| { - ring::agreement::agree_ephemeral( - my_private_key, - &my_public_key, - ring::error::Unspecified, - |_key_material| Ok(()), - ) - .unwrap() + ring::agreement::agree_ephemeral(my_private_key, &my_public_key, |_key_material| ()) + .unwrap() }, BatchSize::SmallInput, ); diff --git a/boringtun/src/device/async_impl.rs b/boringtun/src/device/async_impl.rs new file mode 100644 index 00000000..a5b9f6c2 --- /dev/null +++ b/boringtun/src/device/async_impl.rs @@ -0,0 +1,535 @@ +use std::{io::{self, BufRead}, sync::Arc, collections::HashMap, ops::{Deref, DerefMut}, os::fd::FromRawFd}; +use libc::*; +use parking_lot::RwLock; +use tokio::sync::mpsc::{UnboundedReceiver, UnboundedSender}; +use crate::{x25519, noise::rate_limiter::RateLimiter, serialization::KeyBytes}; + +use super::{DeviceConfig, tun::IfrIfru, Error, peer::Peer, allowed_ips::AllowedIps, IndexLfsr}; + +const TUNSETIFF: u64 = 0x4004_54ca; + +#[repr(C)] +pub struct ifreq { + ifr_name: [c_uchar; IFNAMSIZ], + ifr_ifru: IfrIfru, +} + + +pub struct AsyncDeviceHandle { + device: Arc>, +} +pub struct AsyncDevice { + key_pair: Option<(x25519::StaticSecret, x25519::PublicKey)>, + // queue: Arc>, + + listen_port: u16, + fwmark: Option, + + iface: AsyncTunSocket, + udp4: Option, + udp6: Option, + + // yield_notice: Option, + // exit_notice: Option, + + peers: HashMap, + peers_by_ip: AllowedIps, + peers_by_idx: HashMap, + next_index: IndexLfsr, + + config: DeviceConfig, + + cleanup_paths: Vec, + + mtu: usize, + + rate_limiter: Option, + + + + #[cfg(target_os = "linux")] + uapi_fd: i32, +} + +impl AsyncDevice { + + pub async fn new(name: &str, config: DeviceConfig) -> Result { + // let poll = EventPoll::::new()?; + + // Create a tunnel device + let iface = AsyncTunSocket::new(name)?; + let mtu = 1500; + + #[cfg(not(target_os = "linux"))] + let uapi_fd = -1; + #[cfg(target_os = "linux")] + let uapi_fd = config.uapi_fd; + + let mut device = AsyncDevice { + + iface, + config, + fwmark: Default::default(), + key_pair: Default::default(), + listen_port: Default::default(), + next_index: Default::default(), + peers: Default::default(), + peers_by_idx: Default::default(), + peers_by_ip: AllowedIps::new(), + udp4: Default::default(), + udp6: Default::default(), + cleanup_paths: Default::default(), + mtu: mtu, + rate_limiter: None, + #[cfg(target_os = "linux")] + uapi_fd, + }; + + + let (mut rx, tx) = device.create_fs_sock().await?; + + + loop { + let frame = rx.recv().await.unwrap(); + + println!("{:?}", frame); + + let out = tx.send(vec![WireGuardProtocol::Errno(0)]); + + } + + + // if uapi_fd >= 0 { + // device.register_api_fd(uapi_fd)?; + // } else { + // device.register_api_handler()?; + // } + // device.register_iface_handler(&device.iface)?; + // device.register_notifiers()?; + // device.register_timers()?; + + #[cfg(target_os = "macos")] + { + // Only for macOS write the actual socket name into WG_TUN_NAME_FILE + if let Ok(name_file) = std::env::var("WG_TUN_NAME_FILE") { + if name == "utun" { + std::fs::write(&name_file, device.iface.name().unwrap().as_bytes()).unwrap(); + device.cleanup_paths.push(name_file); + } + } + } + + Ok(device) + } + + + pub async fn create_fs_sock(&mut self) -> Result<(UnboundedReceiver>, UnboundedSender>), Error> { + let path = format!("{}/{}.sock", "/var/run/wireguard/", self.iface.name); + + tokio::fs::create_dir_all("/var/run/wireguard/").await?; + + let _ = tokio::fs::remove_file(path.clone()).await; + + self.cleanup_paths.push(path.clone()); + + let p = path.clone(); + + let (frame_in_tx, frame_in_rx) = tokio::sync::mpsc::unbounded_channel::>(); + + let (mut frame_out_tx, mut frame_out_rx) = tokio::sync::mpsc::unbounded_channel::>(); + + let rdr = tokio::spawn(async move { + let api_listener = tokio::net::UnixListener::bind(p).map_err(Error::ApiSocket).unwrap(); // Bind a new socket to the path + + loop { + let (mut conn,addr) = api_listener.accept().await.unwrap(); + let (rx, tx) = conn.split(); + println!("New connection: {:?}", addr); + let mut buf = [0; 1024*1024]; + + + loop { + tokio::select! { + f = frame_out_rx.recv() => { + + if let Some(frame) = f { + println!("Got frame from tx {:?}", frame); + let buf = WireGuardProtocol::convert_vec_to_buf(frame); + let mut l = 0; + loop { + // conn.writable().await.unwrap(); + match tx.try_write(&buf[l..]) { + Ok(n) => { + + println!("Wrote {:?} bytes", n); + if n != buf.len() { + l += n; + println!("Wrote {:?} bytes", n); + continue; + } else { + break; + } + }, + Err(e) => { + println!("Error writing to socket: {:?}", e); + break; + } + } + } + + } + }, + _ = rx.readable() => { + let mut protos = vec![]; + match rx.try_read(&mut buf) { + Ok(0) => break, + Ok(n) => { + + println!("Read {:?} bytes", n); + + let mut read_buf = &buf[..n]; + loop { + match WireGuardProtocol::read_frame(read_buf) { + Ok(ReadResponse::Complete(p)) => { + protos.extend(p); + + frame_in_tx.send(protos).unwrap(); + + break; + }, + Ok(ReadResponse::More(p, buf)) => { + protos.extend(p); + read_buf = buf; + continue; + + }, + Ok(ReadResponse::InvalidFrame(buf)) => { + println!("Invalid frame: {:?}", buf); + break; + }, + Err(e) => { + return panic!("err={:?}", e); + } + } + } + } + Err(e) if e.kind() == io::ErrorKind::WouldBlock => { + continue; + } + Err(e) => { + return panic!("err={:?}", e); + } + }; + } + + } + } + + } + }); + + Ok((frame_in_rx, frame_out_tx)) + + + } + + async fn open_listen_socket(&mut self, arg: i32) -> Result<(), io::Error>{ + + let socket4 = tokio::net::UdpSocket::bind(format!("0.0.0.0:{}", arg)).await?; + + let socket6 = tokio::net::UdpSocket::bind(format!("[::]:{}", arg)).await?; + + + self.udp4 = Some(socket4); + self.udp6 = Some(socket6); + + + Ok(()) + } + + + async fn api_set(&mut self, op: WireGuardProtocol) -> Result<(), io::Error> { + + match op { + WireGuardProtocol::Get(_) => panic!("Shouldn't pass that to set"), + WireGuardProtocol::Set(_) => panic!("Shouldn't pass that to set"), + WireGuardProtocol::PrivateKey(key) => { + match key.parse::() { + Ok(key_bytes) => { + self.key(x25519::StaticSecret::from(key_bytes.0)) + } + Err(_) => return EINVAL, + }, + }, + WireGuardProtocol::ListenPort(_) => todo!(), + WireGuardProtocol::Fwmark(_) => todo!(), + WireGuardProtocol::ReplacePeers(_) => todo!(), + WireGuardProtocol::PublicKey(_) => todo!(), + WireGuardProtocol::Remove(_) => todo!(), + WireGuardProtocol::UpdateOnly(_) => todo!(), + WireGuardProtocol::PresharedKey(_) => todo!(), + WireGuardProtocol::Endpoint(_) => todo!(), + WireGuardProtocol::PersistentKeepaliveInterval(_) => todo!(), + WireGuardProtocol::AllowedIP(_) => todo!(), + WireGuardProtocol::RxBytes(_) => todo!(), + WireGuardProtocol::TxBytes(_) => todo!(), + WireGuardProtocol::LastHandshakeTimeSec(_) => todo!(), + WireGuardProtocol::LastHandshakeTimeNsec(_) => todo!(), + WireGuardProtocol::ProtocolVersion(_) => todo!(), + WireGuardProtocol::Errno(_) => todo!(), + } + + } + +} + +type MioHandler = Box Result<(), io::Error>>; + +impl AsyncDeviceHandle { + pub async fn new(name: &str, config: DeviceConfig) -> Result { + let mut wg_interface = AsyncDevice::new(name, config).await?; + wg_interface.open_listen_socket(0).await?; // Start listening on a random port + + + let sock = wg_interface.udp4.as_ref().unwrap(); + + // let mut buf = [0; 1024]; + // loop { + // let (len, addr) = sock.recv_from(&mut buf).await?; + // println!("{:?} bytes received from {:?}", len, addr); + + // let len = sock.send_to(&buf[..len], addr).await?; + // println!("{:?} bytes sent", len); + // } + + let interface_lock = Arc::new(parking_lot::RwLock::new(wg_interface)); + + + + Ok(AsyncDeviceHandle { + device: interface_lock, + }) + } + +} + + +pub struct AsyncTunSocket { + file: tokio::fs::File, + name: String, +} + +impl Drop for AsyncTunSocket { + fn drop(&mut self) { + let _ = std::fs::remove_file(format!("/var/run/{}.sock", self.name)); + } +} + +impl AsyncTunSocket { + pub fn new(name: &str) -> Result { + let provided_fd = name.parse::(); + if let Ok(fd) = provided_fd { + + + let tun_file = unsafe { tokio::fs::File::from_raw_fd(fd) }; + + return Ok(AsyncTunSocket { + file: tun_file, + name: name.to_string(), + }); + } + + let fd = match unsafe { open(b"/dev/net/tun\0".as_ptr() as _, O_RDWR) } { + -1 => return Err(Error::Socket(io::Error::last_os_error())), + fd => fd, + }; + let iface_name = name.as_bytes(); + let mut ifr = ifreq { + ifr_name: [0; IFNAMSIZ], + ifr_ifru: IfrIfru { + ifru_flags: (IFF_TUN | IFF_NO_PI | IFF_MULTI_QUEUE) as _, + }, + }; + + if iface_name.len() >= ifr.ifr_name.len() { + return Err(Error::InvalidTunnelName); + } + + ifr.ifr_name[..iface_name.len()].copy_from_slice(iface_name); + + if unsafe { ioctl(fd, TUNSETIFF as _, &ifr) } < 0 { + return Err(Error::IOCtl(io::Error::last_os_error())); + } + + match unsafe { fcntl(fd, F_GETFL) } { + -1 => return Err(Error::FCntl(io::Error::last_os_error())), + flags => match unsafe { fcntl(fd, F_SETFL, flags | O_NONBLOCK) } { + -1 => return Err(Error::FCntl(io::Error::last_os_error())), + _ => {}, + }, + }; + + let name = name.to_string(); + let tun_file = unsafe { tokio::fs::File::from_raw_fd(fd) }; + + Ok( + AsyncTunSocket { + file: tun_file, + name, + } + ) + } +} + +impl Deref for AsyncTunSocket { + type Target = tokio::fs::File; + + fn deref(&self) -> &Self::Target { + &self.file + } +} + +impl DerefMut for AsyncTunSocket { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.file + } +} + +#[derive(Debug,Clone)] +pub enum WireGuardProtocol { + Get(u8), + Set(u8), + PrivateKey(String), + ListenPort(u16), + Fwmark(u32), + ReplacePeers(bool), + PublicKey(String), + Remove(bool), + UpdateOnly(bool), + PresharedKey(String), + Endpoint(String), + PersistentKeepaliveInterval(u16), + AllowedIP(String), + RxBytes(u64), + TxBytes(u64), + LastHandshakeTimeSec(u64), + LastHandshakeTimeNsec(u64), + ProtocolVersion(u8), + Errno(u8) +} + + + +impl WireGuardProtocol { + + + pub fn convert_to_string(&self) -> String { + match self { + WireGuardProtocol::Get(s) => format!("get={}", s), + WireGuardProtocol::Set(s) => format!("set={}", s), + WireGuardProtocol::PrivateKey(s) => format!("private_key={}", s), + WireGuardProtocol::ListenPort(s) => format!("listen_port={}", s), + WireGuardProtocol::Fwmark(s) => format!("fwmark={}", s), + WireGuardProtocol::ReplacePeers(s) => format!("replace_peers={}", s), + WireGuardProtocol::PublicKey(s) => format!("public_key={}", s), + WireGuardProtocol::Remove(s) => format!("remove={}", s), + WireGuardProtocol::UpdateOnly(s) => format!("update_only={}", s), + WireGuardProtocol::PresharedKey(s) => format!("preshared_key={}", s), + WireGuardProtocol::Endpoint(s) => format!("endpoint={}", s), + WireGuardProtocol::PersistentKeepaliveInterval(s) => format!("persistent_keepalive_interval={}", s), + WireGuardProtocol::AllowedIP(s) => format!("allowed_ip={}", s), + WireGuardProtocol::RxBytes(s) => format!("rx_bytes={}", s), + WireGuardProtocol::TxBytes(s) => format!("tx_bytes={}", s), + WireGuardProtocol::LastHandshakeTimeSec(s) => format!("last_handshake_time_sec={}", s), + WireGuardProtocol::LastHandshakeTimeNsec(s) => format!("last_handshake_time_nsec={}", s), + WireGuardProtocol::ProtocolVersion(s) => format!("protocol_version={}", s), + WireGuardProtocol::Errno(s) => format!("errno={}", s), + } + } + + pub fn convert_line_to_wg_proto(line: &str) -> Result { + let mut split = line.split("="); + + let key = split.next().ok_or(io::Error::new(io::ErrorKind::InvalidData, "Could not split"))?; + let value = split.next().ok_or(io::Error::new(io::ErrorKind::InvalidData, "Could not split"))?; + + match key { + "get" => Ok(WireGuardProtocol::Get(value.parse::().map_err(|_| io::Error::new(io::ErrorKind::InvalidData, "Invalid line"))?)), + "set" => Ok(WireGuardProtocol::Set(value.parse::().map_err(|_| io::Error::new(io::ErrorKind::InvalidData, "Invalid line"))?)), + "private_key" => Ok(WireGuardProtocol::PrivateKey(value.to_string())), + "listen_port" => Ok(WireGuardProtocol::ListenPort(value.parse::().map_err(|_| io::Error::new(io::ErrorKind::InvalidData, "Invalid line"))?)), + "fwmark" => Ok(WireGuardProtocol::Fwmark(value.parse::().map_err(|_| io::Error::new(io::ErrorKind::InvalidData, "Invalid line"))?)), + "replace_peers" => Ok(WireGuardProtocol::ReplacePeers(value.parse::().map_err(|_| io::Error::new(io::ErrorKind::InvalidData, "Invalid line"))?)), + "public_key" => Ok(WireGuardProtocol::PublicKey(value.to_string())), + "remove" => Ok(WireGuardProtocol::Remove(value.parse::().map_err(|_| io::Error::new(io::ErrorKind::InvalidData, "Invalid line"))?)), + "update_only" => Ok(WireGuardProtocol::UpdateOnly(value.parse::().map_err(|_| io::Error::new(io::ErrorKind::InvalidData, "Invalid line"))?)), + "preshared_key" => Ok(WireGuardProtocol::PresharedKey(value.to_string())), + "endpoint" => Ok(WireGuardProtocol::Endpoint(value.to_string())), + "persistent_keepalive_interval" => Ok(WireGuardProtocol::PersistentKeepaliveInterval(value.parse::().map_err(|_| io::Error::new(io::ErrorKind::InvalidData, "Invalid line"))?)), + "allowed_ip" => Ok(WireGuardProtocol::AllowedIP(value.to_string())), + "rx_bytes" => Ok(WireGuardProtocol::RxBytes(value.parse::().map_err(|_| io::Error::new(io::ErrorKind::InvalidData, "Invalid line"))?)), + "tx_bytes" => Ok(WireGuardProtocol::TxBytes(value.parse::().map_err(|_| io::Error::new(io::ErrorKind::InvalidData, "Invalid line"))?)), + "last_handshake_time_sec" => Ok(WireGuardProtocol::LastHandshakeTimeSec(value.parse::().map_err(|_| io::Error::new(io::ErrorKind::InvalidData, "Invalid line"))?)), + "last_handshake_time_nsec" => Ok(WireGuardProtocol::LastHandshakeTimeNsec(value.parse::().map_err(|_| io::Error::new(io::ErrorKind::InvalidData, "Invalid line"))?)), + "protocol_version" => Ok(WireGuardProtocol::ProtocolVersion(value.parse::().map_err(|_| io::Error::new(io::ErrorKind::InvalidData, "Invalid line"))?)), + "errno" => Ok(WireGuardProtocol::Errno(value.parse::().map_err(|_| io::Error::new(io::ErrorKind::InvalidData, "Invalid line"))?)), + _ => Err(io::Error::new(io::ErrorKind::InvalidData, "Unknown key")), + } + } + + + fn convert_vec_to_buf(protos: Vec) -> Vec { + let mut buf = Vec::new(); + + for proto in protos { + buf.extend(proto.convert_to_string().as_bytes()); + buf.push(b'\n'); + } + buf.push(b'\n'); + + buf + } + + fn read_frame(buf: &[u8]) -> Result { + let mut protos = Vec::new(); + + let mut last_idx = 0; + + + let frame_end = buf[last_idx..].windows(2).position(|x| x == b"\n\n"); + match frame_end { + Some(l) => { + + if l == 0 { + return Ok(ReadResponse::Complete(protos)); + } + + let frame = &buf[last_idx..l]; + last_idx = l + 2; + + + for line in frame.lines() { + let proto = WireGuardProtocol::convert_line_to_wg_proto(&line?)?; + protos.push(proto); + } + + if buf[last_idx..].is_empty() { + return Ok(ReadResponse::Complete(protos)); + } else { + return Ok(ReadResponse::More(protos, &buf[last_idx..])); + } + + }, + None => { + return Ok(ReadResponse::InvalidFrame(buf)); + } + } + } + +} +#[derive(Debug)] +enum ReadResponse<'a> { + Complete(Vec), + More(Vec, &'a [u8]), + InvalidFrame(&'a [u8]), +} \ No newline at end of file diff --git a/boringtun/src/device/epoll.rs b/boringtun/src/device/epoll.rs index b6ecaf0b..d2c2123b 100644 --- a/boringtun/src/device/epoll.rs +++ b/boringtun/src/device/epoll.rs @@ -16,6 +16,7 @@ pub enum WaitResult<'a, H> { Ok(EventGuard<'a, H>), /// Event triggered due to End of File conditions EoF(EventGuard<'a, H>), + Eintr(), /// There was an error Error(String), } @@ -224,7 +225,13 @@ impl EventPoll { pub fn wait(&self) -> WaitResult<'_, H> { let mut event = epoll_event { events: 0, u64: 0 }; match unsafe { epoll_wait(self.epoll, &mut event, 1, -1) } { - -1 => return WaitResult::Error(io::Error::last_os_error().to_string()), + -1 => { + let err = io::Error::last_os_error(); + if err.kind() == io::ErrorKind::Interrupted { + return WaitResult::Eintr(); + } + return WaitResult::Error(err.to_string()); + } 1 => {} _ => return WaitResult::Error("unexpected number of events returned".to_string()), } diff --git a/boringtun/src/device/mod.rs b/boringtun/src/device/mod.rs index bc14c896..174d56b5 100644 --- a/boringtun/src/device/mod.rs +++ b/boringtun/src/device/mod.rs @@ -9,7 +9,7 @@ pub mod drop_privileges; mod integration_tests; pub mod peer; -#[cfg(any(target_os = "macos", target_os = "ios"))] +#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))] #[path = "kqueue.rs"] pub mod poll; @@ -17,7 +17,7 @@ pub mod poll; #[path = "epoll.rs"] pub mod poll; -#[cfg(any(target_os = "macos", target_os = "ios"))] +#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))] #[path = "tun_darwin.rs"] pub mod tun; @@ -75,7 +75,7 @@ pub enum Error { SetSockOpt(String), #[error("Invalid tunnel name")] InvalidTunnelName, - #[cfg(any(target_os = "macos", target_os = "ios"))] + #[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))] #[error("{0}")] GetSockOpt(io::Error), #[error("{0}")] @@ -258,6 +258,10 @@ impl DeviceHandle { } } } + WaitResult::Eintr() => { + // Interrupted system call, just try again + continue; + } WaitResult::EoF(handler) => { if uapi_fd >= 0 && uapi_fd == handler.fd() { device_lock.trigger_exit(); @@ -315,10 +319,15 @@ impl Device { return self.remove_peer(&pub_key); } - // Update an existing peer - if self.peers.get(&pub_key).is_some() { + if let Some(peer) = self.peers.get(&pub_key) { // We already have a peer, we need to merge the existing config into the newly created one - panic!("Modifying existing peers is not yet supported. Remove and add again instead."); + let mut peer_mut = peer.lock(); + + peer_mut.tunnel.set_persistent_keepalive(keepalive); + peer_mut.update(endpoint, allowed_ips, preshared_key); + + tracing::info!("Peer updated"); + return; } let next_index = self.next_index(); @@ -334,8 +343,7 @@ impl Device { keepalive, next_index, None, - ) - .unwrap(); + ); let peer = Peer::new(tunn, next_index, endpoint, allowed_ips, preshared_key); @@ -453,8 +461,6 @@ impl Device { } fn set_key(&mut self, private_key: x25519::StaticSecret) { - let mut bad_peers = vec![]; - let public_key = x25519::PublicKey::from(&private_key); let key_pair = Some((private_key.clone(), public_key)); @@ -467,30 +473,15 @@ impl Device { let rate_limiter = Arc::new(RateLimiter::new(&public_key, HANDSHAKE_RATE_LIMIT)); for peer in self.peers.values_mut() { - let mut peer_mut = peer.lock(); - - if peer_mut - .tunnel - .set_static_private( - private_key.clone(), - public_key, - Some(Arc::clone(&rate_limiter)), - ) - .is_err() - { - // In case we encounter an error, we will remove that peer - // An error will be a result of bad public key/secret key combination - bad_peers.push(Arc::clone(peer)); - } + peer.lock().tunnel.set_static_private( + private_key.clone(), + public_key, + Some(Arc::clone(&rate_limiter)), + ) } self.key_pair = key_pair; self.rate_limiter = Some(rate_limiter); - - // Remove all the bad peers - for _ in bad_peers { - unimplemented!(); - } } #[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))] diff --git a/boringtun/src/device/peer.rs b/boringtun/src/device/peer.rs index d7f2c22e..56fcf46d 100644 --- a/boringtun/src/device/peer.rs +++ b/boringtun/src/device/peer.rs @@ -70,6 +70,21 @@ impl Peer { } } + pub fn update( + &mut self, + endpoint: Option, + allowed_ips: &[AllowedIP], + preshared_key: Option<[u8; 32]>, + ) { + + if let Some(addr) = endpoint { + self.set_endpoint(addr); + } + self.allowed_ips = allowed_ips.iter().map(|ip| (ip, ())).collect(); + self.preshared_key = preshared_key; + + } + pub fn update_timers<'a>(&mut self, dst: &'a mut [u8]) -> TunnResult<'a> { self.tunnel.update_timers(dst) } diff --git a/boringtun/src/ffi/mod.rs b/boringtun/src/ffi/mod.rs index 3b4e3bb3..1e5a2a9f 100644 --- a/boringtun/src/ffi/mod.rs +++ b/boringtun/src/ffi/mod.rs @@ -292,17 +292,14 @@ pub unsafe extern "C" fn new_tunnel( Some(keep_alive) }; - let tunnel = match Tunn::new( + let tunnel = Box::new(Mutex::new(Tunn::new( private_key, public_key, preshared_key, keep_alive, index, None, - ) { - Ok(t) => Box::new(Mutex::new(t)), - Err(_) => return ptr::null_mut(), - }; + ))); PANIC_HOOK.call_once(|| { // FFI won't properly unwind on panic, but it will if we cause a segmentation fault diff --git a/boringtun/src/noise/handshake.rs b/boringtun/src/noise/handshake.rs index b7c93731..40ed8037 100644 --- a/boringtun/src/noise/handshake.rs +++ b/boringtun/src/noise/handshake.rs @@ -375,19 +375,19 @@ impl NoiseParams { static_public: x25519::PublicKey, peer_static_public: x25519::PublicKey, preshared_key: Option<[u8; 32]>, - ) -> Result { + ) -> NoiseParams { let static_shared = static_private.diffie_hellman(&peer_static_public); let initial_sending_mac_key = b2s_hash(LABEL_MAC1, peer_static_public.as_bytes()); - Ok(NoiseParams { + NoiseParams { static_public, static_private, peer_static_public, static_shared, sending_mac1_key: initial_sending_mac_key, preshared_key, - }) + } } /// Set a new private key @@ -395,7 +395,7 @@ impl NoiseParams { &mut self, static_private: x25519::StaticSecret, static_public: x25519::PublicKey, - ) -> Result<(), WireGuardError> { + ) { // Check that the public key indeed matches the private key let check_key = x25519::PublicKey::from(&static_private); assert_eq!(check_key.as_bytes(), static_public.as_bytes()); @@ -404,7 +404,6 @@ impl NoiseParams { self.static_public = static_public; self.static_shared = self.static_private.diffie_hellman(&self.peer_static_public); - Ok(()) } } @@ -415,15 +414,15 @@ impl Handshake { peer_static_public: x25519::PublicKey, global_idx: u32, preshared_key: Option<[u8; 32]>, - ) -> Result { + ) -> Handshake { let params = NoiseParams::new( static_private, static_public, peer_static_public, preshared_key, - )?; + ); - Ok(Handshake { + Handshake { params, next_index: global_idx, previous: HandshakeState::None, @@ -432,7 +431,7 @@ impl Handshake { stamper: TimeStamper::new(), cookies: Default::default(), last_rtt: None, - }) + } } pub(crate) fn is_in_progress(&self) -> bool { @@ -475,7 +474,7 @@ impl Handshake { &mut self, private_key: x25519::StaticSecret, public_key: x25519::PublicKey, - ) -> Result<(), WireGuardError> { + ) { self.params.set_static_private(private_key, public_key) } diff --git a/boringtun/src/noise/mod.rs b/boringtun/src/noise/mod.rs index 79a6b923..76e377b6 100644 --- a/boringtun/src/noise/mod.rs +++ b/boringtun/src/noise/mod.rs @@ -198,18 +198,17 @@ impl Tunn { persistent_keepalive: Option, index: u32, rate_limiter: Option>, - ) -> Result { + ) -> Self { let static_public = x25519::PublicKey::from(&static_private); - let tunn = Tunn { + Tunn { handshake: Handshake::new( static_private, static_public, peer_static_public, index << 8, preshared_key, - ) - .map_err(|_| "Invalid parameters")?, + ), sessions: Default::default(), current: Default::default(), tx_bytes: Default::default(), @@ -221,9 +220,7 @@ impl Tunn { rate_limiter: rate_limiter.unwrap_or_else(|| { Arc::new(RateLimiter::new(&static_public, PEER_HANDSHAKE_RATE_LIMIT)) }), - }; - - Ok(tunn) + } } /// Update the private key and clear existing sessions @@ -232,17 +229,16 @@ impl Tunn { static_private: x25519::StaticSecret, static_public: x25519::PublicKey, rate_limiter: Option>, - ) -> Result<(), WireGuardError> { + ) { self.timers.should_reset_rr = rate_limiter.is_none(); self.rate_limiter = rate_limiter.unwrap_or_else(|| { Arc::new(RateLimiter::new(&static_public, PEER_HANDSHAKE_RATE_LIMIT)) }); self.handshake - .set_static_private(static_private, static_public)?; + .set_static_private(static_private, static_public); for s in &mut self.sessions { *s = None; } - Ok(()) } /// Encapsulate a single packet from the tunnel interface. @@ -606,10 +602,9 @@ mod tests { let their_public_key = x25519_dalek::PublicKey::from(&their_secret_key); let their_idx = OsRng.next_u32(); - let my_tun = Tunn::new(my_secret_key, their_public_key, None, None, my_idx, None).unwrap(); + let my_tun = Tunn::new(my_secret_key, their_public_key, None, None, my_idx, None); - let their_tun = - Tunn::new(their_secret_key, my_public_key, None, None, their_idx, None).unwrap(); + let their_tun = Tunn::new(their_secret_key, my_public_key, None, None, their_idx, None); (my_tun, their_tun) } diff --git a/boringtun/src/noise/timers.rs b/boringtun/src/noise/timers.rs index 6b91d576..d7245606 100644 --- a/boringtun/src/noise/timers.rs +++ b/boringtun/src/noise/timers.rs @@ -332,4 +332,8 @@ impl Tunn { None } } + + pub fn set_persistent_keepalive(&mut self, keepalive: Option) { + self.timers.persistent_keepalive = usize::from(keepalive.unwrap_or(0)); + } } diff --git a/boringtun/src/sleepyinstant/unix.rs b/boringtun/src/sleepyinstant/unix.rs index 40aaebab..8488c2f4 100644 --- a/boringtun/src/sleepyinstant/unix.rs +++ b/boringtun/src/sleepyinstant/unix.rs @@ -3,9 +3,9 @@ use std::time::Duration; use nix::sys::time::TimeSpec; use nix::time::{clock_gettime, ClockId}; -#[cfg(any(target_os = "macos", target_os = "ios"))] +#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))] const CLOCK_ID: ClockId = ClockId::CLOCK_MONOTONIC; -#[cfg(not(any(target_os = "macos", target_os = "ios")))] +#[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "tvos")))] const CLOCK_ID: ClockId = ClockId::CLOCK_BOOTTIME; #[derive(Clone, Copy, Debug)]