From 615f926618471998f85ee184b378b1128340367b Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Tue, 4 Apr 2023 18:46:14 +0200 Subject: [PATCH 01/10] Add STUN actor that saves autodiscovered IPv4/IPv6 to Consul --- Cargo.lock | 866 +++++++++++++++++++++--- Cargo.nix | 1265 ++++++++++++++++++++++++++++++------ Cargo.toml | 1 + src/config/mod.rs | 3 +- src/config/options.rs | 4 +- src/config/options_test.rs | 4 + src/config/runtime.rs | 48 +- src/consul.rs | 19 +- src/consul_actor.rs | 19 +- src/diplonat.rs | 16 +- src/fw.rs | 4 + src/igd_actor.rs | 1 + src/main.rs | 9 +- src/stun_actor.rs | 95 +++ 14 files changed, 2030 insertions(+), 324 deletions(-) create mode 100644 src/stun_actor.rs diff --git a/Cargo.lock b/Cargo.lock index 73e1e76..0208df8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -26,6 +26,123 @@ version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9a60d744a80c30fcb657dfe2c1b22bcb3e814c1a1e3674f32bf5820b570fbff" +[[package]] +name = "async-channel" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833" +dependencies = [ + "concurrent-queue 2.1.0", + "event-listener", + "futures-core", +] + +[[package]] +name = "async-executor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "871f9bb5e0a22eeb7e8cf16641feb87c9dc67032ccf8ff49e772eb9941d3a965" +dependencies = [ + "async-task", + "concurrent-queue 1.2.4", + "fastrand", + "futures-lite", + "once_cell", + "slab", +] + +[[package]] +name = "async-global-executor" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1b6f5d7df27bd294849f8eec66ecfc63d11814df7a4f5d74168a2394467b776" +dependencies = [ + "async-channel", + "async-executor", + "async-io", + "async-lock", + "blocking", + "futures-lite", + "once_cell", +] + +[[package]] +name = "async-io" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" +dependencies = [ + "async-lock", + "autocfg", + "cfg-if 1.0.0", + "concurrent-queue 2.1.0", + "futures-lite", + "log 0.4.17", + "parking", + "polling", + "rustix", + "slab", + "socket2 0.4.9", + "waker-fn", +] + +[[package]] +name = "async-lock" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa24f727524730b077666307f2734b4a1a1c57acb79193127dcc8914d5242dd7" +dependencies = [ + "event-listener", +] + +[[package]] +name = "async-macros" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "644a5a8de80f2085a1e7e57cd1544a2a7438f6e003c0790999bd43b92a77cdb2" +dependencies = [ + "futures-core", + "pin-utils", +] + +[[package]] +name = "async-std" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" +dependencies = [ + "async-channel", + "async-global-executor", + "async-io", + "async-lock", + "crossbeam-utils", + "futures-channel", + "futures-core", + "futures-io", + "futures-lite", + "gloo-timers", + "kv-log-macro", + "log 0.4.17", + "memchr", + "once_cell", + "pin-project-lite", + "pin-utils", + "slab", + "wasm-bindgen-futures", +] + +[[package]] +name = "async-task" +version = "4.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc7ab41815b3c653ccd2978ec3255c81349336702dfdf62ee6f7069b12a3aae" + +[[package]] +name = "atomic-waker" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "debc29dde2e69f9e47506b525f639ed42300fc014a3e007832592448fa8e4599" + [[package]] name = "attohttpc" version = "0.16.3" @@ -33,7 +150,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdb8867f378f33f78a811a8eb9bf108ad99430d7aad43315dd9319c827ef6247" dependencies = [ "http", - "log", + "log 0.4.17", "url", "wildmatch", ] @@ -44,9 +161,9 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.12", "libc", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -67,6 +184,32 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8dead7461c1127cf637931a1e50934eb6eee8bff2f74433ac7909e9afcee04a3" +[[package]] +name = "bitflags" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f67931368edf3a9a51d29886d245f1c3db2f1ef0dcc9e35ff70341b78c10d23" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "blocking" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c67b173a56acffd6d2326fb7ab938ba0b00a71480e14902b2591c87bc5741e8" +dependencies = [ + "async-channel", + "async-lock", + "async-task", + "atomic-waker", + "fastrand", + "futures-lite", +] + [[package]] name = "bumpalo" version = "3.2.0" @@ -91,6 +234,12 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4964518bd3b4a8190e832886cdc0da9794f12e8e6c1613a9e90ff331c4c8724b" +[[package]] +name = "cache-padded" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c" + [[package]] name = "cc" version = "1.0.72" @@ -109,6 +258,43 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "concurrent-queue" +version = "1.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af4780a44ab5696ea9e28294517f1fffb421a83a25af521333c838635509db9c" +dependencies = [ + "cache-padded", +] + +[[package]] +name = "concurrent-queue" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c278839b831783b70278b14df4d45e1beb1aad306c07bb796637de9a0e323e8e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "ctor" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" +dependencies = [ + "quote", + "syn 1.0.109", +] + [[package]] name = "diplonat" version = "0.1.0" @@ -119,13 +305,14 @@ dependencies = [ "get_if_addrs", "igd", "iptables", - "log", + "log 0.4.17", "pretty_env_logger", "regex 1.3.7", "reqwest", "serde", "serde-lexpr", "serde_json", + "stun-client", "tokio", ] @@ -146,7 +333,7 @@ checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" dependencies = [ "atty", "humantime", - "log", + "log 0.4.17", "regex 1.3.7", "termcolor", ] @@ -160,6 +347,42 @@ dependencies = [ "serde", ] +[[package]] +name = "errno" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50d6a0976c999d473fe89ad888d5a284e55366d9dc9038b1ba2aa15128c4afa0" +dependencies = [ + "errno-dragonfly", + "libc", + "windows-sys 0.45.0", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + +[[package]] +name = "fastrand" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" +dependencies = [ + "instant", +] + [[package]] name = "fnv" version = "1.0.6" @@ -178,9 +401,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.5" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e05b85ec287aac0dc34db7d4a569323df697f9c55b99b15d6b4ef8cde49f613" +checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" dependencies = [ "futures-channel", "futures-core", @@ -193,9 +416,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.5" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f366ad74c28cca6ba456d95e6422883cfb4b252a83bed929c83abfdbbf2967d5" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" dependencies = [ "futures-core", "futures-sink", @@ -203,15 +426,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.5" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" [[package]] name = "futures-executor" -version = "0.3.5" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10d6bb888be1153d3abeb9006b11b02cf5e9b209fda28693c31ae1e4e012e314" +checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" dependencies = [ "futures-core", "futures-task", @@ -220,42 +443,53 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.5" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de27142b013a8e869c14957e6d2edeef89e97c289e69d042ee3a49acd8b51789" +checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" + +[[package]] +name = "futures-lite" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] [[package]] name = "futures-macro" -version = "0.3.5" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0b5a30a4328ab5473878237c447333c093297bded83a4983d10f4deea240d39" +checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ - "proc-macro-hack", "proc-macro2", "quote", - "syn", + "syn 2.0.13", ] [[package]] name = "futures-sink" -version = "0.3.5" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f2032893cb734c7a05d85ce0cc8b8c4075278e93b24b66f9de99d6eb0fa8acc" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" [[package]] name = "futures-task" -version = "0.3.5" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626" -dependencies = [ - "once_cell", -] +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" [[package]] name = "futures-util" -version = "0.3.5" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" dependencies = [ "futures-channel", "futures-core", @@ -264,10 +498,8 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project 0.4.8", + "pin-project-lite", "pin-utils", - "proc-macro-hack", - "proc-macro-nested", "slab", ] @@ -310,6 +542,24 @@ dependencies = [ "wasi", ] +[[package]] +name = "glob" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" + +[[package]] +name = "gloo-timers" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", +] + [[package]] name = "h2" version = "0.3.9" @@ -344,6 +594,12 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" + [[package]] name = "http" version = "0.2.0" @@ -403,8 +659,8 @@ dependencies = [ "httparse", "httpdate", "itoa", - "pin-project 1.0.8", - "socket2", + "pin-project", + "socket2 0.3.19", "tokio", "tower-service", "tracing", @@ -446,7 +702,7 @@ dependencies = [ "futures", "http", "hyper", - "log", + "log 0.4.17", "rand", "tokio", "url", @@ -463,12 +719,41 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "io-lifetimes" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09270fd4fa1111bc614ed2246c7ef56239a3063d5be0d1ec3b589c505d400aeb" +dependencies = [ + "hermit-abi 0.3.1", + "libc", + "windows-sys 0.45.0", +] + [[package]] name = "ipnet" version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9" +[[package]] +name = "ipnetwork" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02c3eaab3ac0ede60ffa41add21970a7df7d91772c03383aac6c2c3d53cc716b" +dependencies = [ + "serde", +] + [[package]] name = "iptables" version = "0.2.2" @@ -495,6 +780,25 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + +[[package]] +name = "kv-log-macro" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" +dependencies = [ + "log 0.4.17", +] + [[package]] name = "lazy_static" version = "0.2.11" @@ -532,17 +836,33 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.112" +version = "0.2.141" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125" +checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5" + +[[package]] +name = "linux-raw-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d59d8c75012853d2e872fb56bc8a2e53718e2cafe1a4c823143141c6d90c322f" [[package]] name = "log" -version = "0.4.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" +checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" dependencies = [ - "cfg-if 0.1.10", + "log 0.4.17", +] + +[[package]] +name = "log" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if 1.0.0", + "value-bag", ] [[package]] @@ -553,9 +873,9 @@ checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" [[package]] name = "memchr" -version = "2.3.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3197e20c7edb283f87c071ddfc7a2cca8f8e0b888c242959846a6fce03c72223" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "mime" @@ -570,10 +890,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc" dependencies = [ "libc", - "log", + "log 0.4.17", "miow", "ntapi", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -582,7 +902,7 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" dependencies = [ - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -591,7 +911,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0d95c5fa8b641c10ad0b8887454ebaafa3c92b5cd5350f8fc693adafd178e7b" dependencies = [ - "bitflags", + "bitflags 0.4.0", "cfg-if 0.1.10", "libc", "rustc_version", @@ -605,7 +925,7 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a31937dea023539c72ddae0e3571deadc1414b300483fa7aaec176168cfa9d2" dependencies = [ - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -614,7 +934,7 @@ version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.12", "libc", ] @@ -624,39 +944,25 @@ version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5" +[[package]] +name = "parking" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" + [[package]] name = "percent-encoding" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" -[[package]] -name = "pin-project" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7804a463a8d9572f13453c516a5faea534a2403d7ced2f0c7e100eeff072772c" -dependencies = [ - "pin-project-internal 0.4.8", -] - [[package]] name = "pin-project" version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "576bc800220cc65dac09e99e97b08b358cfab6e17078de8dc5fee223bd2d0c08" dependencies = [ - "pin-project-internal 1.0.8", -] - -[[package]] -name = "pin-project-internal" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "385322a45f2ecf3410c68d2a549a4a2685e8051d0f278e39743ff4e451cb9b3f" -dependencies = [ - "proc-macro2", - "quote", - "syn", + "pin-project-internal", ] [[package]] @@ -667,7 +973,7 @@ checksum = "6e8fe8163d14ce7f0cdac2e040116f22eac817edabff0be91e8aff7e9accf389" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -682,6 +988,108 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pnet" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b657d5b9a98a2c81b82549922b8b15984e49f8120cd130b11a09f81b9b55d633" +dependencies = [ + "ipnetwork", + "pnet_base", + "pnet_datalink", + "pnet_packet", + "pnet_sys", + "pnet_transport", +] + +[[package]] +name = "pnet_base" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e4688aa497ef62129f302a5800ebde67825f8ff129f43690ca84099f6620bed" + +[[package]] +name = "pnet_datalink" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59001c9c4d9d23bf2f61afaaf134a766fd6932ba2557c606b9112157053b9ac7" +dependencies = [ + "ipnetwork", + "libc", + "pnet_base", + "pnet_sys", + "winapi 0.3.9", +] + +[[package]] +name = "pnet_macros" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d894a90dbdbe976e624453fc31b1912f658083778329442dda1cca94f76a3e76" +dependencies = [ + "regex 1.3.7", + "syntex", + "syntex_syntax", +] + +[[package]] +name = "pnet_macros_support" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b99269a458570bc06a9132254349f6543d9abc92e88b68d8de934aac9481f6c" +dependencies = [ + "pnet_base", +] + +[[package]] +name = "pnet_packet" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33f8238f4eb897a55ca06510cd71afb5b5ca7b4ff2d7188f1ca855fc1710133e" +dependencies = [ + "glob", + "pnet_base", + "pnet_macros", + "pnet_macros_support", + "syntex", +] + +[[package]] +name = "pnet_sys" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7589e4c4e7ed72a3ffdff8a65d3bea84e8c3a23e19d0a10e8f45efdf632fff15" +dependencies = [ + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "pnet_transport" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "326abdfd2e70e8e943bd58087b59686de170cac050a3b19c9fcc84db01690af5" +dependencies = [ + "libc", + "pnet_base", + "pnet_packet", + "pnet_sys", +] + +[[package]] +name = "polling" +version = "2.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22122d5ec4f9fe1b3916419b76be1e80bcb93f618d071d2edf841b137b2a2bd6" +dependencies = [ + "autocfg", + "cfg-if 1.0.0", + "libc", + "log 0.4.17", + "wepoll-ffi", + "windows-sys 0.42.0", +] + [[package]] name = "ppv-lite86" version = "0.2.15" @@ -695,7 +1103,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "926d36b9553851b8b0005f1275891b392ee4d2d833852c417ed025477350fb9d" dependencies = [ "env_logger", - "log", + "log 0.4.17", ] [[package]] @@ -706,22 +1114,16 @@ checksum = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] -[[package]] -name = "proc-macro-nested" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "369a6ed065f249a159e06c45752c780bda2fb53c995718f9e484d08daa9eb42e" - [[package]] name = "proc-macro2" -version = "1.0.34" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f84e92c0f7c9d58328b85a78557813e4bd845130db68d7184635344399423b1" +checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" dependencies = [ - "unicode-xid", + "unicode-ident", ] [[package]] @@ -732,9 +1134,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.2" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" +checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" dependencies = [ "proc-macro2", ] @@ -837,7 +1239,7 @@ dependencies = [ "ipnet", "js-sys", "lazy_static 1.4.0", - "log", + "log 0.4.17", "mime", "percent-encoding", "pin-project-lite", @@ -867,9 +1269,15 @@ dependencies = [ "spin", "untrusted", "web-sys", - "winapi 0.3.8", + "winapi 0.3.9", ] +[[package]] +name = "rustc-serialize" +version = "0.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" + [[package]] name = "rustc_version" version = "0.1.7" @@ -879,13 +1287,27 @@ dependencies = [ "semver", ] +[[package]] +name = "rustix" +version = "0.37.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2aae838e49b3d63e9274e1c01833cc8139d3fec468c3b84688c628f44b1ae11d" +dependencies = [ + "bitflags 1.3.2", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys 0.45.0", +] + [[package]] name = "rustls" version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d37e5e2290f3e040b594b1a9e04377c2c671f1a1cfd9bfdef82106ac1c113f84" dependencies = [ - "log", + "log 0.4.17", "ring", "sct", "webpki", @@ -949,7 +1371,7 @@ checksum = "10be45e22e5597d4b88afcc71f9d7bfadcd604bf0c78a3ab4582b8d2b37f39f3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -995,7 +1417,17 @@ checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" dependencies = [ "cfg-if 1.0.0", "libc", - "winapi 0.3.8", + "winapi 0.3.9", +] + +[[package]] +name = "socket2" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +dependencies = [ + "libc", + "winapi 0.3.9", ] [[package]] @@ -1005,16 +1437,100 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] -name = "syn" -version = "1.0.83" +name = "stun-client" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23a1dfb999630e338648c83e91c59a4e9fb7620f520c3194b6b89e276f2f1959" +checksum = "ee0dfeef11f3744dc4784dcfde4d8cc91248fd3021db9ff10157768798e39a8e" +dependencies = [ + "async-macros", + "async-std", + "futures", + "pnet", + "rand", + "thiserror", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ "proc-macro2", "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c9da457c5285ac1f936ebd076af6dac17a61cfe7826f2076b4d015cf47bc8ec" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syntex" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a30b08a6b383a22e5f6edc127d169670d48f905bb00ca79a00ea3e442ebe317" +dependencies = [ + "syntex_errors", + "syntex_syntax", +] + +[[package]] +name = "syntex_errors" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04c48f32867b6114449155b2a82114b86d4b09e1bddb21c47ff104ab9172b646" +dependencies = [ + "libc", + "log 0.3.9", + "rustc-serialize", + "syntex_pos", + "term", "unicode-xid", ] +[[package]] +name = "syntex_pos" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fd49988e52451813c61fecbe9abb5cfd4e1b7bb6cdbb980a6fbcbab859171a6" +dependencies = [ + "rustc-serialize", +] + +[[package]] +name = "syntex_syntax" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7628a0506e8f9666fdabb5f265d0059b059edac9a3f810bda077abb5d826bd8d" +dependencies = [ + "bitflags 0.5.0", + "libc", + "log 0.3.9", + "rustc-serialize", + "syntex_errors", + "syntex_pos", + "term", + "unicode-xid", +] + +[[package]] +name = "term" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1" +dependencies = [ + "kernel32-sys", + "winapi 0.2.8", +] + [[package]] name = "termcolor" version = "1.1.0" @@ -1024,6 +1540,26 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "thiserror" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.13", +] + [[package]] name = "thread_local" version = "0.3.6" @@ -1055,7 +1591,7 @@ dependencies = [ "num_cpus", "pin-project-lite", "tokio-macros", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -1066,7 +1602,7 @@ checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -1089,7 +1625,7 @@ dependencies = [ "bytes 1.1.0", "futures-core", "futures-sink", - "log", + "log 0.4.17", "pin-project-lite", "tokio", ] @@ -1141,6 +1677,12 @@ dependencies = [ "matches", ] +[[package]] +name = "unicode-ident" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" + [[package]] name = "unicode-normalization" version = "0.1.12" @@ -1152,9 +1694,9 @@ dependencies = [ [[package]] name = "unicode-xid" -version = "0.2.0" +version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" +checksum = "36dff09cafb4ec7c8cf0023eb0b686cb6ce65499116a12201c9e11840ca01beb" [[package]] name = "untrusted" @@ -1180,19 +1722,41 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4ae116fef2b7fea257ed6440d3cfcff7f190865f170cdad00bb6465bf18ecba" +[[package]] +name = "value-bag" +version = "1.0.0-alpha.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2209b78d1249f7e6f3293657c9779fe31ced465df091bbd433a1cf88e916ec55" +dependencies = [ + "ctor", + "version_check", +] + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + [[package]] name = "void" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +[[package]] +name = "waker-fn" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" + [[package]] name = "want" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" dependencies = [ - "log", + "log 0.4.17", "try-lock", ] @@ -1220,10 +1784,10 @@ checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b" dependencies = [ "bumpalo", "lazy_static 1.4.0", - "log", + "log 0.4.17", "proc-macro2", "quote", - "syn", + "syn 1.0.109", "wasm-bindgen-shared", ] @@ -1257,7 +1821,7 @@ checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -1288,6 +1852,15 @@ dependencies = [ "untrusted", ] +[[package]] +name = "wepoll-ffi" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d743fdedc5c64377b5fc2bc036b01c7fd642205a0d96356034ae3404d49eb7fb" +dependencies = [ + "cc", +] + [[package]] name = "wildmatch" version = "1.1.0" @@ -1302,14 +1875,20 @@ checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" [[package]] name = "winapi" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ "winapi-i686-pc-windows-gnu", "winapi-x86_64-pc-windows-gnu", ] +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" + [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -1322,7 +1901,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -1331,13 +1910,94 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +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-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +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.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + [[package]] name = "winreg" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" dependencies = [ - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] diff --git a/Cargo.nix b/Cargo.nix index db4a90d..e175f5b 100644 --- a/Cargo.nix +++ b/Cargo.nix @@ -23,7 +23,7 @@ args@{ ignoreLockHash, }: let - nixifiedLockHash = "4d0d191cfd882cd499203e5184c18f2cb0540a4e6ecc4b1fcfeff5f77fac4996"; + nixifiedLockHash = "50e0fb9e767afb6ee4ed63276e396b24c26156ab1dddc2b3058ffb0330a1081f"; workspaceSrc = if args.workspaceSrc == null then ./. else args.workspaceSrc; currentLockHash = builtins.hashFile "sha256" (workspaceSrc + /Cargo.lock); lockHashIgnored = if ignoreLockHash @@ -53,7 +53,7 @@ in registry = "registry+https://github.com/rust-lang/crates.io-index"; src = fetchCratesIo { inherit name version; sha256 = "81ce3d38065e618af2d7b77e10c5ad9a069859b4be3c2250f674af3840d9c8a5"; }; dependencies = { - memchr = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".memchr."2.3.0" { inherit profileName; }).out; + memchr = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".memchr."2.5.0" { inherit profileName; }).out; }; }); @@ -67,7 +67,7 @@ in [ "std" ] ]; dependencies = { - memchr = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".memchr."2.3.0" { inherit profileName; }).out; + memchr = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".memchr."2.5.0" { inherit profileName; }).out; }; }); @@ -82,6 +82,165 @@ in ]; }); + "registry+https://github.com/rust-lang/crates.io-index".async-channel."1.8.0" = overridableMkRustCrate (profileName: rec { + name = "async-channel"; + version = "1.8.0"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833"; }; + dependencies = { + concurrent_queue = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".concurrent-queue."2.1.0" { inherit profileName; }).out; + event_listener = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".event-listener."2.5.3" { inherit profileName; }).out; + futures_core = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.28" { inherit profileName; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".async-executor."1.4.1" = overridableMkRustCrate (profileName: rec { + name = "async-executor"; + version = "1.4.1"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "871f9bb5e0a22eeb7e8cf16641feb87c9dc67032ccf8ff49e772eb9941d3a965"; }; + dependencies = { + async_task = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".async-task."4.4.0" { inherit profileName; }).out; + concurrent_queue = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".concurrent-queue."1.2.4" { inherit profileName; }).out; + fastrand = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".fastrand."1.9.0" { inherit profileName; }).out; + futures_lite = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-lite."1.12.0" { inherit profileName; }).out; + once_cell = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".once_cell."1.9.0" { inherit profileName; }).out; + slab = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".slab."0.4.2" { inherit profileName; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".async-global-executor."2.3.1" = overridableMkRustCrate (profileName: rec { + name = "async-global-executor"; + version = "2.3.1"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "f1b6f5d7df27bd294849f8eec66ecfc63d11814df7a4f5d74168a2394467b776"; }; + features = builtins.concatLists [ + [ "async-io" ] + [ "default" ] + ]; + dependencies = { + async_channel = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".async-channel."1.8.0" { inherit profileName; }).out; + async_executor = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".async-executor."1.4.1" { inherit profileName; }).out; + async_io = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".async-io."1.13.0" { inherit profileName; }).out; + async_lock = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".async-lock."2.7.0" { inherit profileName; }).out; + blocking = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".blocking."1.3.0" { inherit profileName; }).out; + futures_lite = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-lite."1.12.0" { inherit profileName; }).out; + once_cell = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".once_cell."1.9.0" { inherit profileName; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".async-io."1.13.0" = overridableMkRustCrate (profileName: rec { + name = "async-io"; + version = "1.13.0"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af"; }; + dependencies = { + async_lock = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".async-lock."2.7.0" { inherit profileName; }).out; + cfg_if = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; }).out; + concurrent_queue = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".concurrent-queue."2.1.0" { inherit profileName; }).out; + futures_lite = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-lite."1.12.0" { inherit profileName; }).out; + log = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; }).out; + parking = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".parking."2.0.0" { inherit profileName; }).out; + polling = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".polling."2.5.2" { inherit profileName; }).out; + rustix = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".rustix."0.37.7" { inherit profileName; }).out; + slab = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".slab."0.4.2" { inherit profileName; }).out; + socket2 = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".socket2."0.4.9" { inherit profileName; }).out; + waker_fn = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".waker-fn."1.1.0" { inherit profileName; }).out; + }; + buildDependencies = { + autocfg = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".autocfg."1.0.0" { profileName = "__noProfile"; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".async-lock."2.7.0" = overridableMkRustCrate (profileName: rec { + name = "async-lock"; + version = "2.7.0"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "fa24f727524730b077666307f2734b4a1a1c57acb79193127dcc8914d5242dd7"; }; + dependencies = { + event_listener = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".event-listener."2.5.3" { inherit profileName; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".async-macros."2.0.0" = overridableMkRustCrate (profileName: rec { + name = "async-macros"; + version = "2.0.0"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "644a5a8de80f2085a1e7e57cd1544a2a7438f6e003c0790999bd43b92a77cdb2"; }; + dependencies = { + futures_core = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.28" { inherit profileName; }).out; + pin_utils = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-utils."0.1.0" { inherit profileName; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".async-std."1.12.0" = overridableMkRustCrate (profileName: rec { + name = "async-std"; + version = "1.12.0"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d"; }; + features = builtins.concatLists [ + [ "alloc" ] + [ "async-channel" ] + [ "async-global-executor" ] + [ "async-io" ] + [ "async-lock" ] + [ "crossbeam-utils" ] + [ "default" ] + [ "futures-channel" ] + [ "futures-core" ] + [ "futures-io" ] + [ "futures-lite" ] + [ "gloo-timers" ] + [ "kv-log-macro" ] + [ "log" ] + [ "memchr" ] + [ "once_cell" ] + [ "pin-project-lite" ] + [ "pin-utils" ] + [ "slab" ] + [ "std" ] + [ "wasm-bindgen-futures" ] + ]; + dependencies = { + async_channel = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".async-channel."1.8.0" { inherit profileName; }).out; + ${ if !(hostPlatform.parsed.kernel.name == "unknown") then "async_global_executor" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".async-global-executor."2.3.1" { inherit profileName; }).out; + ${ if !(hostPlatform.parsed.kernel.name == "unknown") then "async_io" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".async-io."1.13.0" { inherit profileName; }).out; + async_lock = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".async-lock."2.7.0" { inherit profileName; }).out; + crossbeam_utils = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".crossbeam-utils."0.8.15" { inherit profileName; }).out; + ${ if hostPlatform.parsed.cpu.name == "wasm32" then "futures_channel" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-channel."0.3.28" { inherit profileName; }).out; + futures_core = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.28" { inherit profileName; }).out; + futures_io = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-io."0.3.28" { inherit profileName; }).out; + ${ if !(hostPlatform.parsed.kernel.name == "unknown") then "futures_lite" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-lite."1.12.0" { inherit profileName; }).out; + ${ if hostPlatform.parsed.cpu.name == "wasm32" then "gloo_timers" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".gloo-timers."0.2.6" { inherit profileName; }).out; + kv_log_macro = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".kv-log-macro."1.0.7" { inherit profileName; }).out; + log = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; }).out; + memchr = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".memchr."2.5.0" { inherit profileName; }).out; + once_cell = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".once_cell."1.9.0" { inherit profileName; }).out; + pin_project_lite = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.7" { inherit profileName; }).out; + pin_utils = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-utils."0.1.0" { inherit profileName; }).out; + slab = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".slab."0.4.2" { inherit profileName; }).out; + ${ if hostPlatform.parsed.cpu.name == "wasm32" then "wasm_bindgen_futures" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".wasm-bindgen-futures."0.4.28" { inherit profileName; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".async-task."4.4.0" = overridableMkRustCrate (profileName: rec { + name = "async-task"; + version = "4.4.0"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "ecc7ab41815b3c653ccd2978ec3255c81349336702dfdf62ee6f7069b12a3aae"; }; + features = builtins.concatLists [ + [ "default" ] + [ "std" ] + ]; + }); + + "registry+https://github.com/rust-lang/crates.io-index".atomic-waker."1.1.0" = overridableMkRustCrate (profileName: rec { + name = "atomic-waker"; + version = "1.1.0"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "debc29dde2e69f9e47506b525f639ed42300fc014a3e007832592448fa8e4599"; }; + }); + "registry+https://github.com/rust-lang/crates.io-index".attohttpc."0.16.3" = overridableMkRustCrate (profileName: rec { name = "attohttpc"; version = "0.16.3"; @@ -89,7 +248,7 @@ in src = fetchCratesIo { inherit name version; sha256 = "fdb8867f378f33f78a811a8eb9bf108ad99430d7aad43315dd9319c827ef6247"; }; dependencies = { http = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.0" { inherit profileName; }).out; - log = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.8" { inherit profileName; }).out; + log = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; }).out; url = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".url."2.2.2" { inherit profileName; }).out; wildmatch = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".wildmatch."1.1.0" { inherit profileName; }).out; }; @@ -102,8 +261,8 @@ in src = fetchCratesIo { inherit name version; sha256 = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"; }; dependencies = { ${ if hostPlatform.parsed.kernel.name == "hermit" then "hermit_abi" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".hermit-abi."0.1.12" { inherit profileName; }).out; - ${ if hostPlatform.isUnix then "libc" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.112" { inherit profileName; }).out; - ${ if hostPlatform.isWindows then "winapi" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.8" { inherit profileName; }).out; + ${ if hostPlatform.isUnix then "libc" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.141" { inherit profileName; }).out; + ${ if hostPlatform.isWindows then "winapi" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.9" { inherit profileName; }).out; }; }); @@ -132,6 +291,38 @@ in src = fetchCratesIo { inherit name version; sha256 = "8dead7461c1127cf637931a1e50934eb6eee8bff2f74433ac7909e9afcee04a3"; }; }); + "registry+https://github.com/rust-lang/crates.io-index".bitflags."0.5.0" = overridableMkRustCrate (profileName: rec { + name = "bitflags"; + version = "0.5.0"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "4f67931368edf3a9a51d29886d245f1c3db2f1ef0dcc9e35ff70341b78c10d23"; }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".bitflags."1.3.2" = overridableMkRustCrate (profileName: rec { + name = "bitflags"; + version = "1.3.2"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"; }; + features = builtins.concatLists [ + [ "default" ] + ]; + }); + + "registry+https://github.com/rust-lang/crates.io-index".blocking."1.3.0" = overridableMkRustCrate (profileName: rec { + name = "blocking"; + version = "1.3.0"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "3c67b173a56acffd6d2326fb7ab938ba0b00a71480e14902b2591c87bc5741e8"; }; + dependencies = { + async_channel = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".async-channel."1.8.0" { inherit profileName; }).out; + async_lock = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".async-lock."2.7.0" { inherit profileName; }).out; + async_task = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".async-task."4.4.0" { inherit profileName; }).out; + atomic_waker = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".atomic-waker."1.1.0" { inherit profileName; }).out; + fastrand = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".fastrand."1.9.0" { inherit profileName; }).out; + futures_lite = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-lite."1.12.0" { inherit profileName; }).out; + }; + }); + "registry+https://github.com/rust-lang/crates.io-index".bumpalo."3.2.0" = overridableMkRustCrate (profileName: rec { name = "bumpalo"; version = "3.2.0"; @@ -171,6 +362,13 @@ in src = fetchCratesIo { inherit name version; sha256 = "4964518bd3b4a8190e832886cdc0da9794f12e8e6c1613a9e90ff331c4c8724b"; }; }); + "registry+https://github.com/rust-lang/crates.io-index".cache-padded."1.2.0" = overridableMkRustCrate (profileName: rec { + name = "cache-padded"; + version = "1.2.0"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c"; }; + }); + "registry+https://github.com/rust-lang/crates.io-index".cc."1.0.72" = overridableMkRustCrate (profileName: rec { name = "cc"; version = "1.0.72"; @@ -192,6 +390,55 @@ in src = fetchCratesIo { inherit name version; sha256 = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"; }; }); + "registry+https://github.com/rust-lang/crates.io-index".concurrent-queue."1.2.4" = overridableMkRustCrate (profileName: rec { + name = "concurrent-queue"; + version = "1.2.4"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "af4780a44ab5696ea9e28294517f1fffb421a83a25af521333c838635509db9c"; }; + dependencies = { + cache_padded = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".cache-padded."1.2.0" { inherit profileName; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".concurrent-queue."2.1.0" = overridableMkRustCrate (profileName: rec { + name = "concurrent-queue"; + version = "2.1.0"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "c278839b831783b70278b14df4d45e1beb1aad306c07bb796637de9a0e323e8e"; }; + features = builtins.concatLists [ + [ "default" ] + [ "std" ] + ]; + dependencies = { + crossbeam_utils = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".crossbeam-utils."0.8.15" { inherit profileName; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".crossbeam-utils."0.8.15" = overridableMkRustCrate (profileName: rec { + name = "crossbeam-utils"; + version = "0.8.15"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b"; }; + features = builtins.concatLists [ + [ "default" ] + [ "std" ] + ]; + dependencies = { + cfg_if = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".ctor."0.1.26" = overridableMkRustCrate (profileName: rec { + name = "ctor"; + version = "0.1.26"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096"; }; + dependencies = { + quote = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.26" { inherit profileName; }).out; + syn = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.109" { inherit profileName; }).out; + }; + }); + "unknown".diplonat."0.1.0" = overridableMkRustCrate (profileName: rec { name = "diplonat"; version = "0.1.0"; @@ -200,17 +447,18 @@ in dependencies = { anyhow = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".anyhow."1.0.28" { inherit profileName; }).out; envy = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".envy."0.4.2" { inherit profileName; }).out; - futures = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures."0.3.5" { inherit profileName; }).out; + futures = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures."0.3.28" { inherit profileName; }).out; get_if_addrs = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".get_if_addrs."0.5.3" { inherit profileName; }).out; igd = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".igd."0.12.0" { inherit profileName; }).out; iptables = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".iptables."0.2.2" { inherit profileName; }).out; - log = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.8" { inherit profileName; }).out; + log = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; }).out; pretty_env_logger = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".pretty_env_logger."0.4.0" { inherit profileName; }).out; regex = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".regex."1.3.7" { inherit profileName; }).out; reqwest = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".reqwest."0.11.8" { inherit profileName; }).out; serde = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.107" { inherit profileName; }).out; serde_lexpr = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde-lexpr."0.1.1" { inherit profileName; }).out; serde_json = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_json."1.0.53" { inherit profileName; }).out; + stun_client = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".stun-client."0.1.2" { inherit profileName; }).out; tokio = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.15.0" { inherit profileName; }).out; }; }); @@ -240,7 +488,7 @@ in dependencies = { atty = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".atty."0.2.14" { inherit profileName; }).out; humantime = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".humantime."1.3.0" { inherit profileName; }).out; - log = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.8" { inherit profileName; }).out; + log = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; }).out; regex = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".regex."1.3.7" { inherit profileName; }).out; termcolor = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".termcolor."1.1.0" { inherit profileName; }).out; }; @@ -256,6 +504,48 @@ in }; }); + "registry+https://github.com/rust-lang/crates.io-index".errno."0.3.0" = overridableMkRustCrate (profileName: rec { + name = "errno"; + version = "0.3.0"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "50d6a0976c999d473fe89ad888d5a284e55366d9dc9038b1ba2aa15128c4afa0"; }; + dependencies = { + ${ if hostPlatform.parsed.kernel.name == "dragonfly" then "errno_dragonfly" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".errno-dragonfly."0.1.2" { inherit profileName; }).out; + ${ if hostPlatform.isUnix || hostPlatform.parsed.kernel.name == "hermit" || hostPlatform.parsed.kernel.name == "wasi" then "libc" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.141" { inherit profileName; }).out; + ${ if hostPlatform.isWindows then "windows_sys" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows-sys."0.45.0" { inherit profileName; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".errno-dragonfly."0.1.2" = overridableMkRustCrate (profileName: rec { + name = "errno-dragonfly"; + version = "0.1.2"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"; }; + dependencies = { + libc = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.141" { inherit profileName; }).out; + }; + buildDependencies = { + cc = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".cc."1.0.72" { profileName = "__noProfile"; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".event-listener."2.5.3" = overridableMkRustCrate (profileName: rec { + name = "event-listener"; + version = "2.5.3"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"; }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".fastrand."1.9.0" = overridableMkRustCrate (profileName: rec { + name = "fastrand"; + version = "1.9.0"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be"; }; + dependencies = { + ${ if hostPlatform.parsed.cpu.name == "wasm32" && !(hostPlatform.parsed.kernel.name == "wasi") then "instant" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".instant."0.1.12" { inherit profileName; }).out; + }; + }); + "registry+https://github.com/rust-lang/crates.io-index".fnv."1.0.6" = overridableMkRustCrate (profileName: rec { name = "fnv"; version = "1.0.6"; @@ -274,11 +564,11 @@ in }; }); - "registry+https://github.com/rust-lang/crates.io-index".futures."0.3.5" = overridableMkRustCrate (profileName: rec { + "registry+https://github.com/rust-lang/crates.io-index".futures."0.3.28" = overridableMkRustCrate (profileName: rec { name = "futures"; - version = "0.3.5"; + version = "0.3.28"; registry = "registry+https://github.com/rust-lang/crates.io-index"; - src = fetchCratesIo { inherit name version; sha256 = "1e05b85ec287aac0dc34db7d4a569323df697f9c55b99b15d6b4ef8cde49f613"; }; + src = fetchCratesIo { inherit name version; sha256 = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40"; }; features = builtins.concatLists [ [ "alloc" ] [ "async-await" ] @@ -288,21 +578,21 @@ in [ "std" ] ]; dependencies = { - futures_channel = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-channel."0.3.5" { inherit profileName; }).out; - futures_core = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.5" { inherit profileName; }).out; - futures_executor = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-executor."0.3.5" { inherit profileName; }).out; - futures_io = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-io."0.3.5" { inherit profileName; }).out; - futures_sink = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-sink."0.3.5" { inherit profileName; }).out; - futures_task = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-task."0.3.5" { inherit profileName; }).out; - futures_util = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.5" { inherit profileName; }).out; + futures_channel = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-channel."0.3.28" { inherit profileName; }).out; + futures_core = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.28" { inherit profileName; }).out; + futures_executor = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-executor."0.3.28" { inherit profileName; }).out; + futures_io = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-io."0.3.28" { inherit profileName; }).out; + futures_sink = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-sink."0.3.28" { inherit profileName; }).out; + futures_task = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-task."0.3.28" { inherit profileName; }).out; + futures_util = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.28" { inherit profileName; }).out; }; }); - "registry+https://github.com/rust-lang/crates.io-index".futures-channel."0.3.5" = overridableMkRustCrate (profileName: rec { + "registry+https://github.com/rust-lang/crates.io-index".futures-channel."0.3.28" = overridableMkRustCrate (profileName: rec { name = "futures-channel"; - version = "0.3.5"; + version = "0.3.28"; registry = "registry+https://github.com/rust-lang/crates.io-index"; - src = fetchCratesIo { inherit name version; sha256 = "f366ad74c28cca6ba456d95e6422883cfb4b252a83bed929c83abfdbbf2967d5"; }; + src = fetchCratesIo { inherit name version; sha256 = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2"; }; features = builtins.concatLists [ [ "alloc" ] [ "default" ] @@ -311,16 +601,16 @@ in [ "std" ] ]; dependencies = { - futures_core = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.5" { inherit profileName; }).out; - futures_sink = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-sink."0.3.5" { inherit profileName; }).out; + futures_core = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.28" { inherit profileName; }).out; + futures_sink = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-sink."0.3.28" { inherit profileName; }).out; }; }); - "registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.5" = overridableMkRustCrate (profileName: rec { + "registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.28" = overridableMkRustCrate (profileName: rec { name = "futures-core"; - version = "0.3.5"; + version = "0.3.28"; registry = "registry+https://github.com/rust-lang/crates.io-index"; - src = fetchCratesIo { inherit name version; sha256 = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399"; }; + src = fetchCratesIo { inherit name version; sha256 = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c"; }; features = builtins.concatLists [ [ "alloc" ] [ "default" ] @@ -328,49 +618,75 @@ in ]; }); - "registry+https://github.com/rust-lang/crates.io-index".futures-executor."0.3.5" = overridableMkRustCrate (profileName: rec { + "registry+https://github.com/rust-lang/crates.io-index".futures-executor."0.3.28" = overridableMkRustCrate (profileName: rec { name = "futures-executor"; - version = "0.3.5"; + version = "0.3.28"; registry = "registry+https://github.com/rust-lang/crates.io-index"; - src = fetchCratesIo { inherit name version; sha256 = "10d6bb888be1153d3abeb9006b11b02cf5e9b209fda28693c31ae1e4e012e314"; }; + src = fetchCratesIo { inherit name version; sha256 = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0"; }; features = builtins.concatLists [ [ "std" ] ]; dependencies = { - futures_core = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.5" { inherit profileName; }).out; - futures_task = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-task."0.3.5" { inherit profileName; }).out; - futures_util = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.5" { inherit profileName; }).out; + futures_core = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.28" { inherit profileName; }).out; + futures_task = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-task."0.3.28" { inherit profileName; }).out; + futures_util = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.28" { inherit profileName; }).out; }; }); - "registry+https://github.com/rust-lang/crates.io-index".futures-io."0.3.5" = overridableMkRustCrate (profileName: rec { + "registry+https://github.com/rust-lang/crates.io-index".futures-io."0.3.28" = overridableMkRustCrate (profileName: rec { name = "futures-io"; - version = "0.3.5"; + version = "0.3.28"; registry = "registry+https://github.com/rust-lang/crates.io-index"; - src = fetchCratesIo { inherit name version; sha256 = "de27142b013a8e869c14957e6d2edeef89e97c289e69d042ee3a49acd8b51789"; }; + src = fetchCratesIo { inherit name version; sha256 = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964"; }; features = builtins.concatLists [ + [ "default" ] [ "std" ] ]; }); - "registry+https://github.com/rust-lang/crates.io-index".futures-macro."0.3.5" = overridableMkRustCrate (profileName: rec { - name = "futures-macro"; - version = "0.3.5"; + "registry+https://github.com/rust-lang/crates.io-index".futures-lite."1.12.0" = overridableMkRustCrate (profileName: rec { + name = "futures-lite"; + version = "1.12.0"; registry = "registry+https://github.com/rust-lang/crates.io-index"; - src = fetchCratesIo { inherit name version; sha256 = "d0b5a30a4328ab5473878237c447333c093297bded83a4983d10f4deea240d39"; }; + src = fetchCratesIo { inherit name version; sha256 = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48"; }; + features = builtins.concatLists [ + [ "alloc" ] + [ "default" ] + [ "fastrand" ] + [ "futures-io" ] + [ "memchr" ] + [ "parking" ] + [ "std" ] + [ "waker-fn" ] + ]; dependencies = { - proc_macro_hack = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro-hack."0.5.11" { profileName = "__noProfile"; }).out; - proc_macro2 = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.34" { inherit profileName; }).out; - quote = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.2" { inherit profileName; }).out; - syn = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.83" { inherit profileName; }).out; + fastrand = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".fastrand."1.9.0" { inherit profileName; }).out; + futures_core = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.28" { inherit profileName; }).out; + futures_io = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-io."0.3.28" { inherit profileName; }).out; + memchr = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".memchr."2.5.0" { inherit profileName; }).out; + parking = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".parking."2.0.0" { inherit profileName; }).out; + pin_project_lite = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.7" { inherit profileName; }).out; + waker_fn = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".waker-fn."1.1.0" { inherit profileName; }).out; }; }); - "registry+https://github.com/rust-lang/crates.io-index".futures-sink."0.3.5" = overridableMkRustCrate (profileName: rec { - name = "futures-sink"; - version = "0.3.5"; + "registry+https://github.com/rust-lang/crates.io-index".futures-macro."0.3.28" = overridableMkRustCrate (profileName: rec { + name = "futures-macro"; + version = "0.3.28"; registry = "registry+https://github.com/rust-lang/crates.io-index"; - src = fetchCratesIo { inherit name version; sha256 = "3f2032893cb734c7a05d85ce0cc8b8c4075278e93b24b66f9de99d6eb0fa8acc"; }; + src = fetchCratesIo { inherit name version; sha256 = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"; }; + dependencies = { + proc_macro2 = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.56" { inherit profileName; }).out; + quote = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.26" { inherit profileName; }).out; + syn = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."2.0.13" { inherit profileName; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".futures-sink."0.3.28" = overridableMkRustCrate (profileName: rec { + name = "futures-sink"; + version = "0.3.28"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e"; }; features = builtins.concatLists [ [ "alloc" ] [ "default" ] @@ -378,26 +694,22 @@ in ]; }); - "registry+https://github.com/rust-lang/crates.io-index".futures-task."0.3.5" = overridableMkRustCrate (profileName: rec { + "registry+https://github.com/rust-lang/crates.io-index".futures-task."0.3.28" = overridableMkRustCrate (profileName: rec { name = "futures-task"; - version = "0.3.5"; + version = "0.3.28"; registry = "registry+https://github.com/rust-lang/crates.io-index"; - src = fetchCratesIo { inherit name version; sha256 = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626"; }; + src = fetchCratesIo { inherit name version; sha256 = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65"; }; features = builtins.concatLists [ [ "alloc" ] - [ "once_cell" ] [ "std" ] ]; - dependencies = { - once_cell = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".once_cell."1.9.0" { inherit profileName; }).out; - }; }); - "registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.5" = overridableMkRustCrate (profileName: rec { + "registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.28" = overridableMkRustCrate (profileName: rec { name = "futures-util"; - version = "0.3.5"; + version = "0.3.28"; registry = "registry+https://github.com/rust-lang/crates.io-index"; - src = fetchCratesIo { inherit name version; sha256 = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6"; }; + src = fetchCratesIo { inherit name version; sha256 = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533"; }; features = builtins.concatLists [ [ "alloc" ] [ "async-await" ] @@ -409,24 +721,20 @@ in [ "futures-sink" ] [ "io" ] [ "memchr" ] - [ "proc-macro-hack" ] - [ "proc-macro-nested" ] [ "sink" ] [ "slab" ] [ "std" ] ]; dependencies = { - futures_channel = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-channel."0.3.5" { inherit profileName; }).out; - futures_core = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.5" { inherit profileName; }).out; - futures_io = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-io."0.3.5" { inherit profileName; }).out; - futures_macro = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-macro."0.3.5" { profileName = "__noProfile"; }).out; - futures_sink = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-sink."0.3.5" { inherit profileName; }).out; - futures_task = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-task."0.3.5" { inherit profileName; }).out; - memchr = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".memchr."2.3.0" { inherit profileName; }).out; - pin_project = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project."0.4.8" { inherit profileName; }).out; + futures_channel = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-channel."0.3.28" { inherit profileName; }).out; + futures_core = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.28" { inherit profileName; }).out; + futures_io = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-io."0.3.28" { inherit profileName; }).out; + futures_macro = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-macro."0.3.28" { profileName = "__noProfile"; }).out; + futures_sink = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-sink."0.3.28" { inherit profileName; }).out; + futures_task = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-task."0.3.28" { inherit profileName; }).out; + memchr = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".memchr."2.5.0" { inherit profileName; }).out; + pin_project_lite = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.7" { inherit profileName; }).out; pin_utils = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-utils."0.1.0" { inherit profileName; }).out; - proc_macro_hack = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro-hack."0.5.11" { profileName = "__noProfile"; }).out; - proc_macro_nested = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro-nested."0.1.3" { inherit profileName; }).out; slab = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".slab."0.4.2" { inherit profileName; }).out; }; }); @@ -446,7 +754,7 @@ in dependencies = { c_linked_list = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".c_linked_list."1.1.1" { inherit profileName; }).out; ${ if hostPlatform.parsed.kernel.name == "android" then "get_if_addrs_sys" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".get_if_addrs-sys."0.1.1" { inherit profileName; }).out; - libc = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.112" { inherit profileName; }).out; + libc = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.141" { inherit profileName; }).out; ${ if hostPlatform.parsed.kernel.name == "windows" then "winapi" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.2.8" { inherit profileName; }).out; }; }); @@ -457,7 +765,7 @@ in registry = "registry+https://github.com/rust-lang/crates.io-index"; src = fetchCratesIo { inherit name version; sha256 = "0d04f9fb746cf36b191c00f3ede8bde9c8e64f9f4b05ae2694a9ccf5e3f5ab48"; }; dependencies = { - libc = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.112" { inherit profileName; }).out; + libc = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.141" { inherit profileName; }).out; }; buildDependencies = { gcc = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".gcc."0.3.55" { profileName = "__noProfile"; }).out; @@ -474,11 +782,37 @@ in ]; dependencies = { cfg_if = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; }).out; - ${ if hostPlatform.isUnix then "libc" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.112" { inherit profileName; }).out; + ${ if hostPlatform.isUnix then "libc" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.141" { inherit profileName; }).out; ${ if hostPlatform.parsed.kernel.name == "wasi" then "wasi" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".wasi."0.10.2+wasi-snapshot-preview1" { inherit profileName; }).out; }; }); + "registry+https://github.com/rust-lang/crates.io-index".glob."0.2.11" = overridableMkRustCrate (profileName: rec { + name = "glob"; + version = "0.2.11"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"; }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".gloo-timers."0.2.6" = overridableMkRustCrate (profileName: rec { + name = "gloo-timers"; + version = "0.2.6"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c"; }; + features = builtins.concatLists [ + [ "default" ] + [ "futures" ] + [ "futures-channel" ] + [ "futures-core" ] + ]; + dependencies = { + futures_channel = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-channel."0.3.28" { inherit profileName; }).out; + futures_core = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.28" { inherit profileName; }).out; + js_sys = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".js-sys."0.3.55" { inherit profileName; }).out; + wasm_bindgen = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".wasm-bindgen."0.2.78" { inherit profileName; }).out; + }; + }); + "registry+https://github.com/rust-lang/crates.io-index".h2."0.3.9" = overridableMkRustCrate (profileName: rec { name = "h2"; version = "0.3.9"; @@ -487,9 +821,9 @@ in dependencies = { bytes = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.1.0" { inherit profileName; }).out; fnv = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".fnv."1.0.6" { inherit profileName; }).out; - futures_core = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.5" { inherit profileName; }).out; - futures_sink = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-sink."0.3.5" { inherit profileName; }).out; - futures_util = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.5" { inherit profileName; }).out; + futures_core = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.28" { inherit profileName; }).out; + futures_sink = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-sink."0.3.28" { inherit profileName; }).out; + futures_util = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.28" { inherit profileName; }).out; http = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.0" { inherit profileName; }).out; indexmap = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".indexmap."1.7.0" { inherit profileName; }).out; slab = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".slab."0.4.2" { inherit profileName; }).out; @@ -518,10 +852,20 @@ in [ "default" ] ]; dependencies = { - libc = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.112" { inherit profileName; }).out; + libc = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.141" { inherit profileName; }).out; }; }); + "registry+https://github.com/rust-lang/crates.io-index".hermit-abi."0.3.1" = overridableMkRustCrate (profileName: rec { + name = "hermit-abi"; + version = "0.3.1"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"; }; + features = builtins.concatLists [ + [ "default" ] + ]; + }); + "registry+https://github.com/rust-lang/crates.io-index".http."0.2.0" = overridableMkRustCrate (profileName: rec { name = "http"; version = "0.2.0"; @@ -590,9 +934,9 @@ in ]; dependencies = { bytes = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.1.0" { inherit profileName; }).out; - futures_channel = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-channel."0.3.5" { inherit profileName; }).out; - futures_core = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.5" { inherit profileName; }).out; - futures_util = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.5" { inherit profileName; }).out; + futures_channel = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-channel."0.3.28" { inherit profileName; }).out; + futures_core = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.28" { inherit profileName; }).out; + futures_util = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.28" { inherit profileName; }).out; h2 = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".h2."0.3.9" { inherit profileName; }).out; http = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.0" { inherit profileName; }).out; http_body = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".http-body."0.4.4" { inherit profileName; }).out; @@ -651,10 +995,10 @@ in dependencies = { attohttpc = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".attohttpc."0.16.3" { inherit profileName; }).out; bytes = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.1.0" { inherit profileName; }).out; - futures = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures."0.3.5" { inherit profileName; }).out; + futures = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures."0.3.28" { inherit profileName; }).out; http = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.0" { inherit profileName; }).out; hyper = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".hyper."0.14.4" { inherit profileName; }).out; - log = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.8" { inherit profileName; }).out; + log = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; }).out; rand = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand."0.8.4" { inherit profileName; }).out; tokio = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.15.0" { inherit profileName; }).out; url = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".url."2.2.2" { inherit profileName; }).out; @@ -678,6 +1022,34 @@ in }; }); + "registry+https://github.com/rust-lang/crates.io-index".instant."0.1.12" = overridableMkRustCrate (profileName: rec { + name = "instant"; + version = "0.1.12"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"; }; + dependencies = { + cfg_if = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".io-lifetimes."1.0.9" = overridableMkRustCrate (profileName: rec { + name = "io-lifetimes"; + version = "1.0.9"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "09270fd4fa1111bc614ed2246c7ef56239a3063d5be0d1ec3b589c505d400aeb"; }; + features = builtins.concatLists [ + [ "close" ] + [ "hermit-abi" ] + [ "libc" ] + [ "windows-sys" ] + ]; + dependencies = { + ${ if hostPlatform.parsed.kernel.name == "hermit" then "hermit_abi" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".hermit-abi."0.3.1" { inherit profileName; }).out; + ${ if !hostPlatform.isWindows then "libc" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.141" { inherit profileName; }).out; + ${ if hostPlatform.isWindows then "windows_sys" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows-sys."0.45.0" { inherit profileName; }).out; + }; + }); + "registry+https://github.com/rust-lang/crates.io-index".ipnet."2.3.1" = overridableMkRustCrate (profileName: rec { name = "ipnet"; version = "2.3.1"; @@ -685,6 +1057,20 @@ in src = fetchCratesIo { inherit name version; sha256 = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9"; }; }); + "registry+https://github.com/rust-lang/crates.io-index".ipnetwork."0.17.0" = overridableMkRustCrate (profileName: rec { + name = "ipnetwork"; + version = "0.17.0"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "02c3eaab3ac0ede60ffa41add21970a7df7d91772c03383aac6c2c3d53cc716b"; }; + features = builtins.concatLists [ + [ "default" ] + [ "serde" ] + ]; + dependencies = { + serde = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.107" { inherit profileName; }).out; + }; + }); + "registry+https://github.com/rust-lang/crates.io-index".iptables."0.2.2" = overridableMkRustCrate (profileName: rec { name = "iptables"; version = "0.2.2"; @@ -718,6 +1104,29 @@ in }; }); + "registry+https://github.com/rust-lang/crates.io-index".kernel32-sys."0.2.2" = overridableMkRustCrate (profileName: rec { + name = "kernel32-sys"; + version = "0.2.2"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"; }; + dependencies = { + winapi = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.2.8" { inherit profileName; }).out; + }; + buildDependencies = { + build = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi-build."0.1.1" { profileName = "__noProfile"; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".kv-log-macro."1.0.7" = overridableMkRustCrate (profileName: rec { + name = "kv-log-macro"; + version = "1.0.7"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f"; }; + dependencies = { + log = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; }).out; + }; + }); + "registry+https://github.com/rust-lang/crates.io-index".lazy_static."0.2.11" = overridableMkRustCrate (profileName: rec { name = "lazy_static"; version = "0.2.11"; @@ -756,33 +1165,64 @@ in src = fetchCratesIo { inherit name version; sha256 = "cd627fb38e19c00d8d068618259205f7a91c91aeade5c15bc35dbca037bb1c35"; }; dependencies = { proc_macro_hack = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro-hack."0.5.11" { profileName = "__noProfile"; }).out; - proc_macro2 = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.34" { inherit profileName; }).out; - quote = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.2" { inherit profileName; }).out; + proc_macro2 = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.56" { inherit profileName; }).out; + quote = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.26" { inherit profileName; }).out; }; }); - "registry+https://github.com/rust-lang/crates.io-index".libc."0.2.112" = overridableMkRustCrate (profileName: rec { + "registry+https://github.com/rust-lang/crates.io-index".libc."0.2.141" = overridableMkRustCrate (profileName: rec { name = "libc"; - version = "0.2.112"; + version = "0.2.141"; registry = "registry+https://github.com/rust-lang/crates.io-index"; - src = fetchCratesIo { inherit name version; sha256 = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125"; }; + src = fetchCratesIo { inherit name version; sha256 = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5"; }; features = builtins.concatLists [ [ "align" ] [ "default" ] + [ "extra_traits" ] [ "std" ] ]; }); - "registry+https://github.com/rust-lang/crates.io-index".log."0.4.8" = overridableMkRustCrate (profileName: rec { - name = "log"; - version = "0.4.8"; + "registry+https://github.com/rust-lang/crates.io-index".linux-raw-sys."0.3.1" = overridableMkRustCrate (profileName: rec { + name = "linux-raw-sys"; + version = "0.3.1"; registry = "registry+https://github.com/rust-lang/crates.io-index"; - src = fetchCratesIo { inherit name version; sha256 = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"; }; + src = fetchCratesIo { inherit name version; sha256 = "d59d8c75012853d2e872fb56bc8a2e53718e2cafe1a4c823143141c6d90c322f"; }; features = builtins.concatLists [ - [ "std" ] + [ "errno" ] + [ "general" ] + [ "ioctl" ] + [ "no_std" ] + ]; + }); + + "registry+https://github.com/rust-lang/crates.io-index".log."0.3.9" = overridableMkRustCrate (profileName: rec { + name = "log"; + version = "0.3.9"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"; }; + features = builtins.concatLists [ + [ "default" ] + [ "use_std" ] ]; dependencies = { - cfg_if = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."0.1.10" { inherit profileName; }).out; + log = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" = overridableMkRustCrate (profileName: rec { + name = "log"; + version = "0.4.17"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"; }; + features = builtins.concatLists [ + [ "kv_unstable" ] + [ "std" ] + [ "value-bag" ] + ]; + dependencies = { + cfg_if = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; }).out; + value_bag = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".value-bag."1.0.0-alpha.9" { inherit profileName; }).out; }; }); @@ -793,11 +1233,11 @@ in src = fetchCratesIo { inherit name version; sha256 = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"; }; }); - "registry+https://github.com/rust-lang/crates.io-index".memchr."2.3.0" = overridableMkRustCrate (profileName: rec { + "registry+https://github.com/rust-lang/crates.io-index".memchr."2.5.0" = overridableMkRustCrate (profileName: rec { name = "memchr"; - version = "2.3.0"; + version = "2.5.0"; registry = "registry+https://github.com/rust-lang/crates.io-index"; - src = fetchCratesIo { inherit name version; sha256 = "3197e20c7edb283f87c071ddfc7a2cca8f8e0b888c242959846a6fce03c72223"; }; + src = fetchCratesIo { inherit name version; sha256 = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"; }; features = builtins.concatLists [ [ "default" ] [ "std" ] @@ -828,11 +1268,11 @@ in [ "uds" ] ]; dependencies = { - ${ if hostPlatform.isUnix then "libc" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.112" { inherit profileName; }).out; - log = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.8" { inherit profileName; }).out; + ${ if hostPlatform.isUnix then "libc" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.141" { inherit profileName; }).out; + log = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; }).out; ${ if hostPlatform.isWindows then "miow" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".miow."0.3.7" { inherit profileName; }).out; ${ if hostPlatform.isWindows then "ntapi" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".ntapi."0.3.4" { inherit profileName; }).out; - ${ if hostPlatform.isWindows then "winapi" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.8" { inherit profileName; }).out; + ${ if hostPlatform.isWindows then "winapi" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.9" { inherit profileName; }).out; }; }); @@ -842,7 +1282,7 @@ in registry = "registry+https://github.com/rust-lang/crates.io-index"; src = fetchCratesIo { inherit name version; sha256 = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21"; }; dependencies = { - winapi = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.8" { inherit profileName; }).out; + winapi = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.9" { inherit profileName; }).out; }; }); @@ -854,7 +1294,7 @@ in dependencies = { bitflags = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".bitflags."0.4.0" { inherit profileName; }).out; cfg_if = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."0.1.10" { inherit profileName; }).out; - libc = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.112" { inherit profileName; }).out; + libc = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.141" { inherit profileName; }).out; void = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".void."1.0.2" { inherit profileName; }).out; }; buildDependencies = { @@ -873,7 +1313,7 @@ in [ "user" ] ]; dependencies = { - winapi = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.8" { inherit profileName; }).out; + winapi = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.9" { inherit profileName; }).out; }; }); @@ -884,7 +1324,7 @@ in src = fetchCratesIo { inherit name version; sha256 = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1"; }; dependencies = { ${ if (hostPlatform.parsed.cpu.name == "x86_64" || hostPlatform.parsed.cpu.name == "aarch64") && hostPlatform.parsed.kernel.name == "hermit" then "hermit_abi" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".hermit-abi."0.1.12" { inherit profileName; }).out; - ${ if !hostPlatform.isWindows then "libc" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.112" { inherit profileName; }).out; + ${ if !hostPlatform.isWindows then "libc" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.141" { inherit profileName; }).out; }; }); @@ -895,11 +1335,19 @@ in src = fetchCratesIo { inherit name version; sha256 = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5"; }; features = builtins.concatLists [ [ "alloc" ] + [ "default" ] [ "race" ] [ "std" ] ]; }); + "registry+https://github.com/rust-lang/crates.io-index".parking."2.0.0" = overridableMkRustCrate (profileName: rec { + name = "parking"; + version = "2.0.0"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72"; }; + }); + "registry+https://github.com/rust-lang/crates.io-index".percent-encoding."2.1.0" = overridableMkRustCrate (profileName: rec { name = "percent-encoding"; version = "2.1.0"; @@ -907,16 +1355,6 @@ in src = fetchCratesIo { inherit name version; sha256 = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"; }; }); - "registry+https://github.com/rust-lang/crates.io-index".pin-project."0.4.8" = overridableMkRustCrate (profileName: rec { - name = "pin-project"; - version = "0.4.8"; - registry = "registry+https://github.com/rust-lang/crates.io-index"; - src = fetchCratesIo { inherit name version; sha256 = "7804a463a8d9572f13453c516a5faea534a2403d7ced2f0c7e100eeff072772c"; }; - dependencies = { - pin_project_internal = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-internal."0.4.8" { profileName = "__noProfile"; }).out; - }; - }); - "registry+https://github.com/rust-lang/crates.io-index".pin-project."1.0.8" = overridableMkRustCrate (profileName: rec { name = "pin-project"; version = "1.0.8"; @@ -927,27 +1365,15 @@ in }; }); - "registry+https://github.com/rust-lang/crates.io-index".pin-project-internal."0.4.8" = overridableMkRustCrate (profileName: rec { - name = "pin-project-internal"; - version = "0.4.8"; - registry = "registry+https://github.com/rust-lang/crates.io-index"; - src = fetchCratesIo { inherit name version; sha256 = "385322a45f2ecf3410c68d2a549a4a2685e8051d0f278e39743ff4e451cb9b3f"; }; - dependencies = { - proc_macro2 = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.34" { inherit profileName; }).out; - quote = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.2" { inherit profileName; }).out; - syn = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.83" { inherit profileName; }).out; - }; - }); - "registry+https://github.com/rust-lang/crates.io-index".pin-project-internal."1.0.8" = overridableMkRustCrate (profileName: rec { name = "pin-project-internal"; version = "1.0.8"; registry = "registry+https://github.com/rust-lang/crates.io-index"; src = fetchCratesIo { inherit name version; sha256 = "6e8fe8163d14ce7f0cdac2e040116f22eac817edabff0be91e8aff7e9accf389"; }; dependencies = { - proc_macro2 = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.34" { inherit profileName; }).out; - quote = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.2" { inherit profileName; }).out; - syn = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.83" { inherit profileName; }).out; + proc_macro2 = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.56" { inherit profileName; }).out; + quote = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.26" { inherit profileName; }).out; + syn = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.109" { inherit profileName; }).out; }; }); @@ -965,6 +1391,128 @@ in src = fetchCratesIo { inherit name version; sha256 = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"; }; }); + "registry+https://github.com/rust-lang/crates.io-index".pnet."0.27.2" = overridableMkRustCrate (profileName: rec { + name = "pnet"; + version = "0.27.2"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "b657d5b9a98a2c81b82549922b8b15984e49f8120cd130b11a09f81b9b55d633"; }; + dependencies = { + ipnetwork = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".ipnetwork."0.17.0" { inherit profileName; }).out; + pnet_base = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".pnet_base."0.27.2" { inherit profileName; }).out; + pnet_datalink = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".pnet_datalink."0.27.2" { inherit profileName; }).out; + pnet_packet = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".pnet_packet."0.27.2" { inherit profileName; }).out; + pnet_sys = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".pnet_sys."0.27.2" { inherit profileName; }).out; + pnet_transport = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".pnet_transport."0.27.2" { inherit profileName; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".pnet_base."0.27.2" = overridableMkRustCrate (profileName: rec { + name = "pnet_base"; + version = "0.27.2"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "4e4688aa497ef62129f302a5800ebde67825f8ff129f43690ca84099f6620bed"; }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".pnet_datalink."0.27.2" = overridableMkRustCrate (profileName: rec { + name = "pnet_datalink"; + version = "0.27.2"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "59001c9c4d9d23bf2f61afaaf134a766fd6932ba2557c606b9112157053b9ac7"; }; + dependencies = { + ipnetwork = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".ipnetwork."0.17.0" { inherit profileName; }).out; + libc = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.141" { inherit profileName; }).out; + pnet_base = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".pnet_base."0.27.2" { inherit profileName; }).out; + pnet_sys = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".pnet_sys."0.27.2" { inherit profileName; }).out; + ${ if hostPlatform.isWindows then "winapi" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.9" { inherit profileName; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".pnet_macros."0.27.2" = overridableMkRustCrate (profileName: rec { + name = "pnet_macros"; + version = "0.27.2"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "d894a90dbdbe976e624453fc31b1912f658083778329442dda1cca94f76a3e76"; }; + features = builtins.concatLists [ + [ "default" ] + ]; + dependencies = { + regex = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".regex."1.3.7" { inherit profileName; }).out; + syntex = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".syntex."0.42.2" { inherit profileName; }).out; + syntex_syntax = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".syntex_syntax."0.42.0" { inherit profileName; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".pnet_macros_support."0.27.2" = overridableMkRustCrate (profileName: rec { + name = "pnet_macros_support"; + version = "0.27.2"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "4b99269a458570bc06a9132254349f6543d9abc92e88b68d8de934aac9481f6c"; }; + dependencies = { + pnet_base = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".pnet_base."0.27.2" { inherit profileName; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".pnet_packet."0.27.2" = overridableMkRustCrate (profileName: rec { + name = "pnet_packet"; + version = "0.27.2"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "33f8238f4eb897a55ca06510cd71afb5b5ca7b4ff2d7188f1ca855fc1710133e"; }; + dependencies = { + pnet_base = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".pnet_base."0.27.2" { inherit profileName; }).out; + pnet_macros_support = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".pnet_macros_support."0.27.2" { inherit profileName; }).out; + }; + buildDependencies = { + glob = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".glob."0.2.11" { profileName = "__noProfile"; }).out; + pnet_macros = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".pnet_macros."0.27.2" { profileName = "__noProfile"; }).out; + syntex = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".syntex."0.42.2" { profileName = "__noProfile"; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".pnet_sys."0.27.2" = overridableMkRustCrate (profileName: rec { + name = "pnet_sys"; + version = "0.27.2"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "7589e4c4e7ed72a3ffdff8a65d3bea84e8c3a23e19d0a10e8f45efdf632fff15"; }; + dependencies = { + libc = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.141" { inherit profileName; }).out; + ${ if hostPlatform.isWindows then "winapi" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.9" { inherit profileName; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".pnet_transport."0.27.2" = overridableMkRustCrate (profileName: rec { + name = "pnet_transport"; + version = "0.27.2"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "326abdfd2e70e8e943bd58087b59686de170cac050a3b19c9fcc84db01690af5"; }; + dependencies = { + libc = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.141" { inherit profileName; }).out; + pnet_base = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".pnet_base."0.27.2" { inherit profileName; }).out; + pnet_packet = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".pnet_packet."0.27.2" { inherit profileName; }).out; + pnet_sys = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".pnet_sys."0.27.2" { inherit profileName; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".polling."2.5.2" = overridableMkRustCrate (profileName: rec { + name = "polling"; + version = "2.5.2"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "22122d5ec4f9fe1b3916419b76be1e80bcb93f618d071d2edf841b137b2a2bd6"; }; + features = builtins.concatLists [ + [ "default" ] + [ "std" ] + ]; + dependencies = { + cfg_if = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; }).out; + ${ if hostPlatform.isUnix || hostPlatform.parsed.kernel.name == "fuchsia" || hostPlatform.parsed.kernel.name == "vxworks" then "libc" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.141" { inherit profileName; }).out; + log = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; }).out; + ${ if hostPlatform.isWindows then "wepoll_ffi" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".wepoll-ffi."0.1.2" { inherit profileName; }).out; + ${ if hostPlatform.isWindows then "windows_sys" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows-sys."0.42.0" { inherit profileName; }).out; + }; + buildDependencies = { + autocfg = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".autocfg."1.0.0" { profileName = "__noProfile"; }).out; + }; + }); + "registry+https://github.com/rust-lang/crates.io-index".ppv-lite86."0.2.15" = overridableMkRustCrate (profileName: rec { name = "ppv-lite86"; version = "0.2.15"; @@ -983,7 +1531,7 @@ in src = fetchCratesIo { inherit name version; sha256 = "926d36b9553851b8b0005f1275891b392ee4d2d833852c417ed025477350fb9d"; }; dependencies = { env_logger = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".env_logger."0.7.1" { inherit profileName; }).out; - log = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.8" { inherit profileName; }).out; + log = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; }).out; }; }); @@ -993,30 +1541,23 @@ in registry = "registry+https://github.com/rust-lang/crates.io-index"; src = fetchCratesIo { inherit name version; sha256 = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5"; }; dependencies = { - proc_macro2 = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.34" { inherit profileName; }).out; - quote = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.2" { inherit profileName; }).out; - syn = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.83" { inherit profileName; }).out; + proc_macro2 = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.56" { inherit profileName; }).out; + quote = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.26" { inherit profileName; }).out; + syn = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.109" { inherit profileName; }).out; }; }); - "registry+https://github.com/rust-lang/crates.io-index".proc-macro-nested."0.1.3" = overridableMkRustCrate (profileName: rec { - name = "proc-macro-nested"; - version = "0.1.3"; - registry = "registry+https://github.com/rust-lang/crates.io-index"; - src = fetchCratesIo { inherit name version; sha256 = "369a6ed065f249a159e06c45752c780bda2fb53c995718f9e484d08daa9eb42e"; }; - }); - - "registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.34" = overridableMkRustCrate (profileName: rec { + "registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.56" = overridableMkRustCrate (profileName: rec { name = "proc-macro2"; - version = "1.0.34"; + version = "1.0.56"; registry = "registry+https://github.com/rust-lang/crates.io-index"; - src = fetchCratesIo { inherit name version; sha256 = "2f84e92c0f7c9d58328b85a78557813e4bd845130db68d7184635344399423b1"; }; + src = fetchCratesIo { inherit name version; sha256 = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435"; }; features = builtins.concatLists [ [ "default" ] [ "proc-macro" ] ]; dependencies = { - unicode_xid = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".unicode-xid."0.2.0" { inherit profileName; }).out; + unicode_ident = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".unicode-ident."1.0.8" { inherit profileName; }).out; }; }); @@ -1027,17 +1568,17 @@ in src = fetchCratesIo { inherit name version; sha256 = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"; }; }); - "registry+https://github.com/rust-lang/crates.io-index".quote."1.0.2" = overridableMkRustCrate (profileName: rec { + "registry+https://github.com/rust-lang/crates.io-index".quote."1.0.26" = overridableMkRustCrate (profileName: rec { name = "quote"; - version = "1.0.2"; + version = "1.0.26"; registry = "registry+https://github.com/rust-lang/crates.io-index"; - src = fetchCratesIo { inherit name version; sha256 = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"; }; + src = fetchCratesIo { inherit name version; sha256 = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc"; }; features = builtins.concatLists [ [ "default" ] [ "proc-macro" ] ]; dependencies = { - proc_macro2 = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.34" { inherit profileName; }).out; + proc_macro2 = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.56" { inherit profileName; }).out; }; }); @@ -1057,7 +1598,7 @@ in [ "std_rng" ] ]; dependencies = { - ${ if hostPlatform.isUnix then "libc" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.112" { inherit profileName; }).out; + ${ if hostPlatform.isUnix then "libc" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.141" { inherit profileName; }).out; ${ if !(hostPlatform.parsed.kernel.name == "emscripten") then "rand_chacha" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand_chacha."0.3.1" { inherit profileName; }).out; rand_core = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand_core."0.6.3" { inherit profileName; }).out; ${ if hostPlatform.parsed.kernel.name == "emscripten" then "rand_hc" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand_hc."0.3.1" { inherit profileName; }).out; @@ -1113,7 +1654,7 @@ in ]; dependencies = { aho_corasick = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".aho-corasick."0.6.10" { inherit profileName; }).out; - memchr = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".memchr."2.3.0" { inherit profileName; }).out; + memchr = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".memchr."2.5.0" { inherit profileName; }).out; regex_syntax = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".regex-syntax."0.5.6" { inherit profileName; }).out; thread_local = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".thread_local."0.3.6" { inherit profileName; }).out; utf8_ranges = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".utf8-ranges."1.0.4" { inherit profileName; }).out; @@ -1147,7 +1688,7 @@ in ]; dependencies = { aho_corasick = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".aho-corasick."0.7.10" { inherit profileName; }).out; - memchr = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".memchr."2.3.0" { inherit profileName; }).out; + memchr = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".memchr."2.5.0" { inherit profileName; }).out; regex_syntax = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".regex-syntax."0.6.17" { inherit profileName; }).out; thread_local = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".thread_local."1.0.1" { inherit profileName; }).out; }; @@ -1201,8 +1742,8 @@ in ${ if !(hostPlatform.parsed.cpu.name == "wasm32") then "base64" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".base64."0.13.0" { inherit profileName; }).out; bytes = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.1.0" { inherit profileName; }).out; ${ if !(hostPlatform.parsed.cpu.name == "wasm32") then "encoding_rs" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".encoding_rs."0.8.22" { inherit profileName; }).out; - ${ if !(hostPlatform.parsed.cpu.name == "wasm32") then "futures_core" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.5" { inherit profileName; }).out; - ${ if !(hostPlatform.parsed.cpu.name == "wasm32") then "futures_util" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.5" { inherit profileName; }).out; + ${ if !(hostPlatform.parsed.cpu.name == "wasm32") then "futures_core" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.28" { inherit profileName; }).out; + ${ if !(hostPlatform.parsed.cpu.name == "wasm32") then "futures_util" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.28" { inherit profileName; }).out; http = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.0" { inherit profileName; }).out; ${ if !(hostPlatform.parsed.cpu.name == "wasm32") then "http_body" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".http-body."0.4.4" { inherit profileName; }).out; ${ if !(hostPlatform.parsed.cpu.name == "wasm32") then "hyper" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".hyper."0.14.4" { inherit profileName; }).out; @@ -1210,7 +1751,7 @@ in ${ if !(hostPlatform.parsed.cpu.name == "wasm32") then "ipnet" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".ipnet."2.3.1" { inherit profileName; }).out; ${ if hostPlatform.parsed.cpu.name == "wasm32" then "js_sys" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".js-sys."0.3.55" { inherit profileName; }).out; ${ if !(hostPlatform.parsed.cpu.name == "wasm32") then "lazy_static" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".lazy_static."1.4.0" { inherit profileName; }).out; - ${ if !(hostPlatform.parsed.cpu.name == "wasm32") then "log" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.8" { inherit profileName; }).out; + ${ if !(hostPlatform.parsed.cpu.name == "wasm32") then "log" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; }).out; ${ if !(hostPlatform.parsed.cpu.name == "wasm32") then "mime" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".mime."0.3.16" { inherit profileName; }).out; ${ if !(hostPlatform.parsed.cpu.name == "wasm32") then "percent_encoding" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".percent-encoding."2.1.0" { inherit profileName; }).out; ${ if !(hostPlatform.parsed.cpu.name == "wasm32") then "pin_project_lite" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.7" { inherit profileName; }).out; @@ -1241,18 +1782,25 @@ in [ "once_cell" ] ]; dependencies = { - ${ if hostPlatform.parsed.kernel.name == "android" || hostPlatform.parsed.kernel.name == "linux" then "libc" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.112" { inherit profileName; }).out; + ${ if hostPlatform.parsed.kernel.name == "android" || hostPlatform.parsed.kernel.name == "linux" then "libc" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.141" { inherit profileName; }).out; ${ if hostPlatform.parsed.kernel.name == "android" || hostPlatform.parsed.kernel.name == "linux" || hostPlatform.parsed.kernel.name == "dragonfly" || hostPlatform.parsed.kernel.name == "freebsd" || hostPlatform.parsed.kernel.name == "illumos" || hostPlatform.parsed.kernel.name == "netbsd" || hostPlatform.parsed.kernel.name == "openbsd" || hostPlatform.parsed.kernel.name == "solaris" then "once_cell" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".once_cell."1.9.0" { inherit profileName; }).out; ${ if hostPlatform.parsed.cpu.name == "i686" || hostPlatform.parsed.cpu.name == "x86_64" || (hostPlatform.parsed.cpu.name == "aarch64" || hostPlatform.parsed.cpu.name == "armv6l" || hostPlatform.parsed.cpu.name == "armv7l") && (hostPlatform.parsed.kernel.name == "android" || hostPlatform.parsed.kernel.name == "fuchsia" || hostPlatform.parsed.kernel.name == "linux") then "spin" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".spin."0.5.2" { inherit profileName; }).out; untrusted = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".untrusted."0.7.1" { inherit profileName; }).out; ${ if hostPlatform.parsed.cpu.name == "wasm32" && hostPlatform.parsed.vendor.name == "unknown" && hostPlatform.parsed.kernel.name == "unknown" && hostPlatform.parsed.abi.name == "" then "web_sys" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".web-sys."0.3.55" { inherit profileName; }).out; - ${ if hostPlatform.parsed.kernel.name == "windows" then "winapi" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.8" { inherit profileName; }).out; + ${ if hostPlatform.parsed.kernel.name == "windows" then "winapi" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.9" { inherit profileName; }).out; }; buildDependencies = { cc = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".cc."1.0.72" { profileName = "__noProfile"; }).out; }; }); + "registry+https://github.com/rust-lang/crates.io-index".rustc-serialize."0.3.24" = overridableMkRustCrate (profileName: rec { + name = "rustc-serialize"; + version = "0.3.24"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda"; }; + }); + "registry+https://github.com/rust-lang/crates.io-index".rustc_version."0.1.7" = overridableMkRustCrate (profileName: rec { name = "rustc_version"; version = "0.1.7"; @@ -1263,6 +1811,26 @@ in }; }); + "registry+https://github.com/rust-lang/crates.io-index".rustix."0.37.7" = overridableMkRustCrate (profileName: rec { + name = "rustix"; + version = "0.37.7"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "2aae838e49b3d63e9274e1c01833cc8139d3fec468c3b84688c628f44b1ae11d"; }; + features = builtins.concatLists [ + [ "fs" ] + [ "io-lifetimes" ] + [ "std" ] + ]; + dependencies = { + bitflags = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".bitflags."1.3.2" { inherit profileName; }).out; + ${ if !(hostPlatform.parsed.kernel.name == "linux" && (hostPlatform.parsed.cpu.name == "i686" || hostPlatform.parsed.cpu.name == "x86_64" && hostPlatform.parsed.cpu.bits == 64 || hostPlatform.parsed.cpu.significantByte == "littleEndian" && (hostPlatform.parsed.cpu.name == "armv6l" || hostPlatform.parsed.cpu.name == "armv7l" || hostPlatform.parsed.cpu.name == "aarch64" && hostPlatform.parsed.cpu.bits == 64 || hostPlatform.parsed.cpu.name == "powerpc64" || hostPlatform.parsed.cpu.name == "riscv64" || hostPlatform.parsed.cpu.name == "mips" || hostPlatform.parsed.cpu.name == "mips64"))) then "libc_errno" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".errno."0.3.0" { inherit profileName; }).out; + io_lifetimes = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".io-lifetimes."1.0.9" { inherit profileName; }).out; + ${ if !(hostPlatform.parsed.kernel.name == "linux" && (hostPlatform.parsed.cpu.name == "i686" || hostPlatform.parsed.cpu.name == "x86_64" && hostPlatform.parsed.cpu.bits == 64 || hostPlatform.parsed.cpu.significantByte == "littleEndian" && (hostPlatform.parsed.cpu.name == "armv6l" || hostPlatform.parsed.cpu.name == "armv7l" || hostPlatform.parsed.cpu.name == "aarch64" && hostPlatform.parsed.cpu.bits == 64 || hostPlatform.parsed.cpu.name == "powerpc64" || hostPlatform.parsed.cpu.name == "riscv64" || hostPlatform.parsed.cpu.name == "mips" || hostPlatform.parsed.cpu.name == "mips64"))) then "libc" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.141" { inherit profileName; }).out; + ${ if hostPlatform.parsed.kernel.name == "linux" && (hostPlatform.parsed.cpu.name == "i686" || hostPlatform.parsed.cpu.name == "x86_64" && hostPlatform.parsed.cpu.bits == 64 || hostPlatform.parsed.cpu.significantByte == "littleEndian" && (hostPlatform.parsed.cpu.name == "armv6l" || hostPlatform.parsed.cpu.name == "armv7l" || hostPlatform.parsed.cpu.name == "aarch64" && hostPlatform.parsed.cpu.bits == 64 || hostPlatform.parsed.cpu.name == "powerpc64" || hostPlatform.parsed.cpu.name == "riscv64" || hostPlatform.parsed.cpu.name == "mips" || hostPlatform.parsed.cpu.name == "mips64")) || (hostPlatform.parsed.kernel.name == "android" || hostPlatform.parsed.kernel.name == "linux") && !(hostPlatform.parsed.kernel.name == "linux" && (hostPlatform.parsed.cpu.name == "i686" || hostPlatform.parsed.cpu.name == "x86_64" && hostPlatform.parsed.cpu.bits == 64 || hostPlatform.parsed.cpu.significantByte == "littleEndian" && (hostPlatform.parsed.cpu.name == "armv6l" || hostPlatform.parsed.cpu.name == "armv7l" || hostPlatform.parsed.cpu.name == "aarch64" && hostPlatform.parsed.cpu.bits == 64 || hostPlatform.parsed.cpu.name == "powerpc64" || hostPlatform.parsed.cpu.name == "riscv64" || hostPlatform.parsed.cpu.name == "mips" || hostPlatform.parsed.cpu.name == "mips64"))) then "linux_raw_sys" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".linux-raw-sys."0.3.1" { inherit profileName; }).out; + ${ if hostPlatform.isWindows then "windows_sys" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows-sys."0.45.0" { inherit profileName; }).out; + }; + }); + "registry+https://github.com/rust-lang/crates.io-index".rustls."0.20.2" = overridableMkRustCrate (profileName: rec { name = "rustls"; version = "0.20.2"; @@ -1276,7 +1844,7 @@ in [ "tls12" ] ]; dependencies = { - log = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.8" { inherit profileName; }).out; + log = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; }).out; ring = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".ring."0.16.20" { inherit profileName; }).out; sct = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".sct."0.7.0" { inherit profileName; }).out; webpki = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".webpki."0.22.0" { inherit profileName; }).out; @@ -1354,9 +1922,9 @@ in [ "default" ] ]; dependencies = { - proc_macro2 = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.34" { inherit profileName; }).out; - quote = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.2" { inherit profileName; }).out; - syn = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.83" { inherit profileName; }).out; + proc_macro2 = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.56" { inherit profileName; }).out; + quote = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.26" { inherit profileName; }).out; + syn = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.109" { inherit profileName; }).out; }; }); @@ -1410,8 +1978,22 @@ in src = fetchCratesIo { inherit name version; sha256 = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e"; }; dependencies = { ${ if hostPlatform.isUnix then "cfg_if" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; }).out; - ${ if hostPlatform.isUnix then "libc" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.112" { inherit profileName; }).out; - ${ if hostPlatform.isWindows then "winapi" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.8" { inherit profileName; }).out; + ${ if hostPlatform.isUnix then "libc" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.141" { inherit profileName; }).out; + ${ if hostPlatform.isWindows then "winapi" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.9" { inherit profileName; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".socket2."0.4.9" = overridableMkRustCrate (profileName: rec { + name = "socket2"; + version = "0.4.9"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662"; }; + features = builtins.concatLists [ + [ "all" ] + ]; + dependencies = { + ${ if hostPlatform.isUnix then "libc" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.141" { inherit profileName; }).out; + ${ if hostPlatform.isWindows then "winapi" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.9" { inherit profileName; }).out; }; }); @@ -1422,11 +2004,26 @@ in src = fetchCratesIo { inherit name version; sha256 = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"; }; }); - "registry+https://github.com/rust-lang/crates.io-index".syn."1.0.83" = overridableMkRustCrate (profileName: rec { - name = "syn"; - version = "1.0.83"; + "registry+https://github.com/rust-lang/crates.io-index".stun-client."0.1.2" = overridableMkRustCrate (profileName: rec { + name = "stun-client"; + version = "0.1.2"; registry = "registry+https://github.com/rust-lang/crates.io-index"; - src = fetchCratesIo { inherit name version; sha256 = "23a1dfb999630e338648c83e91c59a4e9fb7620f520c3194b6b89e276f2f1959"; }; + src = fetchCratesIo { inherit name version; sha256 = "ee0dfeef11f3744dc4784dcfde4d8cc91248fd3021db9ff10157768798e39a8e"; }; + dependencies = { + async_macros = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".async-macros."2.0.0" { inherit profileName; }).out; + async_std = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".async-std."1.12.0" { inherit profileName; }).out; + futures = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures."0.3.28" { inherit profileName; }).out; + pnet = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".pnet."0.27.2" { inherit profileName; }).out; + rand = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand."0.8.4" { inherit profileName; }).out; + thiserror = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".thiserror."1.0.40" { inherit profileName; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".syn."1.0.109" = overridableMkRustCrate (profileName: rec { + name = "syn"; + version = "1.0.109"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"; }; features = builtins.concatLists [ [ "clone-impls" ] [ "default" ] @@ -1440,9 +2037,98 @@ in [ "visit-mut" ] ]; dependencies = { - proc_macro2 = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.34" { inherit profileName; }).out; - quote = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.2" { inherit profileName; }).out; - unicode_xid = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".unicode-xid."0.2.0" { inherit profileName; }).out; + proc_macro2 = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.56" { inherit profileName; }).out; + quote = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.26" { inherit profileName; }).out; + unicode_ident = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".unicode-ident."1.0.8" { inherit profileName; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".syn."2.0.13" = overridableMkRustCrate (profileName: rec { + name = "syn"; + version = "2.0.13"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "4c9da457c5285ac1f936ebd076af6dac17a61cfe7826f2076b4d015cf47bc8ec"; }; + features = builtins.concatLists [ + [ "clone-impls" ] + [ "default" ] + [ "derive" ] + [ "full" ] + [ "parsing" ] + [ "printing" ] + [ "proc-macro" ] + [ "quote" ] + ]; + dependencies = { + proc_macro2 = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.56" { inherit profileName; }).out; + quote = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.26" { inherit profileName; }).out; + unicode_ident = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".unicode-ident."1.0.8" { inherit profileName; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".syntex."0.42.2" = overridableMkRustCrate (profileName: rec { + name = "syntex"; + version = "0.42.2"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "0a30b08a6b383a22e5f6edc127d169670d48f905bb00ca79a00ea3e442ebe317"; }; + dependencies = { + syntex_errors = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".syntex_errors."0.42.0" { inherit profileName; }).out; + syntex_syntax = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".syntex_syntax."0.42.0" { inherit profileName; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".syntex_errors."0.42.0" = overridableMkRustCrate (profileName: rec { + name = "syntex_errors"; + version = "0.42.0"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "04c48f32867b6114449155b2a82114b86d4b09e1bddb21c47ff104ab9172b646"; }; + dependencies = { + libc = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.141" { inherit profileName; }).out; + log = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.3.9" { inherit profileName; }).out; + rustc_serialize = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".rustc-serialize."0.3.24" { inherit profileName; }).out; + syntex_pos = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".syntex_pos."0.42.0" { inherit profileName; }).out; + term = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".term."0.4.6" { inherit profileName; }).out; + unicode_xid = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".unicode-xid."0.0.3" { inherit profileName; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".syntex_pos."0.42.0" = overridableMkRustCrate (profileName: rec { + name = "syntex_pos"; + version = "0.42.0"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "3fd49988e52451813c61fecbe9abb5cfd4e1b7bb6cdbb980a6fbcbab859171a6"; }; + dependencies = { + rustc_serialize = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".rustc-serialize."0.3.24" { inherit profileName; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".syntex_syntax."0.42.0" = overridableMkRustCrate (profileName: rec { + name = "syntex_syntax"; + version = "0.42.0"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "7628a0506e8f9666fdabb5f265d0059b059edac9a3f810bda077abb5d826bd8d"; }; + dependencies = { + bitflags = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".bitflags."0.5.0" { inherit profileName; }).out; + libc = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.141" { inherit profileName; }).out; + log = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.3.9" { inherit profileName; }).out; + rustc_serialize = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".rustc-serialize."0.3.24" { inherit profileName; }).out; + syntex_errors = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".syntex_errors."0.42.0" { inherit profileName; }).out; + syntex_pos = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".syntex_pos."0.42.0" { inherit profileName; }).out; + term = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".term."0.4.6" { inherit profileName; }).out; + unicode_xid = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".unicode-xid."0.0.3" { inherit profileName; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".term."0.4.6" = overridableMkRustCrate (profileName: rec { + name = "term"; + version = "0.4.6"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1"; }; + features = builtins.concatLists [ + [ "default" ] + ]; + dependencies = { + ${ if hostPlatform.isWindows then "kernel32" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".kernel32-sys."0.2.2" { inherit profileName; }).out; + ${ if hostPlatform.isWindows then "winapi" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.2.8" { inherit profileName; }).out; }; }); @@ -1456,6 +2142,28 @@ in }; }); + "registry+https://github.com/rust-lang/crates.io-index".thiserror."1.0.40" = overridableMkRustCrate (profileName: rec { + name = "thiserror"; + version = "1.0.40"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac"; }; + dependencies = { + thiserror_impl = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".thiserror-impl."1.0.40" { profileName = "__noProfile"; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".thiserror-impl."1.0.40" = overridableMkRustCrate (profileName: rec { + name = "thiserror-impl"; + version = "1.0.40"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"; }; + dependencies = { + proc_macro2 = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.56" { inherit profileName; }).out; + quote = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.26" { inherit profileName; }).out; + syn = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."2.0.13" { inherit profileName; }).out; + }; + }); + "registry+https://github.com/rust-lang/crates.io-index".thread_local."0.3.6" = overridableMkRustCrate (profileName: rec { name = "thread_local"; version = "0.3.6"; @@ -1500,13 +2208,13 @@ in ]; dependencies = { bytes = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.1.0" { inherit profileName; }).out; - ${ if hostPlatform.isUnix then "libc" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.112" { inherit profileName; }).out; - memchr = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".memchr."2.3.0" { inherit profileName; }).out; + ${ if hostPlatform.isUnix then "libc" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.141" { inherit profileName; }).out; + memchr = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".memchr."2.5.0" { inherit profileName; }).out; mio = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".mio."0.7.14" { inherit profileName; }).out; num_cpus = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".num_cpus."1.13.1" { inherit profileName; }).out; pin_project_lite = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.7" { inherit profileName; }).out; tokio_macros = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio-macros."1.7.0" { profileName = "__noProfile"; }).out; - ${ if hostPlatform.isWindows then "winapi" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.8" { inherit profileName; }).out; + ${ if hostPlatform.isWindows then "winapi" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.9" { inherit profileName; }).out; }; }); @@ -1516,9 +2224,9 @@ in registry = "registry+https://github.com/rust-lang/crates.io-index"; src = fetchCratesIo { inherit name version; sha256 = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7"; }; dependencies = { - proc_macro2 = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.34" { inherit profileName; }).out; - quote = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.2" { inherit profileName; }).out; - syn = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.83" { inherit profileName; }).out; + proc_macro2 = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.56" { inherit profileName; }).out; + quote = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.26" { inherit profileName; }).out; + syn = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.109" { inherit profileName; }).out; }; }); @@ -1550,9 +2258,9 @@ in ]; dependencies = { bytes = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.1.0" { inherit profileName; }).out; - futures_core = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.5" { inherit profileName; }).out; - futures_sink = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-sink."0.3.5" { inherit profileName; }).out; - log = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.8" { inherit profileName; }).out; + futures_core = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.28" { inherit profileName; }).out; + futures_sink = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-sink."0.3.28" { inherit profileName; }).out; + log = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; }).out; pin_project_lite = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.7" { inherit profileName; }).out; tokio = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.15.0" { inherit profileName; }).out; }; @@ -1621,6 +2329,13 @@ in }; }); + "registry+https://github.com/rust-lang/crates.io-index".unicode-ident."1.0.8" = overridableMkRustCrate (profileName: rec { + name = "unicode-ident"; + version = "1.0.8"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"; }; + }); + "registry+https://github.com/rust-lang/crates.io-index".unicode-normalization."0.1.12" = overridableMkRustCrate (profileName: rec { name = "unicode-normalization"; version = "0.1.12"; @@ -1631,11 +2346,11 @@ in }; }); - "registry+https://github.com/rust-lang/crates.io-index".unicode-xid."0.2.0" = overridableMkRustCrate (profileName: rec { + "registry+https://github.com/rust-lang/crates.io-index".unicode-xid."0.0.3" = overridableMkRustCrate (profileName: rec { name = "unicode-xid"; - version = "0.2.0"; + version = "0.0.3"; registry = "registry+https://github.com/rust-lang/crates.io-index"; - src = fetchCratesIo { inherit name version; sha256 = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"; }; + src = fetchCratesIo { inherit name version; sha256 = "36dff09cafb4ec7c8cf0023eb0b686cb6ce65499116a12201c9e11840ca01beb"; }; features = builtins.concatLists [ [ "default" ] ]; @@ -1668,6 +2383,26 @@ in src = fetchCratesIo { inherit name version; sha256 = "b4ae116fef2b7fea257ed6440d3cfcff7f190865f170cdad00bb6465bf18ecba"; }; }); + "registry+https://github.com/rust-lang/crates.io-index".value-bag."1.0.0-alpha.9" = overridableMkRustCrate (profileName: rec { + name = "value-bag"; + version = "1.0.0-alpha.9"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "2209b78d1249f7e6f3293657c9779fe31ced465df091bbd433a1cf88e916ec55"; }; + dependencies = { + ctor = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".ctor."0.1.26" { profileName = "__noProfile"; }).out; + }; + buildDependencies = { + rustc = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".version_check."0.9.4" { profileName = "__noProfile"; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".version_check."0.9.4" = overridableMkRustCrate (profileName: rec { + name = "version_check"; + version = "0.9.4"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"; }; + }); + "registry+https://github.com/rust-lang/crates.io-index".void."1.0.2" = overridableMkRustCrate (profileName: rec { name = "void"; version = "1.0.2"; @@ -1679,13 +2414,20 @@ in ]; }); + "registry+https://github.com/rust-lang/crates.io-index".waker-fn."1.1.0" = overridableMkRustCrate (profileName: rec { + name = "waker-fn"; + version = "1.1.0"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca"; }; + }); + "registry+https://github.com/rust-lang/crates.io-index".want."0.3.0" = overridableMkRustCrate (profileName: rec { name = "want"; version = "0.3.0"; registry = "registry+https://github.com/rust-lang/crates.io-index"; src = fetchCratesIo { inherit name version; sha256 = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0"; }; dependencies = { - log = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.8" { inherit profileName; }).out; + log = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; }).out; try_lock = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".try-lock."0.2.2" { inherit profileName; }).out; }; }); @@ -1728,10 +2470,10 @@ in dependencies = { bumpalo = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".bumpalo."3.2.0" { inherit profileName; }).out; lazy_static = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".lazy_static."1.4.0" { inherit profileName; }).out; - log = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.8" { inherit profileName; }).out; - proc_macro2 = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.34" { inherit profileName; }).out; - quote = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.2" { inherit profileName; }).out; - syn = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.83" { inherit profileName; }).out; + log = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; }).out; + proc_macro2 = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.56" { inherit profileName; }).out; + quote = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.26" { inherit profileName; }).out; + syn = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.109" { inherit profileName; }).out; wasm_bindgen_shared = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".wasm-bindgen-shared."0.2.78" { inherit profileName; }).out; }; }); @@ -1758,7 +2500,7 @@ in [ "spans" ] ]; dependencies = { - quote = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.2" { inherit profileName; }).out; + quote = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.26" { inherit profileName; }).out; wasm_bindgen_macro_support = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".wasm-bindgen-macro-support."0.2.78" { inherit profileName; }).out; }; }); @@ -1772,9 +2514,9 @@ in [ "spans" ] ]; dependencies = { - proc_macro2 = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.34" { inherit profileName; }).out; - quote = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.2" { inherit profileName; }).out; - syn = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.83" { inherit profileName; }).out; + proc_macro2 = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.56" { inherit profileName; }).out; + quote = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.26" { inherit profileName; }).out; + syn = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.109" { inherit profileName; }).out; wasm_bindgen_backend = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".wasm-bindgen-backend."0.2.78" { inherit profileName; }).out; wasm_bindgen_shared = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".wasm-bindgen-shared."0.2.78" { inherit profileName; }).out; }; @@ -1833,6 +2575,19 @@ in }; }); + "registry+https://github.com/rust-lang/crates.io-index".wepoll-ffi."0.1.2" = overridableMkRustCrate (profileName: rec { + name = "wepoll-ffi"; + version = "0.1.2"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "d743fdedc5c64377b5fc2bc036b01c7fd642205a0d96356034ae3404d49eb7fb"; }; + features = builtins.concatLists [ + [ "null-overlapped-wakeups-patch" ] + ]; + buildDependencies = { + cc = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".cc."1.0.72" { profileName = "__noProfile"; }).out; + }; + }); + "registry+https://github.com/rust-lang/crates.io-index".wildmatch."1.1.0" = overridableMkRustCrate (profileName: rec { name = "wildmatch"; version = "1.1.0"; @@ -1847,11 +2602,11 @@ in src = fetchCratesIo { inherit name version; sha256 = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"; }; }); - "registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.8" = overridableMkRustCrate (profileName: rec { + "registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.9" = overridableMkRustCrate (profileName: rec { name = "winapi"; - version = "0.3.8"; + version = "0.3.9"; registry = "registry+https://github.com/rust-lang/crates.io-index"; - src = fetchCratesIo { inherit name version; sha256 = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"; }; + src = fetchCratesIo { inherit name version; sha256 = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"; }; features = builtins.concatLists [ [ "cfg" ] [ "consoleapi" ] @@ -1894,6 +2649,13 @@ in }; }); + "registry+https://github.com/rust-lang/crates.io-index".winapi-build."0.1.1" = overridableMkRustCrate (profileName: rec { + name = "winapi-build"; + version = "0.1.1"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"; }; + }); + "registry+https://github.com/rust-lang/crates.io-index".winapi-i686-pc-windows-gnu."0.4.0" = overridableMkRustCrate (profileName: rec { name = "winapi-i686-pc-windows-gnu"; version = "0.4.0"; @@ -1907,7 +2669,7 @@ in registry = "registry+https://github.com/rust-lang/crates.io-index"; src = fetchCratesIo { inherit name version; sha256 = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"; }; dependencies = { - ${ if hostPlatform.isWindows then "winapi" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.8" { inherit profileName; }).out; + ${ if hostPlatform.isWindows then "winapi" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.9" { inherit profileName; }).out; }; }); @@ -1918,13 +2680,128 @@ in src = fetchCratesIo { inherit name version; sha256 = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"; }; }); + "registry+https://github.com/rust-lang/crates.io-index".windows-sys."0.42.0" = overridableMkRustCrate (profileName: rec { + name = "windows-sys"; + version = "0.42.0"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"; }; + features = builtins.concatLists [ + [ "Win32" ] + [ "Win32_Foundation" ] + [ "Win32_System" ] + [ "Win32_System_IO" ] + [ "default" ] + ]; + dependencies = { + ${ if hostPlatform.config == "aarch64-pc-windows-gnullvm" then "windows_aarch64_gnullvm" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows_aarch64_gnullvm."0.42.2" { inherit profileName; }).out; + ${ if hostPlatform.config == "aarch64-pc-windows-msvc" || hostPlatform.config == "aarch64-uwp-windows-msvc" then "windows_aarch64_msvc" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows_aarch64_msvc."0.42.2" { inherit profileName; }).out; + ${ if hostPlatform.config == "i686-pc-windows-gnu" || hostPlatform.config == "i686-uwp-windows-gnu" then "windows_i686_gnu" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows_i686_gnu."0.42.2" { inherit profileName; }).out; + ${ if hostPlatform.config == "i686-pc-windows-msvc" || hostPlatform.config == "i686-uwp-windows-msvc" then "windows_i686_msvc" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows_i686_msvc."0.42.2" { inherit profileName; }).out; + ${ if hostPlatform.config == "x86_64-pc-windows-gnu" || hostPlatform.config == "x86_64-uwp-windows-gnu" then "windows_x86_64_gnu" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows_x86_64_gnu."0.42.2" { inherit profileName; }).out; + ${ if hostPlatform.config == "x86_64-pc-windows-gnullvm" then "windows_x86_64_gnullvm" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows_x86_64_gnullvm."0.42.2" { inherit profileName; }).out; + ${ if hostPlatform.config == "x86_64-pc-windows-msvc" || hostPlatform.config == "x86_64-uwp-windows-msvc" then "windows_x86_64_msvc" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows_x86_64_msvc."0.42.2" { inherit profileName; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".windows-sys."0.45.0" = overridableMkRustCrate (profileName: rec { + name = "windows-sys"; + version = "0.45.0"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"; }; + features = builtins.concatLists [ + [ "Win32" ] + [ "Win32_Foundation" ] + [ "Win32_NetworkManagement" ] + [ "Win32_NetworkManagement_IpHelper" ] + [ "Win32_Networking" ] + [ "Win32_Networking_WinSock" ] + [ "Win32_Security" ] + [ "Win32_Storage" ] + [ "Win32_Storage_FileSystem" ] + [ "Win32_System" ] + [ "Win32_System_Diagnostics" ] + [ "Win32_System_Diagnostics_Debug" ] + [ "Win32_System_IO" ] + [ "Win32_System_Threading" ] + [ "default" ] + ]; + dependencies = { + windows_targets = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows-targets."0.42.2" { inherit profileName; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".windows-targets."0.42.2" = overridableMkRustCrate (profileName: rec { + name = "windows-targets"; + version = "0.42.2"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"; }; + dependencies = { + ${ if hostPlatform.config == "aarch64-pc-windows-gnullvm" then "windows_aarch64_gnullvm" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows_aarch64_gnullvm."0.42.2" { inherit profileName; }).out; + ${ if hostPlatform.config == "aarch64-pc-windows-msvc" || hostPlatform.config == "aarch64-uwp-windows-msvc" then "windows_aarch64_msvc" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows_aarch64_msvc."0.42.2" { inherit profileName; }).out; + ${ if hostPlatform.config == "i686-pc-windows-gnu" || hostPlatform.config == "i686-uwp-windows-gnu" then "windows_i686_gnu" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows_i686_gnu."0.42.2" { inherit profileName; }).out; + ${ if hostPlatform.config == "i686-pc-windows-msvc" || hostPlatform.config == "i686-uwp-windows-msvc" then "windows_i686_msvc" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows_i686_msvc."0.42.2" { inherit profileName; }).out; + ${ if hostPlatform.config == "x86_64-pc-windows-gnu" || hostPlatform.config == "x86_64-uwp-windows-gnu" then "windows_x86_64_gnu" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows_x86_64_gnu."0.42.2" { inherit profileName; }).out; + ${ if hostPlatform.config == "x86_64-pc-windows-gnullvm" then "windows_x86_64_gnullvm" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows_x86_64_gnullvm."0.42.2" { inherit profileName; }).out; + ${ if hostPlatform.config == "x86_64-pc-windows-msvc" || hostPlatform.config == "x86_64-uwp-windows-msvc" then "windows_x86_64_msvc" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows_x86_64_msvc."0.42.2" { inherit profileName; }).out; + }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".windows_aarch64_gnullvm."0.42.2" = overridableMkRustCrate (profileName: rec { + name = "windows_aarch64_gnullvm"; + version = "0.42.2"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"; }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".windows_aarch64_msvc."0.42.2" = overridableMkRustCrate (profileName: rec { + name = "windows_aarch64_msvc"; + version = "0.42.2"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"; }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".windows_i686_gnu."0.42.2" = overridableMkRustCrate (profileName: rec { + name = "windows_i686_gnu"; + version = "0.42.2"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"; }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".windows_i686_msvc."0.42.2" = overridableMkRustCrate (profileName: rec { + name = "windows_i686_msvc"; + version = "0.42.2"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"; }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".windows_x86_64_gnu."0.42.2" = overridableMkRustCrate (profileName: rec { + name = "windows_x86_64_gnu"; + version = "0.42.2"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"; }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".windows_x86_64_gnullvm."0.42.2" = overridableMkRustCrate (profileName: rec { + name = "windows_x86_64_gnullvm"; + version = "0.42.2"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"; }; + }); + + "registry+https://github.com/rust-lang/crates.io-index".windows_x86_64_msvc."0.42.2" = overridableMkRustCrate (profileName: rec { + name = "windows_x86_64_msvc"; + version = "0.42.2"; + registry = "registry+https://github.com/rust-lang/crates.io-index"; + src = fetchCratesIo { inherit name version; sha256 = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"; }; + }); + "registry+https://github.com/rust-lang/crates.io-index".winreg."0.7.0" = overridableMkRustCrate (profileName: rec { name = "winreg"; version = "0.7.0"; registry = "registry+https://github.com/rust-lang/crates.io-index"; src = fetchCratesIo { inherit name version; sha256 = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69"; }; dependencies = { - winapi = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.8" { inherit profileName; }).out; + winapi = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.9" { inherit profileName; }).out; }; }); diff --git a/Cargo.toml b/Cargo.toml index f3c6f11..4765af1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,3 +21,4 @@ serde = { version = "1.0.107", features = ["derive"] } serde-lexpr = "0.1.1" serde_json = "1.0.53" tokio = { version = "1", features = ["sync", "rt-multi-thread", "net", "macros"] } +stun-client = "0.1.2" diff --git a/src/config/mod.rs b/src/config/mod.rs index 2bf8f66..a9cbd13 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -5,9 +5,10 @@ mod runtime; pub use options::{ConfigOpts, ConfigOptsAcme, ConfigOptsBase, ConfigOptsConsul}; pub use runtime::{ - RuntimeConfig, RuntimeConfigAcme, RuntimeConfigConsul, RuntimeConfigFirewall, RuntimeConfigIgd, + RuntimeConfig, RuntimeConfigAcme, RuntimeConfigConsul, RuntimeConfigFirewall, RuntimeConfigIgd, RuntimeConfigStun }; pub const EXPIRATION_TIME: u16 = 300; pub const REFRESH_TIME: u16 = 60; pub const CONSUL_URL: &str = "http://127.0.0.1:8500"; +pub const STUN_SERVER: &str = "stun.nextcloud.com:443"; diff --git a/src/config/options.rs b/src/config/options.rs index 793838a..08cdd15 100644 --- a/src/config/options.rs +++ b/src/config/options.rs @@ -17,6 +17,8 @@ pub struct ConfigOptsBase { pub expiration_time: Option, /// Refresh time for IGD and Firewall rules [default: 300] pub refresh_time: Option, + /// STUN server [default: stun.nextcloud.com:443] + pub stun_server: Option, } /// ACME configuration options @@ -69,7 +71,7 @@ impl ConfigOpts { } // Currently only used in tests - #[allow(dead_code)] + #[cfg(test)] pub fn from_iter(iter: Iter) -> Result where Iter: IntoIterator, diff --git a/src/config/options_test.rs b/src/config/options_test.rs index 6b91235..427b70e 100644 --- a/src/config/options_test.rs +++ b/src/config/options_test.rs @@ -20,6 +20,10 @@ fn minimal_valid_options() -> HashMap { fn all_valid_options() -> HashMap { let mut opts = minimal_valid_options(); opts.insert("DIPLONAT_EXPIRATION_TIME".to_string(), "30".to_string()); + opts.insert( + "DIPLONAT_STUN_SERVER".to_string(), + "stun.nextcloud.com:443".to_string(), + ); opts.insert( "DIPLONAT_PRIVATE_IP".to_string(), "172.123.43.555".to_string(), diff --git a/src/config/runtime.rs b/src/config/runtime.rs index 2e7b573..50624de 100644 --- a/src/config/runtime.rs +++ b/src/config/runtime.rs @@ -1,6 +1,7 @@ use std::fs::File; use std::io::Read; use std::time::Duration; +use std::net::{SocketAddr, ToSocketAddrs}; use anyhow::{anyhow, bail, Result}; @@ -35,26 +36,36 @@ pub struct RuntimeConfigIgd { pub refresh_time: Duration, } +#[derive(Debug)] +pub struct RuntimeConfigStun { + pub stun_server_v4: SocketAddr, + pub stun_server_v6: SocketAddr, + pub refresh_time: Duration, +} + #[derive(Debug)] pub struct RuntimeConfig { pub acme: Option, pub consul: RuntimeConfigConsul, pub firewall: RuntimeConfigFirewall, pub igd: RuntimeConfigIgd, + pub stun: RuntimeConfigStun, } impl RuntimeConfig { pub fn new(opts: ConfigOpts) -> Result { - let acme = RuntimeConfigAcme::new(opts.acme.clone())?; - let consul = RuntimeConfigConsul::new(opts.consul.clone())?; - let firewall = RuntimeConfigFirewall::new(opts.base.clone())?; - let igd = RuntimeConfigIgd::new(opts.base.clone())?; + let acme = RuntimeConfigAcme::new(opts.acme)?; + let consul = RuntimeConfigConsul::new(opts.consul)?; + let firewall = RuntimeConfigFirewall::new(&opts.base)?; + let igd = RuntimeConfigIgd::new(&opts.base)?; + let stun = RuntimeConfigStun::new(&opts.base)?; Ok(Self { acme, consul, firewall, igd, + stun, }) } } @@ -115,7 +126,7 @@ impl RuntimeConfigConsul { } impl RuntimeConfigFirewall { - pub(super) fn new(opts: ConfigOptsBase) -> Result { + pub(super) fn new(opts: &ConfigOptsBase) -> Result { let refresh_time = Duration::from_secs(opts.refresh_time.unwrap_or(super::REFRESH_TIME).into()); Ok(Self { refresh_time }) @@ -123,8 +134,8 @@ impl RuntimeConfigFirewall { } impl RuntimeConfigIgd { - pub(super) fn new(opts: ConfigOptsBase) -> Result { - let private_ip = opts.private_ip; + pub(super) fn new(opts: &ConfigOptsBase) -> Result { + let private_ip = opts.private_ip.clone(); let expiration_time = Duration::from_secs( opts .expiration_time @@ -149,3 +160,26 @@ impl RuntimeConfigIgd { }) } } + +impl RuntimeConfigStun { + pub(super) fn new(opts: &ConfigOptsBase) -> Result { + let mut stun_server_v4 = None; + let mut stun_server_v6 = None; + for addr in opts.stun_server.as_deref().unwrap_or(super::STUN_SERVER).to_socket_addrs()? { + if addr.is_ipv4() { + stun_server_v4 = Some(addr); + } + if addr.is_ipv6() { + stun_server_v6 = Some(addr); + } + } + + let refresh_time = Duration::from_secs(opts.refresh_time.unwrap_or(super::REFRESH_TIME).into()); + + Ok(Self { + stun_server_v4: stun_server_v4.ok_or(anyhow!("Unable to resolve STUN server's IPv4 address"))?, + stun_server_v6: stun_server_v6.ok_or(anyhow!("Unable to resolve STUN server's IPv6 address"))?, + refresh_time, + }) + } +} diff --git a/src/consul.rs b/src/consul.rs index c7ac2b6..e31033c 100644 --- a/src/consul.rs +++ b/src/consul.rs @@ -7,12 +7,14 @@ use crate::config::RuntimeConfigConsul; #[derive(Serialize, Deserialize, Debug)] pub struct ServiceEntry { - pub Tags: Vec, + #[serde(rename = "Tags")] + pub tags: Vec, } -#[derive(Serialize, Deserialize, Debug)] +#[derive(Serialize, Deserialize, Debug, Default)] pub struct CatalogNode { - pub Services: HashMap, + #[serde(rename = "Services")] + pub services: HashMap, } pub struct Consul { @@ -71,7 +73,14 @@ impl Consul { None => return Err(anyhow!("X-Consul-Index header not found")), }; - let resp: CatalogNode = http.json().await?; - return Ok(resp); + let resp: Option = http.json().await?; + return Ok(resp.unwrap_or_default()); + } + + pub async fn kv_put(&self, key: &str, bytes: Vec) -> Result<()> { + let url = format!("{}/v1/kv/{}", self.url, key); + let http = self.client.put(&url).body(bytes).send().await?; + http.error_for_status()?; + Ok(()) } } diff --git a/src/consul_actor.rs b/src/consul_actor.rs index 8b722b6..e4296e7 100644 --- a/src/consul_actor.rs +++ b/src/consul_actor.rs @@ -11,13 +11,16 @@ use crate::{consul, messages}; #[derive(Serialize, Deserialize, Debug)] pub enum DiplonatParameter { - tcp_port(HashSet), - udp_port(HashSet), + #[serde(rename = "tcp_port")] + TcpPort(HashSet), + #[serde(rename = "udp_port")] + UdpPort(HashSet), } #[derive(Serialize, Deserialize, Debug)] pub enum DiplonatConsul { - diplonat(Vec), + #[serde(rename = "diplonat")] + Diplonat(Vec), } pub struct ConsulActor { @@ -42,8 +45,8 @@ fn retry_to_time(retries: u32, max_time: Duration) -> Duration { fn to_parameters(catalog: &consul::CatalogNode) -> Vec { let mut r = Vec::new(); - for (_, service_info) in &catalog.Services { - for tag in &service_info.Tags { + for (_, service_info) in &catalog.services { + for tag in &service_info.tags { let diplo_conf: error::Result = from_str(tag); match diplo_conf { Ok(conf) => r.push(conf), @@ -62,11 +65,11 @@ fn to_open_ports(params: &Vec) -> messages::PublicExposedPorts { }; for conf in params { - let DiplonatConsul::diplonat(c) = conf; + let DiplonatConsul::Diplonat(c) = conf; for parameter in c { match parameter { - DiplonatParameter::tcp_port(p) => op.tcp_ports.extend(p), - DiplonatParameter::udp_port(p) => op.udp_ports.extend(p), + DiplonatParameter::TcpPort(p) => op.tcp_ports.extend(p), + DiplonatParameter::UdpPort(p) => op.udp_ports.extend(p), }; } } diff --git a/src/diplonat.rs b/src/diplonat.rs index 22ebd6e..6b282eb 100644 --- a/src/diplonat.rs +++ b/src/diplonat.rs @@ -3,12 +3,14 @@ use tokio::try_join; use crate::{ config::ConfigOpts, consul_actor::ConsulActor, fw_actor::FirewallActor, igd_actor::IgdActor, + stun_actor::StunActor, }; pub struct Diplonat { consul: ConsulActor, firewall: FirewallActor, igd: IgdActor, + stun: StunActor, } impl Diplonat { @@ -28,22 +30,30 @@ impl Diplonat { ) .await?; + let sa = StunActor::new( + &rt_cfg.consul, + &rt_cfg.stun, + &rt_cfg.consul.node_name, + ); + let ctx = Self { consul: ca, igd: ia, firewall: fw, + stun: sa, }; - return Ok(ctx); + Ok(ctx) } pub async fn listen(&mut self) -> Result<()> { try_join!( self.consul.listen(), self.igd.listen(), - self.firewall.listen() + self.firewall.listen(), + self.stun.listen(), )?; - return Ok(()); + Ok(()) } } diff --git a/src/fw.rs b/src/fw.rs index e18a301..f416e6a 100644 --- a/src/fw.rs +++ b/src/fw.rs @@ -11,6 +11,7 @@ pub fn setup(ipt: &iptables::IPTables) -> Result<()> { // ensure we start from a clean state without any rule already set cleanup(ipt)?; + info!("{}: creating DIPLONAT chain using", ipt.cmd); ipt .new_chain("filter", "DIPLONAT") .context("Failed to create new chain")?; @@ -23,6 +24,7 @@ pub fn setup(ipt: &iptables::IPTables) -> Result<()> { pub fn open_ports(ipt: &iptables::IPTables, ports: messages::PublicExposedPorts) -> Result<()> { for p in ports.tcp_ports { + info!("{}: opening TCP port {}", ipt.cmd, p); ipt .append( "filter", @@ -33,6 +35,7 @@ pub fn open_ports(ipt: &iptables::IPTables, ports: messages::PublicExposedPorts) } for p in ports.udp_ports { + info!("{}: opening UDP port {}", ipt.cmd, p); ipt .append( "filter", @@ -80,6 +83,7 @@ pub fn get_opened_ports(ipt: &iptables::IPTables) -> Result Result<()> { if ipt.chain_exists("filter", "DIPLONAT")? { + info!("{}: removing old DIPLONAT chain", ipt.cmd); ipt .flush_chain("filter", "DIPLONAT") .context("Failed to flush the DIPLONAT chain")?; diff --git a/src/igd_actor.rs b/src/igd_actor.rs index d32f5dc..68f4217 100644 --- a/src/igd_actor.rs +++ b/src/igd_actor.rs @@ -46,6 +46,7 @@ impl IgdActor { gw.addr.ip() ), }; + #[allow(unused_parens)] let public_ip = get_if_addrs::get_if_addrs()? .into_iter() .map(|i| i.addr.ip()) diff --git a/src/main.rs b/src/main.rs index 99d38f5..4cd57c5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,6 +6,7 @@ mod fw; mod fw_actor; mod igd_actor; mod messages; +mod stun_actor; use diplonat::Diplonat; use log::*; @@ -15,6 +16,10 @@ async fn main() { pretty_env_logger::init(); info!("Starting Diplonat"); - let mut diplo = Diplonat::new().await.expect("Setup failed"); - diplo.listen().await.expect("A runtime error occured"); + Diplonat::new() + .await + .expect("Setup failed") + .listen() + .await + .expect("A runtime error occured"); } diff --git a/src/stun_actor.rs b/src/stun_actor.rs new file mode 100644 index 0000000..dee60f0 --- /dev/null +++ b/src/stun_actor.rs @@ -0,0 +1,95 @@ +use std::net::{SocketAddr, IpAddr}; +use std::time::{Duration, SystemTime}; + +use anyhow::{Result, bail, anyhow}; +use log::*; +use serde::{Serialize, Deserialize}; + +use crate::config::{RuntimeConfigConsul, RuntimeConfigStun}; +use crate::consul; + +pub struct StunActor { + node: String, + consul: consul::Consul, + stun_server_v4: SocketAddr, + stun_server_v6: SocketAddr, + refresh_time: Duration, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct AutodiscoverResult { + pub timestamp: u64, + pub address: IpAddr, +} + +impl StunActor { + pub fn new(consul_config: &RuntimeConfigConsul, stun_config: &RuntimeConfigStun, node: &str) -> Self { + assert!(stun_config.stun_server_v4.is_ipv4()); + assert!(stun_config.stun_server_v6.is_ipv6()); + + Self { + consul: consul::Consul::new(consul_config), + node: node.to_string(), + stun_server_v4: stun_config.stun_server_v4, + stun_server_v6: stun_config.stun_server_v6, + refresh_time: stun_config.refresh_time, + } + } + + pub async fn listen(&mut self) -> Result<()> { + loop { + if let Err(e) = self.autodiscover_ip(self.stun_server_v4).await { + error!("Unable to autodiscover IPv4 address: {}", e); + } + if let Err(e) = self.autodiscover_ip(self.stun_server_v6).await { + error!("Unable to autodiscover IPv6 address: {}", e); + } + tokio::time::sleep(self.refresh_time).await; + } + } + + async fn autodiscover_ip(&self, stun_server: SocketAddr) -> Result<()> { + let binding_addr = match stun_server.is_ipv4() { + true => "0.0.0.0:34791".parse().unwrap(), + false => "[::]:34792".parse().unwrap(), + }; + + let discovered_addr = get_mapped_addr(stun_server, binding_addr).await?.ip(); + + let consul_key = match stun_server.is_ipv4() { + true => { + debug!("Autodiscovered IPv4: {}", discovered_addr); + format!("diplonat/autodiscovery/ipv4/{}", self.node) + } + false => { + debug!("Autodiscovered IPv6: {}", discovered_addr); + format!("diplonat/autodiscovery/ipv6/{}", self.node) + } + }; + + self.consul.kv_put(&consul_key, serde_json::to_vec(&AutodiscoverResult{ + timestamp: SystemTime::now().duration_since(SystemTime::UNIX_EPOCH)?.as_secs(), + address: discovered_addr, + })?).await?; + + Ok(()) + } +} + +async fn get_mapped_addr(stun_server: SocketAddr, binding_addr: SocketAddr) -> Result { + use stun_client::*; + + let mut client = Client::new(binding_addr, None).await.unwrap(); + let res = client + .binding_request(stun_server, None) + .await + .unwrap(); + + if res.get_class() != Class::SuccessResponse { + bail!("STUN server did not responde with a success response"); + } + + let xor_mapped_addr = Attribute::get_xor_mapped_address(&res) + .ok_or(anyhow!("no XorMappedAddress found in STUN response"))?; + Ok(xor_mapped_addr) +} From 2d39adcabb898686cb63c10713e9d9b63efc5601 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Tue, 4 Apr 2023 18:48:10 +0200 Subject: [PATCH 02/10] cargo fmt --- src/config/mod.rs | 3 ++- src/config/runtime.rs | 15 +++++++++++---- src/diplonat.rs | 6 +----- src/stun_actor.rs | 35 ++++++++++++++++++++++------------- 4 files changed, 36 insertions(+), 23 deletions(-) diff --git a/src/config/mod.rs b/src/config/mod.rs index a9cbd13..45ea975 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -5,7 +5,8 @@ mod runtime; pub use options::{ConfigOpts, ConfigOptsAcme, ConfigOptsBase, ConfigOptsConsul}; pub use runtime::{ - RuntimeConfig, RuntimeConfigAcme, RuntimeConfigConsul, RuntimeConfigFirewall, RuntimeConfigIgd, RuntimeConfigStun + RuntimeConfig, RuntimeConfigAcme, RuntimeConfigConsul, RuntimeConfigFirewall, RuntimeConfigIgd, + RuntimeConfigStun, }; pub const EXPIRATION_TIME: u16 = 300; diff --git a/src/config/runtime.rs b/src/config/runtime.rs index 50624de..f2d2a12 100644 --- a/src/config/runtime.rs +++ b/src/config/runtime.rs @@ -1,7 +1,7 @@ use std::fs::File; use std::io::Read; -use std::time::Duration; use std::net::{SocketAddr, ToSocketAddrs}; +use std::time::Duration; use anyhow::{anyhow, bail, Result}; @@ -165,7 +165,12 @@ impl RuntimeConfigStun { pub(super) fn new(opts: &ConfigOptsBase) -> Result { let mut stun_server_v4 = None; let mut stun_server_v6 = None; - for addr in opts.stun_server.as_deref().unwrap_or(super::STUN_SERVER).to_socket_addrs()? { + for addr in opts + .stun_server + .as_deref() + .unwrap_or(super::STUN_SERVER) + .to_socket_addrs()? + { if addr.is_ipv4() { stun_server_v4 = Some(addr); } @@ -177,8 +182,10 @@ impl RuntimeConfigStun { let refresh_time = Duration::from_secs(opts.refresh_time.unwrap_or(super::REFRESH_TIME).into()); Ok(Self { - stun_server_v4: stun_server_v4.ok_or(anyhow!("Unable to resolve STUN server's IPv4 address"))?, - stun_server_v6: stun_server_v6.ok_or(anyhow!("Unable to resolve STUN server's IPv6 address"))?, + stun_server_v4: stun_server_v4 + .ok_or(anyhow!("Unable to resolve STUN server's IPv4 address"))?, + stun_server_v6: stun_server_v6 + .ok_or(anyhow!("Unable to resolve STUN server's IPv6 address"))?, refresh_time, }) } diff --git a/src/diplonat.rs b/src/diplonat.rs index 6b282eb..4252f43 100644 --- a/src/diplonat.rs +++ b/src/diplonat.rs @@ -30,11 +30,7 @@ impl Diplonat { ) .await?; - let sa = StunActor::new( - &rt_cfg.consul, - &rt_cfg.stun, - &rt_cfg.consul.node_name, - ); + let sa = StunActor::new(&rt_cfg.consul, &rt_cfg.stun, &rt_cfg.consul.node_name); let ctx = Self { consul: ca, diff --git a/src/stun_actor.rs b/src/stun_actor.rs index dee60f0..c1e10ef 100644 --- a/src/stun_actor.rs +++ b/src/stun_actor.rs @@ -1,9 +1,9 @@ -use std::net::{SocketAddr, IpAddr}; +use std::net::{IpAddr, SocketAddr}; use std::time::{Duration, SystemTime}; -use anyhow::{Result, bail, anyhow}; +use anyhow::{anyhow, bail, Result}; use log::*; -use serde::{Serialize, Deserialize}; +use serde::{Deserialize, Serialize}; use crate::config::{RuntimeConfigConsul, RuntimeConfigStun}; use crate::consul; @@ -23,7 +23,11 @@ pub struct AutodiscoverResult { } impl StunActor { - pub fn new(consul_config: &RuntimeConfigConsul, stun_config: &RuntimeConfigStun, node: &str) -> Self { + pub fn new( + consul_config: &RuntimeConfigConsul, + stun_config: &RuntimeConfigStun, + node: &str, + ) -> Self { assert!(stun_config.stun_server_v4.is_ipv4()); assert!(stun_config.stun_server_v6.is_ipv6()); @@ -67,10 +71,18 @@ impl StunActor { } }; - self.consul.kv_put(&consul_key, serde_json::to_vec(&AutodiscoverResult{ - timestamp: SystemTime::now().duration_since(SystemTime::UNIX_EPOCH)?.as_secs(), - address: discovered_addr, - })?).await?; + self + .consul + .kv_put( + &consul_key, + serde_json::to_vec(&AutodiscoverResult { + timestamp: SystemTime::now() + .duration_since(SystemTime::UNIX_EPOCH)? + .as_secs(), + address: discovered_addr, + })?, + ) + .await?; Ok(()) } @@ -80,16 +92,13 @@ async fn get_mapped_addr(stun_server: SocketAddr, binding_addr: SocketAddr) -> R use stun_client::*; let mut client = Client::new(binding_addr, None).await.unwrap(); - let res = client - .binding_request(stun_server, None) - .await - .unwrap(); + let res = client.binding_request(stun_server, None).await.unwrap(); if res.get_class() != Class::SuccessResponse { bail!("STUN server did not responde with a success response"); } let xor_mapped_addr = Attribute::get_xor_mapped_address(&res) - .ok_or(anyhow!("no XorMappedAddress found in STUN response"))?; + .ok_or(anyhow!("no XorMappedAddress found in STUN response"))?; Ok(xor_mapped_addr) } From b3f76f272abab8695b4406c6f0addcb58253c89d Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Tue, 4 Apr 2023 18:48:52 +0200 Subject: [PATCH 03/10] Remove .rustfmt.toml and move to standard rustfmt format (4 spaces) --- .rustfmt.toml | 75 ------------ src/config/mod.rs | 4 +- src/config/options.rs | 109 ++++++++--------- src/config/options_test.rs | 182 ++++++++++++++------------- src/config/runtime.rs | 243 +++++++++++++++++++------------------ src/consul.rs | 122 +++++++++---------- src/consul_actor.rs | 156 ++++++++++++------------ src/diplonat.rs | 72 +++++------ src/fw.rs | 135 ++++++++++----------- src/fw_actor.rs | 144 +++++++++++----------- src/igd_actor.rs | 213 ++++++++++++++++---------------- src/main.rs | 16 +-- src/messages.rs | 16 +-- src/stun_actor.rs | 139 +++++++++++---------- 14 files changed, 772 insertions(+), 854 deletions(-) delete mode 100644 .rustfmt.toml diff --git a/.rustfmt.toml b/.rustfmt.toml deleted file mode 100644 index 37dfe2c..0000000 --- a/.rustfmt.toml +++ /dev/null @@ -1,75 +0,0 @@ -unstable_features = true - -array_width = 60 -attr_fn_like_width = 70 -binop_separator = "Front" -blank_lines_lower_bound = 0 -blank_lines_upper_bound = 1 -brace_style = "SameLineWhere" -chain_width = 60 -color = "Auto" -combine_control_expr = true -comment_width = 80 -condense_wildcard_suffixes = true -control_brace_style = "AlwaysSameLine" -disable_all_formatting = false -empty_item_single_line = true -enum_discrim_align_threshold = 0 -error_on_line_overflow = true -error_on_unformatted = true -fn_args_layout = "Tall" -fn_call_width = 60 -fn_single_line = true -force_explicit_abi = true -force_multiline_blocks = false -format_code_in_doc_comments = true -# format_generated_files = true -format_macro_matchers = true -format_macro_bodies = true -format_strings = true -hard_tabs = false -#hex_literal_case = "Lower" -hide_parse_errors = false -ignore = [] -imports_indent = "Block" -imports_layout = "Mixed" -indent_style = "Block" -inline_attribute_width = 0 -license_template_path = "" -match_arm_blocks = true -match_arm_leading_pipes = "Never" -match_block_trailing_comma = false -max_width = 100 -merge_derives = true -imports_granularity = "Crate" -newline_style = "Unix" -normalize_comments = true -normalize_doc_attributes = true -overflow_delimited_expr = false -remove_nested_parens = true -reorder_impl_items = true -reorder_imports = true -group_imports = "StdExternalCrate" -reorder_modules = true -report_fixme = "Unnumbered" -report_todo = "Unnumbered" -required_version = "1.4.37" -skip_children = false -single_line_if_else_max_width = 50 -space_after_colon = true -space_before_colon = false -#space_around_ranges = false -struct_field_align_threshold = 0 -struct_lit_single_line = true -struct_lit_width = 18 -struct_variant_width = 35 -tab_spaces = 2 -trailing_comma = "Vertical" -trailing_semicolon = false -type_punctuation_density = "Wide" -use_field_init_shorthand = false -use_small_heuristics = "Off" -use_try_shorthand = true -version = "Two" -where_single_line = true -wrap_comments = true diff --git a/src/config/mod.rs b/src/config/mod.rs index 45ea975..00577c6 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -5,8 +5,8 @@ mod runtime; pub use options::{ConfigOpts, ConfigOptsAcme, ConfigOptsBase, ConfigOptsConsul}; pub use runtime::{ - RuntimeConfig, RuntimeConfigAcme, RuntimeConfigConsul, RuntimeConfigFirewall, RuntimeConfigIgd, - RuntimeConfigStun, + RuntimeConfig, RuntimeConfigAcme, RuntimeConfigConsul, RuntimeConfigFirewall, RuntimeConfigIgd, + RuntimeConfigStun, }; pub const EXPIRATION_TIME: u16 = 300; diff --git a/src/config/options.rs b/src/config/options.rs index 08cdd15..100c23c 100644 --- a/src/config/options.rs +++ b/src/config/options.rs @@ -11,79 +11,80 @@ use crate::config::RuntimeConfig; /// Base configuration options #[derive(Clone, Default, Deserialize)] pub struct ConfigOptsBase { - /// This node's private IP address [default: None] - pub private_ip: Option, - /// Expiration time for IGD rules [default: 60] - pub expiration_time: Option, - /// Refresh time for IGD and Firewall rules [default: 300] - pub refresh_time: Option, - /// STUN server [default: stun.nextcloud.com:443] - pub stun_server: Option, + /// This node's private IP address [default: None] + pub private_ip: Option, + /// Expiration time for IGD rules [default: 60] + pub expiration_time: Option, + /// Refresh time for IGD and Firewall rules [default: 300] + pub refresh_time: Option, + /// STUN server [default: stun.nextcloud.com:443] + pub stun_server: Option, } /// ACME configuration options #[derive(Clone, Default, Deserialize)] pub struct ConfigOptsAcme { - /// Whether ACME is enabled [default: false] - #[serde(default)] - pub enable: bool, + /// Whether ACME is enabled [default: false] + #[serde(default)] + pub enable: bool, - /// The default domain holder's e-mail [default: None] - pub email: Option, + /// The default domain holder's e-mail [default: None] + pub email: Option, } /// Consul configuration options #[derive(Clone, Default, Deserialize)] pub struct ConfigOptsConsul { - /// Consul's node name [default: None] - pub node_name: Option, - /// Consul's REST URL [default: "http://127.0.0.1:8500"] - pub url: Option, - /// Consul's CA certificate [default: None] - pub ca_cert: Option, - /// Skip TLS verification for Consul server [default: false] - #[serde(default)] - pub tls_skip_verify: bool, - /// Consul's client certificate [default: None] - pub client_cert: Option, - /// Consul's client key [default: None] - pub client_key: Option, + /// Consul's node name [default: None] + pub node_name: Option, + /// Consul's REST URL [default: "http://127.0.0.1:8500"] + pub url: Option, + /// Consul's CA certificate [default: None] + pub ca_cert: Option, + /// Skip TLS verification for Consul server [default: false] + #[serde(default)] + pub tls_skip_verify: bool, + /// Consul's client certificate [default: None] + pub client_cert: Option, + /// Consul's client key [default: None] + pub client_key: Option, } /// Model of all potential configuration options pub struct ConfigOpts { - pub base: ConfigOptsBase, - pub acme: ConfigOptsAcme, - pub consul: ConfigOptsConsul, + pub base: ConfigOptsBase, + pub acme: ConfigOptsAcme, + pub consul: ConfigOptsConsul, } impl ConfigOpts { - pub fn from_env() -> Result { - let base: ConfigOptsBase = envy::prefixed("DIPLONAT_").from_env()?; - let consul: ConfigOptsConsul = envy::prefixed("DIPLONAT_CONSUL_").from_env()?; - let acme: ConfigOptsAcme = envy::prefixed("DIPLONAT_ACME_").from_env()?; + pub fn from_env() -> Result { + let base: ConfigOptsBase = envy::prefixed("DIPLONAT_").from_env()?; + let consul: ConfigOptsConsul = envy::prefixed("DIPLONAT_CONSUL_").from_env()?; + let acme: ConfigOptsAcme = envy::prefixed("DIPLONAT_ACME_").from_env()?; - RuntimeConfig::new(Self { - base: base, - consul: consul, - acme: acme, - }) - } + RuntimeConfig::new(Self { + base: base, + consul: consul, + acme: acme, + }) + } - // Currently only used in tests - #[cfg(test)] - pub fn from_iter(iter: Iter) -> Result - where - Iter: IntoIterator, - { - let base: ConfigOptsBase = envy::prefixed("DIPLONAT_").from_iter(iter.clone())?; - let consul: ConfigOptsConsul = envy::prefixed("DIPLONAT_CONSUL_").from_iter(iter.clone())?; - let acme: ConfigOptsAcme = envy::prefixed("DIPLONAT_ACME_").from_iter(iter.clone())?; + // Currently only used in tests + #[cfg(test)] + pub fn from_iter(iter: Iter) -> Result + where + Iter: IntoIterator, + { + let base: ConfigOptsBase = envy::prefixed("DIPLONAT_").from_iter(iter.clone())?; + let consul: ConfigOptsConsul = + envy::prefixed("DIPLONAT_CONSUL_").from_iter(iter.clone())?; + let acme: ConfigOptsAcme = envy::prefixed("DIPLONAT_ACME_").from_iter(iter.clone())?; - RuntimeConfig::new(Self { - base: base, - consul: consul, - acme: acme, - }) - } + RuntimeConfig::new(Self { + base: base, + consul: consul, + acme: acme, + }) + } } diff --git a/src/config/options_test.rs b/src/config/options_test.rs index 427b70e..655fb01 100644 --- a/src/config/options_test.rs +++ b/src/config/options_test.rs @@ -9,120 +9,118 @@ use crate::config::*; // This is why we only test ConfigOpts::from_iter(iter). fn minimal_valid_options() -> HashMap { - let mut opts = HashMap::new(); - opts.insert( - "DIPLONAT_CONSUL_NODE_NAME".to_string(), - "consul_node".to_string(), - ); - opts + let mut opts = HashMap::new(); + opts.insert( + "DIPLONAT_CONSUL_NODE_NAME".to_string(), + "consul_node".to_string(), + ); + opts } fn all_valid_options() -> HashMap { - let mut opts = minimal_valid_options(); - opts.insert("DIPLONAT_EXPIRATION_TIME".to_string(), "30".to_string()); - opts.insert( - "DIPLONAT_STUN_SERVER".to_string(), - "stun.nextcloud.com:443".to_string(), - ); - opts.insert( - "DIPLONAT_PRIVATE_IP".to_string(), - "172.123.43.555".to_string(), - ); - opts.insert("DIPLONAT_REFRESH_TIME".to_string(), "10".to_string()); - opts.insert( - "DIPLONAT_CONSUL_URL".to_string(), - "http://127.0.0.1:9999".to_string(), - ); - opts.insert("DIPLONAT_ACME_ENABLE".to_string(), "true".to_string()); - opts.insert( - "DIPLONAT_ACME_EMAIL".to_string(), - "bozo@bozo.net".to_string(), - ); - opts + let mut opts = minimal_valid_options(); + opts.insert("DIPLONAT_EXPIRATION_TIME".to_string(), "30".to_string()); + opts.insert( + "DIPLONAT_STUN_SERVER".to_string(), + "stun.nextcloud.com:443".to_string(), + ); + opts.insert( + "DIPLONAT_PRIVATE_IP".to_string(), + "172.123.43.555".to_string(), + ); + opts.insert("DIPLONAT_REFRESH_TIME".to_string(), "10".to_string()); + opts.insert( + "DIPLONAT_CONSUL_URL".to_string(), + "http://127.0.0.1:9999".to_string(), + ); + opts.insert("DIPLONAT_ACME_ENABLE".to_string(), "true".to_string()); + opts.insert( + "DIPLONAT_ACME_EMAIL".to_string(), + "bozo@bozo.net".to_string(), + ); + opts } #[test] #[should_panic] fn err_empty_env() { - std::env::remove_var("DIPLONAT_CONSUL_NODE_NAME"); - ConfigOpts::from_env().unwrap(); + std::env::remove_var("DIPLONAT_CONSUL_NODE_NAME"); + ConfigOpts::from_env().unwrap(); } #[test] fn ok_from_iter_minimal_valid_options() { - let opts = minimal_valid_options(); - let rt_config = ConfigOpts::from_iter(opts.clone()).unwrap(); + let opts = minimal_valid_options(); + let rt_config = ConfigOpts::from_iter(opts.clone()).unwrap(); - assert!(rt_config.acme.is_none()); - assert_eq!( - &rt_config.consul.node_name, - opts.get(&"DIPLONAT_CONSUL_NODE_NAME".to_string()).unwrap() - ); - assert_eq!(rt_config.consul.url, CONSUL_URL.to_string()); - assert_eq!( - rt_config.firewall.refresh_time, - Duration::from_secs(REFRESH_TIME.into()) - ); - assert!(rt_config.igd.private_ip.is_none()); - assert_eq!( - rt_config.igd.expiration_time, - Duration::from_secs(EXPIRATION_TIME.into()) - ); - assert_eq!( - rt_config.igd.refresh_time, - Duration::from_secs(REFRESH_TIME.into()) - ); + assert!(rt_config.acme.is_none()); + assert_eq!( + &rt_config.consul.node_name, + opts.get(&"DIPLONAT_CONSUL_NODE_NAME".to_string()).unwrap() + ); + assert_eq!(rt_config.consul.url, CONSUL_URL.to_string()); + assert_eq!( + rt_config.firewall.refresh_time, + Duration::from_secs(REFRESH_TIME.into()) + ); + assert!(rt_config.igd.private_ip.is_none()); + assert_eq!( + rt_config.igd.expiration_time, + Duration::from_secs(EXPIRATION_TIME.into()) + ); + assert_eq!( + rt_config.igd.refresh_time, + Duration::from_secs(REFRESH_TIME.into()) + ); } #[test] #[should_panic] fn err_from_iter_invalid_refresh_time() { - let mut opts = minimal_valid_options(); - opts.insert("DIPLONAT_EXPIRATION_TIME".to_string(), "60".to_string()); - opts.insert("DIPLONAT_REFRESH_TIME".to_string(), "60".to_string()); - ConfigOpts::from_iter(opts).unwrap(); + let mut opts = minimal_valid_options(); + opts.insert("DIPLONAT_EXPIRATION_TIME".to_string(), "60".to_string()); + opts.insert("DIPLONAT_REFRESH_TIME".to_string(), "60".to_string()); + ConfigOpts::from_iter(opts).unwrap(); } #[test] fn ok_from_iter_all_valid_options() { - let opts = all_valid_options(); - let rt_config = ConfigOpts::from_iter(opts.clone()).unwrap(); + let opts = all_valid_options(); + let rt_config = ConfigOpts::from_iter(opts.clone()).unwrap(); - let expiration_time = Duration::from_secs( - opts - .get(&"DIPLONAT_EXPIRATION_TIME".to_string()) - .unwrap() - .parse::() - .unwrap() - .into(), - ); - let refresh_time = Duration::from_secs( - opts - .get(&"DIPLONAT_REFRESH_TIME".to_string()) - .unwrap() - .parse::() - .unwrap() - .into(), - ); + let expiration_time = Duration::from_secs( + opts.get(&"DIPLONAT_EXPIRATION_TIME".to_string()) + .unwrap() + .parse::() + .unwrap() + .into(), + ); + let refresh_time = Duration::from_secs( + opts.get(&"DIPLONAT_REFRESH_TIME".to_string()) + .unwrap() + .parse::() + .unwrap() + .into(), + ); - assert!(rt_config.acme.is_some()); - assert_eq!( - &rt_config.acme.unwrap().email, - opts.get(&"DIPLONAT_ACME_EMAIL".to_string()).unwrap() - ); - assert_eq!( - &rt_config.consul.node_name, - opts.get(&"DIPLONAT_CONSUL_NODE_NAME".to_string()).unwrap() - ); - assert_eq!( - &rt_config.consul.url, - opts.get(&"DIPLONAT_CONSUL_URL".to_string()).unwrap() - ); - assert_eq!(rt_config.firewall.refresh_time, refresh_time); - assert_eq!( - &rt_config.igd.private_ip.unwrap(), - opts.get(&"DIPLONAT_PRIVATE_IP".to_string()).unwrap() - ); - assert_eq!(rt_config.igd.expiration_time, expiration_time); - assert_eq!(rt_config.igd.refresh_time, refresh_time); + assert!(rt_config.acme.is_some()); + assert_eq!( + &rt_config.acme.unwrap().email, + opts.get(&"DIPLONAT_ACME_EMAIL".to_string()).unwrap() + ); + assert_eq!( + &rt_config.consul.node_name, + opts.get(&"DIPLONAT_CONSUL_NODE_NAME".to_string()).unwrap() + ); + assert_eq!( + &rt_config.consul.url, + opts.get(&"DIPLONAT_CONSUL_URL".to_string()).unwrap() + ); + assert_eq!(rt_config.firewall.refresh_time, refresh_time); + assert_eq!( + &rt_config.igd.private_ip.unwrap(), + opts.get(&"DIPLONAT_PRIVATE_IP".to_string()).unwrap() + ); + assert_eq!(rt_config.igd.expiration_time, expiration_time); + assert_eq!(rt_config.igd.refresh_time, refresh_time); } diff --git a/src/config/runtime.rs b/src/config/runtime.rs index f2d2a12..bffea52 100644 --- a/src/config/runtime.rs +++ b/src/config/runtime.rs @@ -14,179 +14,182 @@ use crate::config::{ConfigOpts, ConfigOptsAcme, ConfigOptsBase, ConfigOptsConsul #[derive(Debug)] pub struct RuntimeConfigAcme { - pub email: String, + pub email: String, } #[derive(Debug)] pub struct RuntimeConfigConsul { - pub node_name: String, - pub url: String, - pub tls: Option<(Option, bool, reqwest::Identity)>, + pub node_name: String, + pub url: String, + pub tls: Option<(Option, bool, reqwest::Identity)>, } #[derive(Debug)] pub struct RuntimeConfigFirewall { - pub refresh_time: Duration, + pub refresh_time: Duration, } #[derive(Debug)] pub struct RuntimeConfigIgd { - pub private_ip: Option, - pub expiration_time: Duration, - pub refresh_time: Duration, + pub private_ip: Option, + pub expiration_time: Duration, + pub refresh_time: Duration, } #[derive(Debug)] pub struct RuntimeConfigStun { - pub stun_server_v4: SocketAddr, - pub stun_server_v6: SocketAddr, - pub refresh_time: Duration, + pub stun_server_v4: SocketAddr, + pub stun_server_v6: SocketAddr, + pub refresh_time: Duration, } #[derive(Debug)] pub struct RuntimeConfig { - pub acme: Option, - pub consul: RuntimeConfigConsul, - pub firewall: RuntimeConfigFirewall, - pub igd: RuntimeConfigIgd, - pub stun: RuntimeConfigStun, + pub acme: Option, + pub consul: RuntimeConfigConsul, + pub firewall: RuntimeConfigFirewall, + pub igd: RuntimeConfigIgd, + pub stun: RuntimeConfigStun, } impl RuntimeConfig { - pub fn new(opts: ConfigOpts) -> Result { - let acme = RuntimeConfigAcme::new(opts.acme)?; - let consul = RuntimeConfigConsul::new(opts.consul)?; - let firewall = RuntimeConfigFirewall::new(&opts.base)?; - let igd = RuntimeConfigIgd::new(&opts.base)?; - let stun = RuntimeConfigStun::new(&opts.base)?; + pub fn new(opts: ConfigOpts) -> Result { + let acme = RuntimeConfigAcme::new(opts.acme)?; + let consul = RuntimeConfigConsul::new(opts.consul)?; + let firewall = RuntimeConfigFirewall::new(&opts.base)?; + let igd = RuntimeConfigIgd::new(&opts.base)?; + let stun = RuntimeConfigStun::new(&opts.base)?; - Ok(Self { - acme, - consul, - firewall, - igd, - stun, - }) - } + Ok(Self { + acme, + consul, + firewall, + igd, + stun, + }) + } } impl RuntimeConfigAcme { - pub fn new(opts: ConfigOptsAcme) -> Result> { - if !opts.enable { - return Ok(None); - } + pub fn new(opts: ConfigOptsAcme) -> Result> { + if !opts.enable { + return Ok(None); + } - let email = opts.email.expect( + let email = opts.email.expect( "'DIPLONAT_ACME_EMAIL' environment variable is required if 'DIPLONAT_ACME_ENABLE' == 'true'", ); - Ok(Some(Self { email })) - } + Ok(Some(Self { email })) + } } impl RuntimeConfigConsul { - pub(super) fn new(opts: ConfigOptsConsul) -> Result { - let node_name = opts - .node_name - .expect("'DIPLONAT_CONSUL_NODE_NAME' environment variable is required"); - let url = opts.url.unwrap_or(super::CONSUL_URL.to_string()); + pub(super) fn new(opts: ConfigOptsConsul) -> Result { + let node_name = opts + .node_name + .expect("'DIPLONAT_CONSUL_NODE_NAME' environment variable is required"); + let url = opts.url.unwrap_or(super::CONSUL_URL.to_string()); - let tls = match (&opts.client_cert, &opts.client_key) { - (Some(client_cert), Some(client_key)) => { - let cert = match &opts.ca_cert { - Some(ca_cert) => { - let mut ca_cert_buf = vec![]; - File::open(ca_cert)?.read_to_end(&mut ca_cert_buf)?; - Some(reqwest::Certificate::from_pem(&ca_cert_buf[..])?) - } - None => None, + let tls = match (&opts.client_cert, &opts.client_key) { + (Some(client_cert), Some(client_key)) => { + let cert = match &opts.ca_cert { + Some(ca_cert) => { + let mut ca_cert_buf = vec![]; + File::open(ca_cert)?.read_to_end(&mut ca_cert_buf)?; + Some(reqwest::Certificate::from_pem(&ca_cert_buf[..])?) + } + None => None, + }; + + let mut client_cert_buf = vec![]; + File::open(client_cert)?.read_to_end(&mut client_cert_buf)?; + + let mut client_key_buf = vec![]; + File::open(client_key)?.read_to_end(&mut client_key_buf)?; + + let ident = reqwest::Identity::from_pem( + &[&client_cert_buf[..], &client_key_buf[..]].concat()[..], + )?; + + Some((cert, opts.tls_skip_verify, ident)) + } + (None, None) => None, + _ => bail!("Incomplete TLS configuration parameters"), }; - let mut client_cert_buf = vec![]; - File::open(client_cert)?.read_to_end(&mut client_cert_buf)?; - - let mut client_key_buf = vec![]; - File::open(client_key)?.read_to_end(&mut client_key_buf)?; - - let ident = - reqwest::Identity::from_pem(&[&client_cert_buf[..], &client_key_buf[..]].concat()[..])?; - - Some((cert, opts.tls_skip_verify, ident)) - } - (None, None) => None, - _ => bail!("Incomplete TLS configuration parameters"), - }; - - Ok(Self { - node_name, - url, - tls, - }) - } + Ok(Self { + node_name, + url, + tls, + }) + } } impl RuntimeConfigFirewall { - pub(super) fn new(opts: &ConfigOptsBase) -> Result { - let refresh_time = Duration::from_secs(opts.refresh_time.unwrap_or(super::REFRESH_TIME).into()); + pub(super) fn new(opts: &ConfigOptsBase) -> Result { + let refresh_time = + Duration::from_secs(opts.refresh_time.unwrap_or(super::REFRESH_TIME).into()); - Ok(Self { refresh_time }) - } + Ok(Self { refresh_time }) + } } impl RuntimeConfigIgd { - pub(super) fn new(opts: &ConfigOptsBase) -> Result { - let private_ip = opts.private_ip.clone(); - let expiration_time = Duration::from_secs( - opts - .expiration_time - .unwrap_or(super::EXPIRATION_TIME) - .into(), - ); - let refresh_time = Duration::from_secs(opts.refresh_time.unwrap_or(super::REFRESH_TIME).into()); + pub(super) fn new(opts: &ConfigOptsBase) -> Result { + let private_ip = opts.private_ip.clone(); + let expiration_time = Duration::from_secs( + opts.expiration_time + .unwrap_or(super::EXPIRATION_TIME) + .into(), + ); + let refresh_time = + Duration::from_secs(opts.refresh_time.unwrap_or(super::REFRESH_TIME).into()); - if refresh_time.as_secs() * 2 > expiration_time.as_secs() { - return Err(anyhow!( + if refresh_time.as_secs() * 2 > expiration_time.as_secs() { + return Err(anyhow!( "IGD expiration time (currently: {}s) must be at least twice bigger than refresh time \ (currently: {}s)", expiration_time.as_secs(), refresh_time.as_secs() )); - } + } - Ok(Self { - private_ip, - expiration_time, - refresh_time, - }) - } + Ok(Self { + private_ip, + expiration_time, + refresh_time, + }) + } } impl RuntimeConfigStun { - pub(super) fn new(opts: &ConfigOptsBase) -> Result { - let mut stun_server_v4 = None; - let mut stun_server_v6 = None; - for addr in opts - .stun_server - .as_deref() - .unwrap_or(super::STUN_SERVER) - .to_socket_addrs()? - { - if addr.is_ipv4() { - stun_server_v4 = Some(addr); - } - if addr.is_ipv6() { - stun_server_v6 = Some(addr); - } + pub(super) fn new(opts: &ConfigOptsBase) -> Result { + let mut stun_server_v4 = None; + let mut stun_server_v6 = None; + for addr in opts + .stun_server + .as_deref() + .unwrap_or(super::STUN_SERVER) + .to_socket_addrs()? + { + if addr.is_ipv4() { + stun_server_v4 = Some(addr); + } + if addr.is_ipv6() { + stun_server_v6 = Some(addr); + } + } + + let refresh_time = + Duration::from_secs(opts.refresh_time.unwrap_or(super::REFRESH_TIME).into()); + + Ok(Self { + stun_server_v4: stun_server_v4 + .ok_or(anyhow!("Unable to resolve STUN server's IPv4 address"))?, + stun_server_v6: stun_server_v6 + .ok_or(anyhow!("Unable to resolve STUN server's IPv6 address"))?, + refresh_time, + }) } - - let refresh_time = Duration::from_secs(opts.refresh_time.unwrap_or(super::REFRESH_TIME).into()); - - Ok(Self { - stun_server_v4: stun_server_v4 - .ok_or(anyhow!("Unable to resolve STUN server's IPv4 address"))?, - stun_server_v6: stun_server_v6 - .ok_or(anyhow!("Unable to resolve STUN server's IPv6 address"))?, - refresh_time, - }) - } } diff --git a/src/consul.rs b/src/consul.rs index e31033c..7f695b2 100644 --- a/src/consul.rs +++ b/src/consul.rs @@ -7,80 +7,80 @@ use crate::config::RuntimeConfigConsul; #[derive(Serialize, Deserialize, Debug)] pub struct ServiceEntry { - #[serde(rename = "Tags")] - pub tags: Vec, + #[serde(rename = "Tags")] + pub tags: Vec, } #[derive(Serialize, Deserialize, Debug, Default)] pub struct CatalogNode { - #[serde(rename = "Services")] - pub services: HashMap, + #[serde(rename = "Services")] + pub services: HashMap, } pub struct Consul { - client: reqwest::Client, - url: String, - idx: Option, + client: reqwest::Client, + url: String, + idx: Option, } impl Consul { - pub fn new(config: &RuntimeConfigConsul) -> Self { - let client = if let Some((ca, skip_verify, ident)) = config.tls.clone() { - if skip_verify { - reqwest::Client::builder() - .use_rustls_tls() - .danger_accept_invalid_certs(true) - .identity(ident) - .build() - .expect("Unable to build reqwest client") - } else if let Some(ca) = ca { - reqwest::Client::builder() - .use_rustls_tls() - .add_root_certificate(ca) - .identity(ident) - .build() - .expect("Unable to build reqwest client") - } else { - reqwest::Client::builder() - .use_rustls_tls() - .identity(ident) - .build() - .expect("Unable to build reqwest client") - } - } else { - reqwest::Client::new() - }; - return Self { - client, - url: config.url.clone(), - idx: None, - }; - } + pub fn new(config: &RuntimeConfigConsul) -> Self { + let client = if let Some((ca, skip_verify, ident)) = config.tls.clone() { + if skip_verify { + reqwest::Client::builder() + .use_rustls_tls() + .danger_accept_invalid_certs(true) + .identity(ident) + .build() + .expect("Unable to build reqwest client") + } else if let Some(ca) = ca { + reqwest::Client::builder() + .use_rustls_tls() + .add_root_certificate(ca) + .identity(ident) + .build() + .expect("Unable to build reqwest client") + } else { + reqwest::Client::builder() + .use_rustls_tls() + .identity(ident) + .build() + .expect("Unable to build reqwest client") + } + } else { + reqwest::Client::new() + }; + return Self { + client, + url: config.url.clone(), + idx: None, + }; + } - pub fn watch_node_reset(&mut self) -> () { - self.idx = None; - } + pub fn watch_node_reset(&mut self) -> () { + self.idx = None; + } - pub async fn watch_node(&mut self, host: &str) -> Result { - let url = match self.idx { - Some(i) => format!("{}/v1/catalog/node/{}?index={}", self.url, host, i), - None => format!("{}/v1/catalog/node/{}", self.url, host), - }; + pub async fn watch_node(&mut self, host: &str) -> Result { + let url = match self.idx { + Some(i) => format!("{}/v1/catalog/node/{}?index={}", self.url, host, i), + None => format!("{}/v1/catalog/node/{}", self.url, host), + }; - let http = self.client.get(&url).send().await?; - self.idx = match http.headers().get("X-Consul-Index") { - Some(v) => Some(v.to_str()?.parse::()?), - None => return Err(anyhow!("X-Consul-Index header not found")), - }; + let http = self.client.get(&url).send().await?; + self.idx = match http.headers().get("X-Consul-Index") { + Some(v) => Some(v.to_str()?.parse::()?), + None => return Err(anyhow!("X-Consul-Index header not found")), + }; - let resp: Option = http.json().await?; - return Ok(resp.unwrap_or_default()); - } + let resp: Option = http.json().await?; + return Ok(resp.unwrap_or_default()); + } - pub async fn kv_put(&self, key: &str, bytes: Vec) -> Result<()> { - let url = format!("{}/v1/kv/{}", self.url, key); - let http = self.client.put(&url).body(bytes).send().await?; - http.error_for_status()?; - Ok(()) - } + pub async fn kv_put(&self, key: &str, bytes: Vec) -> Result<()> { + let url = format!("{}/v1/kv/{}", self.url, key); + let http = self.client.put(&url).body(bytes).send().await?; + http.error_for_status()?; + Ok(()) + } } diff --git a/src/consul_actor.rs b/src/consul_actor.rs index e4296e7..c099215 100644 --- a/src/consul_actor.rs +++ b/src/consul_actor.rs @@ -11,110 +11,110 @@ use crate::{consul, messages}; #[derive(Serialize, Deserialize, Debug)] pub enum DiplonatParameter { - #[serde(rename = "tcp_port")] - TcpPort(HashSet), - #[serde(rename = "udp_port")] - UdpPort(HashSet), + #[serde(rename = "tcp_port")] + TcpPort(HashSet), + #[serde(rename = "udp_port")] + UdpPort(HashSet), } #[derive(Serialize, Deserialize, Debug)] pub enum DiplonatConsul { - #[serde(rename = "diplonat")] - Diplonat(Vec), + #[serde(rename = "diplonat")] + Diplonat(Vec), } pub struct ConsulActor { - pub rx_open_ports: watch::Receiver, + pub rx_open_ports: watch::Receiver, - consul: consul::Consul, - node: String, - retries: u32, - tx_open_ports: watch::Sender, + consul: consul::Consul, + node: String, + retries: u32, + tx_open_ports: watch::Sender, } fn retry_to_time(retries: u32, max_time: Duration) -> Duration { - // 1.2^x seems to be a good value to exponentially increase time at a good pace - // eg. 1.2^32 = 341 seconds ~= 5 minutes - ie. after 32 retries we wait 5 - // minutes - return Duration::from_secs(cmp::min( - max_time.as_secs(), - 1.2f64.powf(retries as f64) as u64, - )); + // 1.2^x seems to be a good value to exponentially increase time at a good pace + // eg. 1.2^32 = 341 seconds ~= 5 minutes - ie. after 32 retries we wait 5 + // minutes + return Duration::from_secs(cmp::min( + max_time.as_secs(), + 1.2f64.powf(retries as f64) as u64, + )); } fn to_parameters(catalog: &consul::CatalogNode) -> Vec { - let mut r = Vec::new(); + let mut r = Vec::new(); - for (_, service_info) in &catalog.services { - for tag in &service_info.tags { - let diplo_conf: error::Result = from_str(tag); - match diplo_conf { - Ok(conf) => r.push(conf), - Err(e) => debug!("Failed to parse entry {}. {}", tag, e), - }; + for (_, service_info) in &catalog.services { + for tag in &service_info.tags { + let diplo_conf: error::Result = from_str(tag); + match diplo_conf { + Ok(conf) => r.push(conf), + Err(e) => debug!("Failed to parse entry {}. {}", tag, e), + }; + } } - } - return r; + return r; } fn to_open_ports(params: &Vec) -> messages::PublicExposedPorts { - let mut op = messages::PublicExposedPorts { - tcp_ports: HashSet::new(), - udp_ports: HashSet::new(), - }; + let mut op = messages::PublicExposedPorts { + tcp_ports: HashSet::new(), + udp_ports: HashSet::new(), + }; - for conf in params { - let DiplonatConsul::Diplonat(c) = conf; - for parameter in c { - match parameter { - DiplonatParameter::TcpPort(p) => op.tcp_ports.extend(p), - DiplonatParameter::UdpPort(p) => op.udp_ports.extend(p), - }; + for conf in params { + let DiplonatConsul::Diplonat(c) = conf; + for parameter in c { + match parameter { + DiplonatParameter::TcpPort(p) => op.tcp_ports.extend(p), + DiplonatParameter::UdpPort(p) => op.udp_ports.extend(p), + }; + } } - } - return op; + return op; } impl ConsulActor { - pub fn new(config: &RuntimeConfigConsul, node: &str) -> Self { - let (tx, rx) = watch::channel(messages::PublicExposedPorts { - tcp_ports: HashSet::new(), - udp_ports: HashSet::new(), - }); + pub fn new(config: &RuntimeConfigConsul, node: &str) -> Self { + let (tx, rx) = watch::channel(messages::PublicExposedPorts { + tcp_ports: HashSet::new(), + udp_ports: HashSet::new(), + }); - return Self { - consul: consul::Consul::new(config), - rx_open_ports: rx, - tx_open_ports: tx, - node: node.to_string(), - retries: 0, - }; - } - - pub async fn listen(&mut self) -> Result<()> { - loop { - let catalog = match self.consul.watch_node(&self.node).await { - Ok(c) => c, - Err(e) => { - self.consul.watch_node_reset(); - self.retries = cmp::min(std::u32::MAX - 1, self.retries) + 1; - let will_retry_in = retry_to_time(self.retries, Duration::from_secs(600)); - error!( - "Failed to query consul. Will retry in {}s. {}", - will_retry_in.as_secs(), - e - ); - sleep(will_retry_in).await; - continue; - } - }; - self.retries = 0; - let msg = to_open_ports(&to_parameters(&catalog)); - debug!("Extracted configuration: {:#?}", msg); - - self.tx_open_ports.send(msg)?; + return Self { + consul: consul::Consul::new(config), + rx_open_ports: rx, + tx_open_ports: tx, + node: node.to_string(), + retries: 0, + }; + } + + pub async fn listen(&mut self) -> Result<()> { + loop { + let catalog = match self.consul.watch_node(&self.node).await { + Ok(c) => c, + Err(e) => { + self.consul.watch_node_reset(); + self.retries = cmp::min(std::u32::MAX - 1, self.retries) + 1; + let will_retry_in = retry_to_time(self.retries, Duration::from_secs(600)); + error!( + "Failed to query consul. Will retry in {}s. {}", + will_retry_in.as_secs(), + e + ); + sleep(will_retry_in).await; + continue; + } + }; + self.retries = 0; + let msg = to_open_ports(&to_parameters(&catalog)); + debug!("Extracted configuration: {:#?}", msg); + + self.tx_open_ports.send(msg)?; + } } - } } diff --git a/src/diplonat.rs b/src/diplonat.rs index 4252f43..604227c 100644 --- a/src/diplonat.rs +++ b/src/diplonat.rs @@ -2,54 +2,54 @@ use anyhow::Result; use tokio::try_join; use crate::{ - config::ConfigOpts, consul_actor::ConsulActor, fw_actor::FirewallActor, igd_actor::IgdActor, - stun_actor::StunActor, + config::ConfigOpts, consul_actor::ConsulActor, fw_actor::FirewallActor, igd_actor::IgdActor, + stun_actor::StunActor, }; pub struct Diplonat { - consul: ConsulActor, - firewall: FirewallActor, - igd: IgdActor, - stun: StunActor, + consul: ConsulActor, + firewall: FirewallActor, + igd: IgdActor, + stun: StunActor, } impl Diplonat { - pub async fn new() -> Result { - let rt_cfg = ConfigOpts::from_env()?; - println!("{:#?}", rt_cfg); + pub async fn new() -> Result { + let rt_cfg = ConfigOpts::from_env()?; + println!("{:#?}", rt_cfg); - let ca = ConsulActor::new(&rt_cfg.consul, &rt_cfg.consul.node_name); + let ca = ConsulActor::new(&rt_cfg.consul, &rt_cfg.consul.node_name); - let fw = FirewallActor::new(rt_cfg.firewall.refresh_time, &ca.rx_open_ports).await?; + let fw = FirewallActor::new(rt_cfg.firewall.refresh_time, &ca.rx_open_ports).await?; - let ia = IgdActor::new( - rt_cfg.igd.private_ip.as_ref().map(String::as_str), - rt_cfg.igd.refresh_time, - rt_cfg.igd.expiration_time, - &ca.rx_open_ports, - ) - .await?; + let ia = IgdActor::new( + rt_cfg.igd.private_ip.as_ref().map(String::as_str), + rt_cfg.igd.refresh_time, + rt_cfg.igd.expiration_time, + &ca.rx_open_ports, + ) + .await?; - let sa = StunActor::new(&rt_cfg.consul, &rt_cfg.stun, &rt_cfg.consul.node_name); + let sa = StunActor::new(&rt_cfg.consul, &rt_cfg.stun, &rt_cfg.consul.node_name); - let ctx = Self { - consul: ca, - igd: ia, - firewall: fw, - stun: sa, - }; + let ctx = Self { + consul: ca, + igd: ia, + firewall: fw, + stun: sa, + }; - Ok(ctx) - } + Ok(ctx) + } - pub async fn listen(&mut self) -> Result<()> { - try_join!( - self.consul.listen(), - self.igd.listen(), - self.firewall.listen(), - self.stun.listen(), - )?; + pub async fn listen(&mut self) -> Result<()> { + try_join!( + self.consul.listen(), + self.igd.listen(), + self.firewall.listen(), + self.stun.listen(), + )?; - Ok(()) - } + Ok(()) + } } diff --git a/src/fw.rs b/src/fw.rs index f416e6a..6745b3f 100644 --- a/src/fw.rs +++ b/src/fw.rs @@ -8,96 +8,89 @@ use regex::Regex; use crate::messages; pub fn setup(ipt: &iptables::IPTables) -> Result<()> { - // ensure we start from a clean state without any rule already set - cleanup(ipt)?; + // ensure we start from a clean state without any rule already set + cleanup(ipt)?; - info!("{}: creating DIPLONAT chain using", ipt.cmd); - ipt - .new_chain("filter", "DIPLONAT") - .context("Failed to create new chain")?; - ipt - .insert_unique("filter", "INPUT", "-j DIPLONAT", 1) - .context("Failed to insert jump rule")?; + info!("{}: creating DIPLONAT chain using", ipt.cmd); + ipt.new_chain("filter", "DIPLONAT") + .context("Failed to create new chain")?; + ipt.insert_unique("filter", "INPUT", "-j DIPLONAT", 1) + .context("Failed to insert jump rule")?; - Ok(()) + Ok(()) } pub fn open_ports(ipt: &iptables::IPTables, ports: messages::PublicExposedPorts) -> Result<()> { - for p in ports.tcp_ports { - info!("{}: opening TCP port {}", ipt.cmd, p); - ipt - .append( - "filter", - "DIPLONAT", - &format!("-p tcp --dport {} -j ACCEPT", p), - ) - .context("Failed to insert port rule")?; - } + for p in ports.tcp_ports { + info!("{}: opening TCP port {}", ipt.cmd, p); + ipt.append( + "filter", + "DIPLONAT", + &format!("-p tcp --dport {} -j ACCEPT", p), + ) + .context("Failed to insert port rule")?; + } - for p in ports.udp_ports { - info!("{}: opening UDP port {}", ipt.cmd, p); - ipt - .append( - "filter", - "DIPLONAT", - &format!("-p udp --dport {} -j ACCEPT", p), - ) - .context("Failed to insert port rule")?; - } + for p in ports.udp_ports { + info!("{}: opening UDP port {}", ipt.cmd, p); + ipt.append( + "filter", + "DIPLONAT", + &format!("-p udp --dport {} -j ACCEPT", p), + ) + .context("Failed to insert port rule")?; + } - Ok(()) + Ok(()) } pub fn get_opened_ports(ipt: &iptables::IPTables) -> Result { - let mut ports = messages::PublicExposedPorts { - tcp_ports: HashSet::new(), - udp_ports: HashSet::new(), - }; + let mut ports = messages::PublicExposedPorts { + tcp_ports: HashSet::new(), + udp_ports: HashSet::new(), + }; - let list = ipt.list("filter", "DIPLONAT")?; - let re = Regex::new(r"\-A.*? \-p (\w+).*\-\-dport (\d+).*?\-j ACCEPT") - .context("Regex matching open ports encountered an unexpected rule")?; - for i in list { - let caps = re.captures(&i); - match caps { - Some(c) => { - if let (Some(raw_proto), Some(raw_port)) = (c.get(1), c.get(2)) { - let proto = String::from(raw_proto.as_str()); - let number = String::from(raw_port.as_str()).parse::()?; + let list = ipt.list("filter", "DIPLONAT")?; + let re = Regex::new(r"\-A.*? \-p (\w+).*\-\-dport (\d+).*?\-j ACCEPT") + .context("Regex matching open ports encountered an unexpected rule")?; + for i in list { + let caps = re.captures(&i); + match caps { + Some(c) => { + if let (Some(raw_proto), Some(raw_port)) = (c.get(1), c.get(2)) { + let proto = String::from(raw_proto.as_str()); + let number = String::from(raw_port.as_str()).parse::()?; - if proto == "tcp" { - ports.tcp_ports.insert(number); - } else { - ports.udp_ports.insert(number); - } - } else { - error!("Unexpected rule found in DIPLONAT chain") + if proto == "tcp" { + ports.tcp_ports.insert(number); + } else { + ports.udp_ports.insert(number); + } + } else { + error!("Unexpected rule found in DIPLONAT chain") + } + } + _ => {} } - } - _ => {} } - } - Ok(ports) + Ok(ports) } pub fn cleanup(ipt: &iptables::IPTables) -> Result<()> { - if ipt.chain_exists("filter", "DIPLONAT")? { - info!("{}: removing old DIPLONAT chain", ipt.cmd); - ipt - .flush_chain("filter", "DIPLONAT") - .context("Failed to flush the DIPLONAT chain")?; + if ipt.chain_exists("filter", "DIPLONAT")? { + info!("{}: removing old DIPLONAT chain", ipt.cmd); + ipt.flush_chain("filter", "DIPLONAT") + .context("Failed to flush the DIPLONAT chain")?; - if ipt.exists("filter", "INPUT", "-j DIPLONAT")? { - ipt - .delete("filter", "INPUT", "-j DIPLONAT") - .context("Failed to delete jump rule")?; + if ipt.exists("filter", "INPUT", "-j DIPLONAT")? { + ipt.delete("filter", "INPUT", "-j DIPLONAT") + .context("Failed to delete jump rule")?; + } + + ipt.delete_chain("filter", "DIPLONAT") + .context("Failed to delete chain")?; } - ipt - .delete_chain("filter", "DIPLONAT") - .context("Failed to delete chain")?; - } - - Ok(()) + Ok(()) } diff --git a/src/fw_actor.rs b/src/fw_actor.rs index 518c1b8..fe68381 100644 --- a/src/fw_actor.rs +++ b/src/fw_actor.rs @@ -4,88 +4,88 @@ use anyhow::Result; use iptables; use log::*; use tokio::{ - select, - sync::watch, - time::{self, Duration}, + select, + sync::watch, + time::{self, Duration}, }; use crate::{fw, messages}; pub struct FirewallActor { - pub ipt_v4: iptables::IPTables, - pub ipt_v6: iptables::IPTables, - rx_ports: watch::Receiver, - last_ports: messages::PublicExposedPorts, - refresh: Duration, + pub ipt_v4: iptables::IPTables, + pub ipt_v6: iptables::IPTables, + rx_ports: watch::Receiver, + last_ports: messages::PublicExposedPorts, + refresh: Duration, } impl FirewallActor { - pub async fn new( - refresh: Duration, - rxp: &watch::Receiver, - ) -> Result { - let ctx = Self { - ipt_v4: iptables::new(false)?, - ipt_v6: iptables::new(true)?, - rx_ports: rxp.clone(), - last_ports: messages::PublicExposedPorts::new(), - refresh, - }; + pub async fn new( + refresh: Duration, + rxp: &watch::Receiver, + ) -> Result { + let ctx = Self { + ipt_v4: iptables::new(false)?, + ipt_v6: iptables::new(true)?, + rx_ports: rxp.clone(), + last_ports: messages::PublicExposedPorts::new(), + refresh, + }; - fw::setup(&ctx.ipt_v4)?; - fw::setup(&ctx.ipt_v6)?; + fw::setup(&ctx.ipt_v4)?; + fw::setup(&ctx.ipt_v6)?; - return Ok(ctx); - } - - pub async fn listen(&mut self) -> Result<()> { - let mut interval = time::interval(self.refresh); - loop { - // 1. Wait for an event - let new_ports = select! { - _ = self.rx_ports.changed() => Some(self.rx_ports.borrow().clone()), - _ = interval.tick() => None, - else => return Ok(()) // Sender dropped, terminate loop. - }; - - // 2. Update last ports if needed - if let Some(p) = new_ports { - self.last_ports = p; - } - - // 3. Update firewall rules - match self.do_fw_update().await { - Ok(()) => debug!("Successfully updated firewall rules"), - Err(e) => error!("An error occured while updating firewall rules. {}", e), - } - } - } - - pub async fn do_fw_update(&self) -> Result<()> { - for ipt in [&self.ipt_v4, &self.ipt_v6] { - let curr_opened_ports = fw::get_opened_ports(ipt)?; - - let diff_tcp = self - .last_ports - .tcp_ports - .difference(&curr_opened_ports.tcp_ports) - .copied() - .collect::>(); - let diff_udp = self - .last_ports - .udp_ports - .difference(&curr_opened_ports.udp_ports) - .copied() - .collect::>(); - - let ports_to_open = messages::PublicExposedPorts { - tcp_ports: diff_tcp, - udp_ports: diff_udp, - }; - - fw::open_ports(ipt, ports_to_open)?; + return Ok(ctx); } - return Ok(()); - } + pub async fn listen(&mut self) -> Result<()> { + let mut interval = time::interval(self.refresh); + loop { + // 1. Wait for an event + let new_ports = select! { + _ = self.rx_ports.changed() => Some(self.rx_ports.borrow().clone()), + _ = interval.tick() => None, + else => return Ok(()) // Sender dropped, terminate loop. + }; + + // 2. Update last ports if needed + if let Some(p) = new_ports { + self.last_ports = p; + } + + // 3. Update firewall rules + match self.do_fw_update().await { + Ok(()) => debug!("Successfully updated firewall rules"), + Err(e) => error!("An error occured while updating firewall rules. {}", e), + } + } + } + + pub async fn do_fw_update(&self) -> Result<()> { + for ipt in [&self.ipt_v4, &self.ipt_v6] { + let curr_opened_ports = fw::get_opened_ports(ipt)?; + + let diff_tcp = self + .last_ports + .tcp_ports + .difference(&curr_opened_ports.tcp_ports) + .copied() + .collect::>(); + let diff_udp = self + .last_ports + .udp_ports + .difference(&curr_opened_ports.udp_ports) + .copied() + .collect::>(); + + let ports_to_open = messages::PublicExposedPorts { + tcp_ports: diff_tcp, + udp_ports: diff_udp, + }; + + fw::open_ports(ipt, ports_to_open)?; + } + + return Ok(()); + } } diff --git a/src/igd_actor.rs b/src/igd_actor.rs index 68f4217..a75395d 100644 --- a/src/igd_actor.rs +++ b/src/igd_actor.rs @@ -4,124 +4,123 @@ use anyhow::{Context, Result}; use igd::{aio::*, PortMappingProtocol}; use log::*; use tokio::{ - select, - sync::watch, - time::{self, Duration}, + select, + sync::watch, + time::{self, Duration}, }; use crate::messages; pub struct IgdActor { - last_ports: messages::PublicExposedPorts, - rx_ports: watch::Receiver, - gateway: Gateway, - refresh: Duration, - expire: Duration, - private_ip: String, + last_ports: messages::PublicExposedPorts, + rx_ports: watch::Receiver, + gateway: Gateway, + refresh: Duration, + expire: Duration, + private_ip: String, } impl IgdActor { - pub async fn new( - priv_ip: Option<&str>, - refresh: Duration, - expire: Duration, - rxp: &watch::Receiver, - ) -> Result { - let gw = search_gateway(Default::default()) - .await - .context("Failed to find IGD gateway")?; - info!("IGD gateway: {}", gw); + pub async fn new( + priv_ip: Option<&str>, + refresh: Duration, + expire: Duration, + rxp: &watch::Receiver, + ) -> Result { + let gw = search_gateway(Default::default()) + .await + .context("Failed to find IGD gateway")?; + info!("IGD gateway: {}", gw); - let private_ip = if let Some(ip) = priv_ip { - info!("Using private IP from config: {}", ip); - ip.to_string() - } else { - info!("Trying to automatically detect private IP"); - let gwa = gw.addr.ip().octets(); - let cmplen = match gwa { - [192, 168, _, _] => 3, - [10, _, _, _] => 2, - _ => panic!( - "Gateway IP does not appear to be in a local network ({})", - gw.addr.ip() - ), - }; - #[allow(unused_parens)] - let public_ip = get_if_addrs::get_if_addrs()? - .into_iter() - .map(|i| i.addr.ip()) - .filter(|a| match a { - std::net::IpAddr::V4(a4) => (a4.octets()[..cmplen] == gwa[..cmplen]), - _ => false, - }) - .next() - .expect("No interface has an IP on same subnet as gateway") - .to_string(); - info!("Found private IP: {}", public_ip); - public_ip - }; + let private_ip = if let Some(ip) = priv_ip { + info!("Using private IP from config: {}", ip); + ip.to_string() + } else { + info!("Trying to automatically detect private IP"); + let gwa = gw.addr.ip().octets(); + let cmplen = match gwa { + [192, 168, _, _] => 3, + [10, _, _, _] => 2, + _ => panic!( + "Gateway IP does not appear to be in a local network ({})", + gw.addr.ip() + ), + }; + #[allow(unused_parens)] + let public_ip = get_if_addrs::get_if_addrs()? + .into_iter() + .map(|i| i.addr.ip()) + .filter(|a| match a { + std::net::IpAddr::V4(a4) => (a4.octets()[..cmplen] == gwa[..cmplen]), + _ => false, + }) + .next() + .expect("No interface has an IP on same subnet as gateway") + .to_string(); + info!("Found private IP: {}", public_ip); + public_ip + }; - let ctx = Self { - gateway: gw, - rx_ports: rxp.clone(), - private_ip, - refresh: refresh, - expire: expire, - last_ports: messages::PublicExposedPorts::new(), - }; + let ctx = Self { + gateway: gw, + rx_ports: rxp.clone(), + private_ip, + refresh: refresh, + expire: expire, + last_ports: messages::PublicExposedPorts::new(), + }; - return Ok(ctx); - } - - pub async fn listen(&mut self) -> Result<()> { - let mut interval = time::interval(self.refresh); - loop { - // 1. Wait for an event - let new_ports = select! { - _ = self.rx_ports.changed() => Some(self.rx_ports.borrow().clone()), - _ = interval.tick() => None, - else => return Ok(()) // Sender dropped, terminate loop. - }; - - // 2. Update last ports if needed - if let Some(p) = new_ports { - self.last_ports = p; - } - - // 3. Flush IGD requests - match self.do_igd().await { - Ok(()) => debug!("Successfully updated IGD"), - Err(e) => error!("An error occured while updating IGD. {}", e), - } - } - } - - pub async fn do_igd(&self) -> Result<()> { - let actions = [ - (PortMappingProtocol::TCP, &self.last_ports.tcp_ports), - (PortMappingProtocol::UDP, &self.last_ports.udp_ports), - ]; - - for (proto, list) in actions.iter() { - for port in *list { - let service_str = format!("{}:{}", self.private_ip, port); - let service = service_str - .parse::() - .context("Invalid socket address")?; - self - .gateway - .add_port( - *proto, - *port, - service, - self.expire.as_secs() as u32, - "diplonat", - ) - .await?; - debug!("IGD request successful for {:#?} {}", proto, service); - } + return Ok(ctx); } - return Ok(()); - } + pub async fn listen(&mut self) -> Result<()> { + let mut interval = time::interval(self.refresh); + loop { + // 1. Wait for an event + let new_ports = select! { + _ = self.rx_ports.changed() => Some(self.rx_ports.borrow().clone()), + _ = interval.tick() => None, + else => return Ok(()) // Sender dropped, terminate loop. + }; + + // 2. Update last ports if needed + if let Some(p) = new_ports { + self.last_ports = p; + } + + // 3. Flush IGD requests + match self.do_igd().await { + Ok(()) => debug!("Successfully updated IGD"), + Err(e) => error!("An error occured while updating IGD. {}", e), + } + } + } + + pub async fn do_igd(&self) -> Result<()> { + let actions = [ + (PortMappingProtocol::TCP, &self.last_ports.tcp_ports), + (PortMappingProtocol::UDP, &self.last_ports.udp_ports), + ]; + + for (proto, list) in actions.iter() { + for port in *list { + let service_str = format!("{}:{}", self.private_ip, port); + let service = service_str + .parse::() + .context("Invalid socket address")?; + self.gateway + .add_port( + *proto, + *port, + service, + self.expire.as_secs() as u32, + "diplonat", + ) + .await?; + debug!("IGD request successful for {:#?} {}", proto, service); + } + } + + return Ok(()); + } } diff --git a/src/main.rs b/src/main.rs index 4cd57c5..204520d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,13 +13,13 @@ use log::*; #[tokio::main] async fn main() { - pretty_env_logger::init(); - info!("Starting Diplonat"); + pretty_env_logger::init(); + info!("Starting Diplonat"); - Diplonat::new() - .await - .expect("Setup failed") - .listen() - .await - .expect("A runtime error occured"); + Diplonat::new() + .await + .expect("Setup failed") + .listen() + .await + .expect("A runtime error occured"); } diff --git a/src/messages.rs b/src/messages.rs index 63f16b0..e5322f1 100644 --- a/src/messages.rs +++ b/src/messages.rs @@ -2,15 +2,15 @@ use std::collections::HashSet; #[derive(Debug, Clone, PartialEq, Eq)] pub struct PublicExposedPorts { - pub tcp_ports: HashSet, - pub udp_ports: HashSet, + pub tcp_ports: HashSet, + pub udp_ports: HashSet, } impl PublicExposedPorts { - pub fn new() -> Self { - return Self { - tcp_ports: HashSet::new(), - udp_ports: HashSet::new(), - }; - } + pub fn new() -> Self { + return Self { + tcp_ports: HashSet::new(), + udp_ports: HashSet::new(), + }; + } } diff --git a/src/stun_actor.rs b/src/stun_actor.rs index c1e10ef..684d3d8 100644 --- a/src/stun_actor.rs +++ b/src/stun_actor.rs @@ -9,96 +9,95 @@ use crate::config::{RuntimeConfigConsul, RuntimeConfigStun}; use crate::consul; pub struct StunActor { - node: String, - consul: consul::Consul, - stun_server_v4: SocketAddr, - stun_server_v6: SocketAddr, - refresh_time: Duration, + node: String, + consul: consul::Consul, + stun_server_v4: SocketAddr, + stun_server_v6: SocketAddr, + refresh_time: Duration, } #[derive(Serialize, Deserialize, Debug)] pub struct AutodiscoverResult { - pub timestamp: u64, - pub address: IpAddr, + pub timestamp: u64, + pub address: IpAddr, } impl StunActor { - pub fn new( - consul_config: &RuntimeConfigConsul, - stun_config: &RuntimeConfigStun, - node: &str, - ) -> Self { - assert!(stun_config.stun_server_v4.is_ipv4()); - assert!(stun_config.stun_server_v6.is_ipv6()); + pub fn new( + consul_config: &RuntimeConfigConsul, + stun_config: &RuntimeConfigStun, + node: &str, + ) -> Self { + assert!(stun_config.stun_server_v4.is_ipv4()); + assert!(stun_config.stun_server_v6.is_ipv6()); - Self { - consul: consul::Consul::new(consul_config), - node: node.to_string(), - stun_server_v4: stun_config.stun_server_v4, - stun_server_v6: stun_config.stun_server_v6, - refresh_time: stun_config.refresh_time, + Self { + consul: consul::Consul::new(consul_config), + node: node.to_string(), + stun_server_v4: stun_config.stun_server_v4, + stun_server_v6: stun_config.stun_server_v6, + refresh_time: stun_config.refresh_time, + } } - } - pub async fn listen(&mut self) -> Result<()> { - loop { - if let Err(e) = self.autodiscover_ip(self.stun_server_v4).await { - error!("Unable to autodiscover IPv4 address: {}", e); - } - if let Err(e) = self.autodiscover_ip(self.stun_server_v6).await { - error!("Unable to autodiscover IPv6 address: {}", e); - } - tokio::time::sleep(self.refresh_time).await; + pub async fn listen(&mut self) -> Result<()> { + loop { + if let Err(e) = self.autodiscover_ip(self.stun_server_v4).await { + error!("Unable to autodiscover IPv4 address: {}", e); + } + if let Err(e) = self.autodiscover_ip(self.stun_server_v6).await { + error!("Unable to autodiscover IPv6 address: {}", e); + } + tokio::time::sleep(self.refresh_time).await; + } } - } - async fn autodiscover_ip(&self, stun_server: SocketAddr) -> Result<()> { - let binding_addr = match stun_server.is_ipv4() { - true => "0.0.0.0:34791".parse().unwrap(), - false => "[::]:34792".parse().unwrap(), - }; + async fn autodiscover_ip(&self, stun_server: SocketAddr) -> Result<()> { + let binding_addr = match stun_server.is_ipv4() { + true => "0.0.0.0:34791".parse().unwrap(), + false => "[::]:34792".parse().unwrap(), + }; - let discovered_addr = get_mapped_addr(stun_server, binding_addr).await?.ip(); + let discovered_addr = get_mapped_addr(stun_server, binding_addr).await?.ip(); - let consul_key = match stun_server.is_ipv4() { - true => { - debug!("Autodiscovered IPv4: {}", discovered_addr); - format!("diplonat/autodiscovery/ipv4/{}", self.node) - } - false => { - debug!("Autodiscovered IPv6: {}", discovered_addr); - format!("diplonat/autodiscovery/ipv6/{}", self.node) - } - }; + let consul_key = match stun_server.is_ipv4() { + true => { + debug!("Autodiscovered IPv4: {}", discovered_addr); + format!("diplonat/autodiscovery/ipv4/{}", self.node) + } + false => { + debug!("Autodiscovered IPv6: {}", discovered_addr); + format!("diplonat/autodiscovery/ipv6/{}", self.node) + } + }; - self - .consul - .kv_put( - &consul_key, - serde_json::to_vec(&AutodiscoverResult { - timestamp: SystemTime::now() - .duration_since(SystemTime::UNIX_EPOCH)? - .as_secs(), - address: discovered_addr, - })?, - ) - .await?; + self.consul + .kv_put( + &consul_key, + serde_json::to_vec(&AutodiscoverResult { + timestamp: SystemTime::now() + .duration_since(SystemTime::UNIX_EPOCH)? + .as_secs(), + address: discovered_addr, + })?, + ) + .await?; - Ok(()) - } + Ok(()) + } } async fn get_mapped_addr(stun_server: SocketAddr, binding_addr: SocketAddr) -> Result { - use stun_client::*; + use stun_client::*; - let mut client = Client::new(binding_addr, None).await.unwrap(); - let res = client.binding_request(stun_server, None).await.unwrap(); + let mut client = Client::new(binding_addr, None).await.unwrap(); + let res = client.binding_request(stun_server, None).await.unwrap(); - if res.get_class() != Class::SuccessResponse { - bail!("STUN server did not responde with a success response"); - } + if res.get_class() != Class::SuccessResponse { + bail!("STUN server did not responde with a success response"); + } - let xor_mapped_addr = Attribute::get_xor_mapped_address(&res) - .ok_or(anyhow!("no XorMappedAddress found in STUN response"))?; - Ok(xor_mapped_addr) + let xor_mapped_addr = Attribute::get_xor_mapped_address(&res) + .ok_or(anyhow!("no XorMappedAddress found in STUN response"))?; + Ok(xor_mapped_addr) } From f410230240b270ec01cfbf0002cbe9d3849eb03b Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Tue, 4 Apr 2023 19:06:33 +0200 Subject: [PATCH 04/10] parse private_ip earlier --- src/config/options_test.rs | 4 ++-- src/config/runtime.rs | 13 +++++++++---- src/diplonat.rs | 2 +- src/fw.rs | 2 +- src/igd_actor.rs | 28 ++++++++++++---------------- 5 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/config/options_test.rs b/src/config/options_test.rs index 655fb01..8e05c90 100644 --- a/src/config/options_test.rs +++ b/src/config/options_test.rs @@ -26,7 +26,7 @@ fn all_valid_options() -> HashMap { ); opts.insert( "DIPLONAT_PRIVATE_IP".to_string(), - "172.123.43.555".to_string(), + "172.123.43.55".to_string(), ); opts.insert("DIPLONAT_REFRESH_TIME".to_string(), "10".to_string()); opts.insert( @@ -118,7 +118,7 @@ fn ok_from_iter_all_valid_options() { ); assert_eq!(rt_config.firewall.refresh_time, refresh_time); assert_eq!( - &rt_config.igd.private_ip.unwrap(), + &rt_config.igd.private_ip.unwrap().to_string(), opts.get(&"DIPLONAT_PRIVATE_IP".to_string()).unwrap() ); assert_eq!(rt_config.igd.expiration_time, expiration_time); diff --git a/src/config/runtime.rs b/src/config/runtime.rs index bffea52..45a29c3 100644 --- a/src/config/runtime.rs +++ b/src/config/runtime.rs @@ -1,9 +1,9 @@ use std::fs::File; use std::io::Read; -use std::net::{SocketAddr, ToSocketAddrs}; +use std::net::{Ipv4Addr, SocketAddr, ToSocketAddrs}; use std::time::Duration; -use anyhow::{anyhow, bail, Result}; +use anyhow::{anyhow, bail, Context, Result}; use crate::config::{ConfigOpts, ConfigOptsAcme, ConfigOptsBase, ConfigOptsConsul}; @@ -31,7 +31,7 @@ pub struct RuntimeConfigFirewall { #[derive(Debug)] pub struct RuntimeConfigIgd { - pub private_ip: Option, + pub private_ip: Option, pub expiration_time: Duration, pub refresh_time: Duration, } @@ -137,7 +137,12 @@ impl RuntimeConfigFirewall { impl RuntimeConfigIgd { pub(super) fn new(opts: &ConfigOptsBase) -> Result { - let private_ip = opts.private_ip.clone(); + let private_ip = opts + .private_ip + .as_ref() + .map(|x| x.parse()) + .transpose() + .context("parse private_ip")?; let expiration_time = Duration::from_secs( opts.expiration_time .unwrap_or(super::EXPIRATION_TIME) diff --git a/src/diplonat.rs b/src/diplonat.rs index 604227c..a66836a 100644 --- a/src/diplonat.rs +++ b/src/diplonat.rs @@ -23,7 +23,7 @@ impl Diplonat { let fw = FirewallActor::new(rt_cfg.firewall.refresh_time, &ca.rx_open_ports).await?; let ia = IgdActor::new( - rt_cfg.igd.private_ip.as_ref().map(String::as_str), + rt_cfg.igd.private_ip, rt_cfg.igd.refresh_time, rt_cfg.igd.expiration_time, &ca.rx_open_ports, diff --git a/src/fw.rs b/src/fw.rs index 6745b3f..88aaa86 100644 --- a/src/fw.rs +++ b/src/fw.rs @@ -11,7 +11,7 @@ pub fn setup(ipt: &iptables::IPTables) -> Result<()> { // ensure we start from a clean state without any rule already set cleanup(ipt)?; - info!("{}: creating DIPLONAT chain using", ipt.cmd); + info!("{}: creating DIPLONAT chain", ipt.cmd); ipt.new_chain("filter", "DIPLONAT") .context("Failed to create new chain")?; ipt.insert_unique("filter", "INPUT", "-j DIPLONAT", 1) diff --git a/src/igd_actor.rs b/src/igd_actor.rs index a75395d..f0dd391 100644 --- a/src/igd_actor.rs +++ b/src/igd_actor.rs @@ -1,4 +1,4 @@ -use std::net::SocketAddrV4; +use std::net::{Ipv4Addr, SocketAddrV4}; use anyhow::{Context, Result}; use igd::{aio::*, PortMappingProtocol}; @@ -17,12 +17,12 @@ pub struct IgdActor { gateway: Gateway, refresh: Duration, expire: Duration, - private_ip: String, + private_ip: Ipv4Addr, } impl IgdActor { pub async fn new( - priv_ip: Option<&str>, + priv_ip: Option, refresh: Duration, expire: Duration, rxp: &watch::Receiver, @@ -34,7 +34,7 @@ impl IgdActor { let private_ip = if let Some(ip) = priv_ip { info!("Using private IP from config: {}", ip); - ip.to_string() + ip } else { info!("Trying to automatically detect private IP"); let gwa = gw.addr.ip().octets(); @@ -47,18 +47,17 @@ impl IgdActor { ), }; #[allow(unused_parens)] - let public_ip = get_if_addrs::get_if_addrs()? + let private_ip = get_if_addrs::get_if_addrs()? .into_iter() .map(|i| i.addr.ip()) - .filter(|a| match a { - std::net::IpAddr::V4(a4) => (a4.octets()[..cmplen] == gwa[..cmplen]), - _ => false, + .filter_map(|a| match a { + std::net::IpAddr::V4(a4) if a4.octets()[..cmplen] == gwa[..cmplen] => Some(a4), + _ => None, }) .next() - .expect("No interface has an IP on same subnet as gateway") - .to_string(); - info!("Found private IP: {}", public_ip); - public_ip + .expect("No interface has an IP on same subnet as gateway"); + info!("Autodetected private IP: {}", private_ip); + private_ip }; let ctx = Self { @@ -104,10 +103,7 @@ impl IgdActor { for (proto, list) in actions.iter() { for port in *list { - let service_str = format!("{}:{}", self.private_ip, port); - let service = service_str - .parse::() - .context("Invalid socket address")?; + let service = SocketAddrV4::new(self.private_ip, *port); self.gateway .add_port( *proto, From c356c4d1c471acd9d2f7e1dcfd3a432442177b48 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Wed, 5 Apr 2023 09:47:58 +0200 Subject: [PATCH 05/10] IPv6-only mode --- src/config/options.rs | 3 ++ src/config/options_test.rs | 17 +++++------ src/config/runtime.rs | 25 +++++++++++---- src/diplonat.rs | 34 ++++++++++++++++----- src/fw_actor.rs | 62 +++++++++++++++++++++++--------------- src/stun_actor.rs | 44 ++++++++++++++++++++++----- 6 files changed, 129 insertions(+), 56 deletions(-) diff --git a/src/config/options.rs b/src/config/options.rs index 100c23c..fc9df16 100644 --- a/src/config/options.rs +++ b/src/config/options.rs @@ -19,6 +19,9 @@ pub struct ConfigOptsBase { pub refresh_time: Option, /// STUN server [default: stun.nextcloud.com:443] pub stun_server: Option, + /// IPv6-only mode (disables IGD, IPv4 firewall and IPv4 address autodiscovery) [default: false] + #[serde(default)] + pub ipv6_only: bool, } /// ACME configuration options diff --git a/src/config/options_test.rs b/src/config/options_test.rs index 8e05c90..073b9ac 100644 --- a/src/config/options_test.rs +++ b/src/config/options_test.rs @@ -63,15 +63,13 @@ fn ok_from_iter_minimal_valid_options() { rt_config.firewall.refresh_time, Duration::from_secs(REFRESH_TIME.into()) ); - assert!(rt_config.igd.private_ip.is_none()); + let igd = rt_config.igd.unwrap(); + assert!(igd.private_ip.is_none()); assert_eq!( - rt_config.igd.expiration_time, + igd.expiration_time, Duration::from_secs(EXPIRATION_TIME.into()) ); - assert_eq!( - rt_config.igd.refresh_time, - Duration::from_secs(REFRESH_TIME.into()) - ); + assert_eq!(igd.refresh_time, Duration::from_secs(REFRESH_TIME.into())); } #[test] @@ -117,10 +115,11 @@ fn ok_from_iter_all_valid_options() { opts.get(&"DIPLONAT_CONSUL_URL".to_string()).unwrap() ); assert_eq!(rt_config.firewall.refresh_time, refresh_time); + let igd = rt_config.igd.unwrap(); assert_eq!( - &rt_config.igd.private_ip.unwrap().to_string(), + &igd.private_ip.unwrap().to_string(), opts.get(&"DIPLONAT_PRIVATE_IP".to_string()).unwrap() ); - assert_eq!(rt_config.igd.expiration_time, expiration_time); - assert_eq!(rt_config.igd.refresh_time, refresh_time); + assert_eq!(igd.expiration_time, expiration_time); + assert_eq!(igd.refresh_time, refresh_time); } diff --git a/src/config/runtime.rs b/src/config/runtime.rs index 45a29c3..d1a3f89 100644 --- a/src/config/runtime.rs +++ b/src/config/runtime.rs @@ -26,6 +26,7 @@ pub struct RuntimeConfigConsul { #[derive(Debug)] pub struct RuntimeConfigFirewall { + pub ipv6_only: bool, pub refresh_time: Duration, } @@ -38,7 +39,7 @@ pub struct RuntimeConfigIgd { #[derive(Debug)] pub struct RuntimeConfigStun { - pub stun_server_v4: SocketAddr, + pub stun_server_v4: Option, pub stun_server_v6: SocketAddr, pub refresh_time: Duration, } @@ -48,7 +49,7 @@ pub struct RuntimeConfig { pub acme: Option, pub consul: RuntimeConfigConsul, pub firewall: RuntimeConfigFirewall, - pub igd: RuntimeConfigIgd, + pub igd: Option, pub stun: RuntimeConfigStun, } @@ -57,7 +58,10 @@ impl RuntimeConfig { let acme = RuntimeConfigAcme::new(opts.acme)?; let consul = RuntimeConfigConsul::new(opts.consul)?; let firewall = RuntimeConfigFirewall::new(&opts.base)?; - let igd = RuntimeConfigIgd::new(&opts.base)?; + let igd = match opts.base.ipv6_only { + false => Some(RuntimeConfigIgd::new(&opts.base)?), + true => None, + }; let stun = RuntimeConfigStun::new(&opts.base)?; Ok(Self { @@ -131,7 +135,10 @@ impl RuntimeConfigFirewall { let refresh_time = Duration::from_secs(opts.refresh_time.unwrap_or(super::REFRESH_TIME).into()); - Ok(Self { refresh_time }) + Ok(Self { + refresh_time, + ipv6_only: opts.ipv6_only, + }) } } @@ -189,9 +196,15 @@ impl RuntimeConfigStun { let refresh_time = Duration::from_secs(opts.refresh_time.unwrap_or(super::REFRESH_TIME).into()); + let stun_server_v4 = match opts.ipv6_only { + false => Some( + stun_server_v4.ok_or(anyhow!("Unable to resolve STUN server's IPv4 address"))?, + ), + true => None, + }; + Ok(Self { - stun_server_v4: stun_server_v4 - .ok_or(anyhow!("Unable to resolve STUN server's IPv4 address"))?, + stun_server_v4, stun_server_v6: stun_server_v6 .ok_or(anyhow!("Unable to resolve STUN server's IPv6 address"))?, refresh_time, diff --git a/src/diplonat.rs b/src/diplonat.rs index a66836a..a94a6f8 100644 --- a/src/diplonat.rs +++ b/src/diplonat.rs @@ -9,7 +9,7 @@ use crate::{ pub struct Diplonat { consul: ConsulActor, firewall: FirewallActor, - igd: IgdActor, + igd: Option, stun: StunActor, } @@ -20,16 +20,26 @@ impl Diplonat { let ca = ConsulActor::new(&rt_cfg.consul, &rt_cfg.consul.node_name); - let fw = FirewallActor::new(rt_cfg.firewall.refresh_time, &ca.rx_open_ports).await?; - - let ia = IgdActor::new( - rt_cfg.igd.private_ip, - rt_cfg.igd.refresh_time, - rt_cfg.igd.expiration_time, + let fw = FirewallActor::new( + rt_cfg.firewall.ipv6_only, + rt_cfg.firewall.refresh_time, &ca.rx_open_ports, ) .await?; + let ia = match rt_cfg.igd { + Some(igdc) => Some( + IgdActor::new( + igdc.private_ip, + igdc.refresh_time, + igdc.expiration_time, + &ca.rx_open_ports, + ) + .await?, + ), + None => None, + }; + let sa = StunActor::new(&rt_cfg.consul, &rt_cfg.stun, &rt_cfg.consul.node_name); let ctx = Self { @@ -43,9 +53,17 @@ impl Diplonat { } pub async fn listen(&mut self) -> Result<()> { + let igd_opt = &mut self.igd; + try_join!( self.consul.listen(), - self.igd.listen(), + async { + if let Some(igd) = igd_opt { + igd.listen().await + } else { + Ok(()) + } + }, self.firewall.listen(), self.stun.listen(), )?; diff --git a/src/fw_actor.rs b/src/fw_actor.rs index fe68381..02d8bcb 100644 --- a/src/fw_actor.rs +++ b/src/fw_actor.rs @@ -12,7 +12,7 @@ use tokio::{ use crate::{fw, messages}; pub struct FirewallActor { - pub ipt_v4: iptables::IPTables, + pub ipt_v4: Option, pub ipt_v6: iptables::IPTables, rx_ports: watch::Receiver, last_ports: messages::PublicExposedPorts, @@ -21,18 +21,24 @@ pub struct FirewallActor { impl FirewallActor { pub async fn new( + ipv6_only: bool, refresh: Duration, rxp: &watch::Receiver, ) -> Result { let ctx = Self { - ipt_v4: iptables::new(false)?, + ipt_v4: match ipv6_only { + false => Some(iptables::new(false)?), + true => None, + }, ipt_v6: iptables::new(true)?, rx_ports: rxp.clone(), last_ports: messages::PublicExposedPorts::new(), refresh, }; - fw::setup(&ctx.ipt_v4)?; + if let Some(ipt_v4) = &ctx.ipt_v4 { + fw::setup(ipt_v4)?; + } fw::setup(&ctx.ipt_v6)?; return Ok(ctx); @@ -62,29 +68,35 @@ impl FirewallActor { } pub async fn do_fw_update(&self) -> Result<()> { - for ipt in [&self.ipt_v4, &self.ipt_v6] { - let curr_opened_ports = fw::get_opened_ports(ipt)?; - - let diff_tcp = self - .last_ports - .tcp_ports - .difference(&curr_opened_ports.tcp_ports) - .copied() - .collect::>(); - let diff_udp = self - .last_ports - .udp_ports - .difference(&curr_opened_ports.udp_ports) - .copied() - .collect::>(); - - let ports_to_open = messages::PublicExposedPorts { - tcp_ports: diff_tcp, - udp_ports: diff_udp, - }; - - fw::open_ports(ipt, ports_to_open)?; + if let Some(ipt_v4) = &self.ipt_v4 { + self.do_fw_update_on(ipt_v4).await?; } + self.do_fw_update_on(&self.ipt_v6).await?; + Ok(()) + } + + pub async fn do_fw_update_on(&self, ipt: &iptables::IPTables) -> Result<()> { + let curr_opened_ports = fw::get_opened_ports(ipt)?; + + let diff_tcp = self + .last_ports + .tcp_ports + .difference(&curr_opened_ports.tcp_ports) + .copied() + .collect::>(); + let diff_udp = self + .last_ports + .udp_ports + .difference(&curr_opened_ports.udp_ports) + .copied() + .collect::>(); + + let ports_to_open = messages::PublicExposedPorts { + tcp_ports: diff_tcp, + udp_ports: diff_udp, + }; + + fw::open_ports(ipt, ports_to_open)?; return Ok(()); } diff --git a/src/stun_actor.rs b/src/stun_actor.rs index 684d3d8..b112bb0 100644 --- a/src/stun_actor.rs +++ b/src/stun_actor.rs @@ -11,7 +11,7 @@ use crate::consul; pub struct StunActor { node: String, consul: consul::Consul, - stun_server_v4: SocketAddr, + stun_server_v4: Option, stun_server_v6: SocketAddr, refresh_time: Duration, } @@ -19,7 +19,7 @@ pub struct StunActor { #[derive(Serialize, Deserialize, Debug)] pub struct AutodiscoverResult { pub timestamp: u64, - pub address: IpAddr, + pub address: Option, } impl StunActor { @@ -28,7 +28,10 @@ impl StunActor { stun_config: &RuntimeConfigStun, node: &str, ) -> Self { - assert!(stun_config.stun_server_v4.is_ipv4()); + assert!(stun_config + .stun_server_v4 + .map(|x| x.is_ipv4()) + .unwrap_or(true)); assert!(stun_config.stun_server_v6.is_ipv6()); Self { @@ -42,7 +45,11 @@ impl StunActor { pub async fn listen(&mut self) -> Result<()> { loop { - if let Err(e) = self.autodiscover_ip(self.stun_server_v4).await { + let ipv4_result = match self.stun_server_v4 { + Some(stun_server_v4) => self.autodiscover_ip(stun_server_v4).await, + None => self.autodiscover_none_ipv4().await, + }; + if let Err(e) = ipv4_result { error!("Unable to autodiscover IPv4 address: {}", e); } if let Err(e) = self.autodiscover_ip(self.stun_server_v6).await { @@ -75,10 +82,24 @@ impl StunActor { .kv_put( &consul_key, serde_json::to_vec(&AutodiscoverResult { - timestamp: SystemTime::now() - .duration_since(SystemTime::UNIX_EPOCH)? - .as_secs(), - address: discovered_addr, + timestamp: timestamp(), + address: Some(discovered_addr), + })?, + ) + .await?; + + Ok(()) + } + + async fn autodiscover_none_ipv4(&self) -> Result<()> { + let consul_key = format!("diplonat/autodiscovery/ipv4/{}", self.node); + + self.consul + .kv_put( + &consul_key, + serde_json::to_vec(&AutodiscoverResult { + timestamp: timestamp(), + address: None, })?, ) .await?; @@ -101,3 +122,10 @@ async fn get_mapped_addr(stun_server: SocketAddr, binding_addr: SocketAddr) -> R .ok_or(anyhow!("no XorMappedAddress found in STUN response"))?; Ok(xor_mapped_addr) } + +fn timestamp() -> u64 { + SystemTime::now() + .duration_since(SystemTime::UNIX_EPOCH) + .expect("clock error") + .as_secs() +} From 71bfd5be2d7c90ecee19b2a736e793d9a432d1c8 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Wed, 5 Apr 2023 09:50:26 +0200 Subject: [PATCH 06/10] Remove ACME config, not used as we are doing ACME in Tricot now --- src/config/mod.rs | 5 ++--- src/config/options.rs | 14 -------------- src/config/runtime.rs | 24 +----------------------- 3 files changed, 3 insertions(+), 40 deletions(-) diff --git a/src/config/mod.rs b/src/config/mod.rs index 00577c6..9281f44 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -3,10 +3,9 @@ mod options; mod options_test; mod runtime; -pub use options::{ConfigOpts, ConfigOptsAcme, ConfigOptsBase, ConfigOptsConsul}; +pub use options::{ConfigOpts, ConfigOptsBase, ConfigOptsConsul}; pub use runtime::{ - RuntimeConfig, RuntimeConfigAcme, RuntimeConfigConsul, RuntimeConfigFirewall, RuntimeConfigIgd, - RuntimeConfigStun, + RuntimeConfig, RuntimeConfigConsul, RuntimeConfigFirewall, RuntimeConfigIgd, RuntimeConfigStun, }; pub const EXPIRATION_TIME: u16 = 300; diff --git a/src/config/options.rs b/src/config/options.rs index fc9df16..adb16f5 100644 --- a/src/config/options.rs +++ b/src/config/options.rs @@ -24,17 +24,6 @@ pub struct ConfigOptsBase { pub ipv6_only: bool, } -/// ACME configuration options -#[derive(Clone, Default, Deserialize)] -pub struct ConfigOptsAcme { - /// Whether ACME is enabled [default: false] - #[serde(default)] - pub enable: bool, - - /// The default domain holder's e-mail [default: None] - pub email: Option, -} - /// Consul configuration options #[derive(Clone, Default, Deserialize)] pub struct ConfigOptsConsul { @@ -56,7 +45,6 @@ pub struct ConfigOptsConsul { /// Model of all potential configuration options pub struct ConfigOpts { pub base: ConfigOptsBase, - pub acme: ConfigOptsAcme, pub consul: ConfigOptsConsul, } @@ -64,12 +52,10 @@ impl ConfigOpts { pub fn from_env() -> Result { let base: ConfigOptsBase = envy::prefixed("DIPLONAT_").from_env()?; let consul: ConfigOptsConsul = envy::prefixed("DIPLONAT_CONSUL_").from_env()?; - let acme: ConfigOptsAcme = envy::prefixed("DIPLONAT_ACME_").from_env()?; RuntimeConfig::new(Self { base: base, consul: consul, - acme: acme, }) } diff --git a/src/config/runtime.rs b/src/config/runtime.rs index d1a3f89..8084439 100644 --- a/src/config/runtime.rs +++ b/src/config/runtime.rs @@ -5,18 +5,13 @@ use std::time::Duration; use anyhow::{anyhow, bail, Context, Result}; -use crate::config::{ConfigOpts, ConfigOptsAcme, ConfigOptsBase, ConfigOptsConsul}; +use crate::config::{ConfigOpts, ConfigOptsBase, ConfigOptsConsul}; // This code is inspired by the Trunk crate (https://github.com/thedodd/trunk) // In this file, we take ConfigOpts and transform them into ready-to-use // RuntimeConfig. We apply default values and business logic. -#[derive(Debug)] -pub struct RuntimeConfigAcme { - pub email: String, -} - #[derive(Debug)] pub struct RuntimeConfigConsul { pub node_name: String, @@ -46,7 +41,6 @@ pub struct RuntimeConfigStun { #[derive(Debug)] pub struct RuntimeConfig { - pub acme: Option, pub consul: RuntimeConfigConsul, pub firewall: RuntimeConfigFirewall, pub igd: Option, @@ -55,7 +49,6 @@ pub struct RuntimeConfig { impl RuntimeConfig { pub fn new(opts: ConfigOpts) -> Result { - let acme = RuntimeConfigAcme::new(opts.acme)?; let consul = RuntimeConfigConsul::new(opts.consul)?; let firewall = RuntimeConfigFirewall::new(&opts.base)?; let igd = match opts.base.ipv6_only { @@ -65,7 +58,6 @@ impl RuntimeConfig { let stun = RuntimeConfigStun::new(&opts.base)?; Ok(Self { - acme, consul, firewall, igd, @@ -74,20 +66,6 @@ impl RuntimeConfig { } } -impl RuntimeConfigAcme { - pub fn new(opts: ConfigOptsAcme) -> Result> { - if !opts.enable { - return Ok(None); - } - - let email = opts.email.expect( - "'DIPLONAT_ACME_EMAIL' environment variable is required if 'DIPLONAT_ACME_ENABLE' == 'true'", - ); - - Ok(Some(Self { email })) - } -} - impl RuntimeConfigConsul { pub(super) fn new(opts: ConfigOptsConsul) -> Result { let node_name = opts From 21ab77b8288630c5f39a30b098c6a3888df622a1 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Wed, 5 Apr 2023 09:51:50 +0200 Subject: [PATCH 07/10] Remove ACME options from tests --- src/config/options.rs | 2 -- src/config/options_test.rs | 6 ------ 2 files changed, 8 deletions(-) diff --git a/src/config/options.rs b/src/config/options.rs index adb16f5..c31484f 100644 --- a/src/config/options.rs +++ b/src/config/options.rs @@ -68,12 +68,10 @@ impl ConfigOpts { let base: ConfigOptsBase = envy::prefixed("DIPLONAT_").from_iter(iter.clone())?; let consul: ConfigOptsConsul = envy::prefixed("DIPLONAT_CONSUL_").from_iter(iter.clone())?; - let acme: ConfigOptsAcme = envy::prefixed("DIPLONAT_ACME_").from_iter(iter.clone())?; RuntimeConfig::new(Self { base: base, consul: consul, - acme: acme, }) } } diff --git a/src/config/options_test.rs b/src/config/options_test.rs index 073b9ac..a028a4e 100644 --- a/src/config/options_test.rs +++ b/src/config/options_test.rs @@ -53,7 +53,6 @@ fn ok_from_iter_minimal_valid_options() { let opts = minimal_valid_options(); let rt_config = ConfigOpts::from_iter(opts.clone()).unwrap(); - assert!(rt_config.acme.is_none()); assert_eq!( &rt_config.consul.node_name, opts.get(&"DIPLONAT_CONSUL_NODE_NAME".to_string()).unwrap() @@ -101,11 +100,6 @@ fn ok_from_iter_all_valid_options() { .into(), ); - assert!(rt_config.acme.is_some()); - assert_eq!( - &rt_config.acme.unwrap().email, - opts.get(&"DIPLONAT_ACME_EMAIL".to_string()).unwrap() - ); assert_eq!( &rt_config.consul.node_name, opts.get(&"DIPLONAT_CONSUL_NODE_NAME".to_string()).unwrap() From 48da5b61acf9edd582be5cecfdae58f63bd4527e Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Thu, 20 Apr 2023 14:14:30 +0200 Subject: [PATCH 08/10] better error handling --- src/diplonat.rs | 21 +++++++++++++-------- src/stun_actor.rs | 40 ++++++++++++++++++++++++++++------------ 2 files changed, 41 insertions(+), 20 deletions(-) diff --git a/src/diplonat.rs b/src/diplonat.rs index a94a6f8..96bac3b 100644 --- a/src/diplonat.rs +++ b/src/diplonat.rs @@ -1,4 +1,5 @@ -use anyhow::Result; +use anyhow::{Context, Result}; +use futures::future::FutureExt; use tokio::try_join; use crate::{ @@ -15,7 +16,7 @@ pub struct Diplonat { impl Diplonat { pub async fn new() -> Result { - let rt_cfg = ConfigOpts::from_env()?; + let rt_cfg = ConfigOpts::from_env().context("Parse configuration")?; println!("{:#?}", rt_cfg); let ca = ConsulActor::new(&rt_cfg.consul, &rt_cfg.consul.node_name); @@ -25,7 +26,8 @@ impl Diplonat { rt_cfg.firewall.refresh_time, &ca.rx_open_ports, ) - .await?; + .await + .context("Setup fireall actor")?; let ia = match rt_cfg.igd { Some(igdc) => Some( @@ -35,7 +37,8 @@ impl Diplonat { igdc.expiration_time, &ca.rx_open_ports, ) - .await?, + .await + .context("Setup IGD actor")?, ), None => None, }; @@ -56,16 +59,18 @@ impl Diplonat { let igd_opt = &mut self.igd; try_join!( - self.consul.listen(), + self.consul.listen().map(|x| x.context("Run consul actor")), async { if let Some(igd) = igd_opt { - igd.listen().await + igd.listen().await.context("Run IGD actor") } else { Ok(()) } }, - self.firewall.listen(), - self.stun.listen(), + self.firewall + .listen() + .map(|x| x.context("Run firewall actor")), + self.stun.listen().map(|x| x.context("Run STUN actor")), )?; Ok(()) diff --git a/src/stun_actor.rs b/src/stun_actor.rs index b112bb0..6740c83 100644 --- a/src/stun_actor.rs +++ b/src/stun_actor.rs @@ -1,4 +1,4 @@ -use std::net::{IpAddr, SocketAddr}; +use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr}; use std::time::{Duration, SystemTime}; use anyhow::{anyhow, bail, Result}; @@ -60,20 +60,23 @@ impl StunActor { } async fn autodiscover_ip(&self, stun_server: SocketAddr) -> Result<()> { - let binding_addr = match stun_server.is_ipv4() { - true => "0.0.0.0:34791".parse().unwrap(), - false => "[::]:34792".parse().unwrap(), + let binding_ip = match stun_server.is_ipv4() { + true => IpAddr::V4(Ipv4Addr::UNSPECIFIED), // 0.0.0.0 + false => IpAddr::V6(Ipv6Addr::UNSPECIFIED), // [::] }; + let binding_addr = SocketAddr::new(binding_ip, 0); - let discovered_addr = get_mapped_addr(stun_server, binding_addr).await?.ip(); + let discovered_addr = get_mapped_addr(stun_server, binding_addr) + .await? + .map(|x| x.ip()); let consul_key = match stun_server.is_ipv4() { true => { - debug!("Autodiscovered IPv4: {}", discovered_addr); + debug!("Autodiscovered IPv4: {:?}", discovered_addr); format!("diplonat/autodiscovery/ipv4/{}", self.node) } false => { - debug!("Autodiscovered IPv6: {}", discovered_addr); + debug!("Autodiscovered IPv6: {:?}", discovered_addr); format!("diplonat/autodiscovery/ipv6/{}", self.node) } }; @@ -83,7 +86,7 @@ impl StunActor { &consul_key, serde_json::to_vec(&AutodiscoverResult { timestamp: timestamp(), - address: Some(discovered_addr), + address: discovered_addr, })?, ) .await?; @@ -108,11 +111,23 @@ impl StunActor { } } -async fn get_mapped_addr(stun_server: SocketAddr, binding_addr: SocketAddr) -> Result { +async fn get_mapped_addr( + stun_server: SocketAddr, + binding_addr: SocketAddr, +) -> Result> { use stun_client::*; - let mut client = Client::new(binding_addr, None).await.unwrap(); - let res = client.binding_request(stun_server, None).await.unwrap(); + let mut client = Client::new(binding_addr, None).await?; + let res = match client.binding_request(stun_server, None).await { + Err(e) => { + info!( + "STUN binding request to {} failed, assuming no address (error: {})", + binding_addr, e + ); + return Ok(None); + } + Ok(r) => r, + }; if res.get_class() != Class::SuccessResponse { bail!("STUN server did not responde with a success response"); @@ -120,7 +135,8 @@ async fn get_mapped_addr(stun_server: SocketAddr, binding_addr: SocketAddr) -> R let xor_mapped_addr = Attribute::get_xor_mapped_address(&res) .ok_or(anyhow!("no XorMappedAddress found in STUN response"))?; - Ok(xor_mapped_addr) + + Ok(Some(xor_mapped_addr)) } fn timestamp() -> u64 { From d27173a2b7ada8d0df9506ce4beb1ba9dae94950 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Thu, 20 Apr 2023 14:29:38 +0200 Subject: [PATCH 09/10] debug --- src/fw.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/fw.rs b/src/fw.rs index 88aaa86..abb6e20 100644 --- a/src/fw.rs +++ b/src/fw.rs @@ -54,6 +54,7 @@ pub fn get_opened_ports(ipt: &iptables::IPTables) -> Result { @@ -70,7 +71,9 @@ pub fn get_opened_ports(ipt: &iptables::IPTables) -> Result {} + _ => { + debug!("{} rule not parsed: {}", ipt.cmd, i); + } } } From f5fc635b75dfa17b83a8db4893a7be206b4f9892 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Thu, 20 Apr 2023 14:53:20 +0200 Subject: [PATCH 10/10] match numeric protocol values --- src/fw.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/fw.rs b/src/fw.rs index abb6e20..a3e6dec 100644 --- a/src/fw.rs +++ b/src/fw.rs @@ -62,10 +62,12 @@ pub fn get_opened_ports(ipt: &iptables::IPTables) -> Result()?; - if proto == "tcp" { + if proto == "tcp" || proto == "6" { ports.tcp_ports.insert(number); - } else { + } else if proto == "udp" || proto == "17" { ports.udp_ports.insert(number); + } else { + error!("Unexpected protocol in iptables rule: {}", proto); } } else { error!("Unexpected rule found in DIPLONAT chain") @@ -77,6 +79,8 @@ pub fn get_opened_ports(ipt: &iptables::IPTables) -> Result