From d5a55b3b43d675f4c0d56472268b252f153634c9 Mon Sep 17 00:00:00 2001 From: John Smith Date: Sat, 2 Jul 2022 20:40:34 -0400 Subject: [PATCH] fix windows dns --- Cargo.lock | 374 +++++++++--------- veilid-core/Cargo.toml | 1 + veilid-core/src/intf/native/system.rs | 223 ++++++++--- .../native/utils/network_interfaces/mod.rs | 6 +- veilid-flutter/windows/rust.cmake | 4 +- 5 files changed, 356 insertions(+), 252 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1de11e28..0693fb90 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,32 +28,13 @@ dependencies = [ [[package]] name = "aes" -version = "0.6.0" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "884391ef1066acaa41e766ba8f596341b96e93ce34f9a43e7d24bf0a0eaf0561" +checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" dependencies = [ - "aes-soft", - "aesni", - "cipher 0.2.5", -] - -[[package]] -name = "aes-soft" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072" -dependencies = [ - "cipher 0.2.5", - "opaque-debug 0.3.0", -] - -[[package]] -name = "aesni" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce" -dependencies = [ - "cipher 0.2.5", + "cfg-if 1.0.0", + "cipher 0.3.0", + "cpufeatures", "opaque-debug 0.3.0", ] @@ -398,7 +379,7 @@ dependencies = [ "futures-core", "futures-task", "futures-util", - "pin-project 1.0.10", + "pin-project 1.0.11", "rustc_version", "tokio", "wasm-bindgen-futures", @@ -567,12 +548,12 @@ dependencies = [ [[package]] name = "block-modes" -version = "0.7.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57a0e8073e8baa88212fb5823574c02ebccb395136ba9a164ab89379ec6072f0" +checksum = "2cb03d1bed155d89dce0f845b7899b18a9a163e148fd004e1c28421a783e2d8e" dependencies = [ "block-padding 0.2.1", - "cipher 0.2.5", + "cipher 0.3.0", ] [[package]] @@ -759,13 +740,13 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chacha20" -version = "0.7.1" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fee7ad89dc1128635074c268ee661f90c3f7e83d9fd12910608c36b47d6c3412" +checksum = "01b72a433d0cf2aef113ba70f62634c56fddb0f244e6377185c56a7cadbd8f91" dependencies = [ "cfg-if 1.0.0", "cipher 0.3.0", - "cpufeatures 0.1.5", + "cpufeatures", "zeroize", ] @@ -777,17 +758,17 @@ checksum = "c7fc89c7c5b9e7a02dfe45cd2367bae382f9ed31c61ca8debe5f827c420a2f08" dependencies = [ "cfg-if 1.0.0", "cipher 0.4.3", - "cpufeatures 0.2.2", + "cpufeatures", ] [[package]] name = "chacha20poly1305" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1580317203210c517b6d44794abfbe600698276db18127e37ad3e69bf5e848e5" +checksum = "3b84ed6d1d5f7aa9bdde921a5090e0ca4d934d250ea3b402a5fab3a994e28a2a" dependencies = [ "aead", - "chacha20 0.7.1", + "chacha20 0.8.1", "cipher 0.3.0", "poly1305", "zeroize", @@ -806,15 +787,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "cipher" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" -dependencies = [ - "generic-array 0.14.5", -] - [[package]] name = "cipher" version = "0.3.0" @@ -858,9 +830,9 @@ dependencies = [ [[package]] name = "clap" -version = "3.2.6" +version = "3.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f1fe12880bae935d142c8702d500c63a4e8634b6c3c57ad72bf978fc7b6249a" +checksum = "190814073e85d238f31ff738fcb0bf6910cedeb73376c87cd69291028966fd83" dependencies = [ "atty", "bitflags", @@ -873,9 +845,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87eba3c8c7f42ef17f6c659fc7416d0f4758cd3e58861ee63c5fa4a4dde649e4" +checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" dependencies = [ "os_str_bytes", ] @@ -1012,15 +984,6 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" -[[package]] -name = "cpufeatures" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66c99696f6c9dd7f35d486b9d04d7e6e202aa3e8c40d553f2fdf5e7e0c6a71ef" -dependencies = [ - "libc", -] - [[package]] name = "cpufeatures" version = "0.2.2" @@ -1154,9 +1117,9 @@ dependencies = [ [[package]] name = "crypto-mac" -version = "0.10.1" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bff07008ec701e8028e2ceb8f83f0e4274ee62bd2dbdc4fefff2e9a91824081a" +checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" dependencies = [ "generic-array 0.14.5", "subtle", @@ -1260,7 +1223,7 @@ dependencies = [ "enumset", "lazy_static", "log", - "num 0.4.0", + "num", "owning_ref", "time 0.3.11", "tokio", @@ -1272,9 +1235,9 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "3.2.0" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" +checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" dependencies = [ "byteorder", "digest 0.9.0", @@ -1436,9 +1399,9 @@ dependencies = [ [[package]] name = "either" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be" [[package]] name = "enum-as-inner" @@ -1549,6 +1512,27 @@ dependencies = [ "synstructure", ] +[[package]] +name = "errno" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +dependencies = [ + "errno-dragonfly", + "libc", + "winapi", +] + +[[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 = "ethbloom" version = "0.12.1" @@ -1696,7 +1680,7 @@ dependencies = [ "futures-core", "futures-sink", "nanorand", - "pin-project 1.0.10", + "pin-project 1.0.11", "spin 0.9.3", ] @@ -1718,11 +1702,12 @@ dependencies = [ [[package]] name = "fs4" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cef5c93884e5cef757f63446122c2f420713c3e03f85540d09485b9415983b4a" +checksum = "15db7070ad11d5d652498c0b5d49428a3150ffe8c0c5b8d90a26030664e70ad0" dependencies = [ "libc", + "rustix", "winapi", ] @@ -2025,9 +2010,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hkdf" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51ab2f639c231793c5f6114bdb9bbe50a7dbbfcd7c7c6bd8475dec2d991e964f" +checksum = "01706d578d5c281058480e673ae4086a9f4710d8df1ad80a5b03e39ece5f886b" dependencies = [ "digest 0.9.0", "hmac", @@ -2035,9 +2020,9 @@ dependencies = [ [[package]] name = "hmac" -version = "0.10.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15" +checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" dependencies = [ "crypto-mac", "digest 0.9.0", @@ -2235,6 +2220,12 @@ dependencies = [ "web-sys", ] +[[package]] +name = "io-lifetimes" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24c3f4eff5495aee4c0399d7b6a0dc2b6e81be84242ffbfcf253ebacccc1d0cb" + [[package]] name = "ipconfig" version = "0.3.0" @@ -2349,7 +2340,7 @@ dependencies = [ "backtrace", "byteorder", "cfg-if 1.0.0", - "clap 3.2.6", + "clap 3.2.8", "core-foundation 0.9.3", "core-foundation-sys 0.8.3", "directories", @@ -2502,6 +2493,12 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" +[[package]] +name = "linux-raw-sys" +version = "0.0.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d" + [[package]] name = "lock_api" version = "0.4.7" @@ -2753,19 +2750,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "nix" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50e4785f2c3b7589a0d0c1dd60285e1188adac4006e8abd6dd578e1567027363" -dependencies = [ - "bitflags", - "cc", - "cfg-if 0.1.10", - "libc", - "void", -] - [[package]] name = "nix" version = "0.22.3" @@ -2828,53 +2812,31 @@ dependencies = [ "winapi", ] -[[package]] -name = "num" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b7a8e9be5e039e2ff869df49155f1c06bd01ade2117ec783e56ab0932b67a8f" -dependencies = [ - "num-bigint", - "num-complex 0.3.1", - "num-integer", - "num-iter", - "num-rational 0.3.2", - "num-traits", -] - [[package]] name = "num" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43db66d1170d347f9a065114077f7dccb00c1b9478c89384490a3425279a4606" dependencies = [ - "num-complex 0.4.2", + "num-bigint", + "num-complex", "num-integer", "num-iter", - "num-rational 0.4.1", + "num-rational", "num-traits", ] [[package]] name = "num-bigint" -version = "0.3.3" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f6f7833f2cbf2360a6cfd58cd41a53aa7a90bd4c202f5b1c7dd2ed73c57b2c3" +checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" dependencies = [ "autocfg", "num-integer", "num-traits", ] -[[package]] -name = "num-complex" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "747d632c0c558b87dbabbe6a82f3b4ae03720d0646ac5b7b4dae89394be5f2c5" -dependencies = [ - "num-traits", -] - [[package]] name = "num-complex" version = "0.4.2" @@ -2905,18 +2867,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-rational" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" -dependencies = [ - "autocfg", - "num-bigint", - "num-integer", - "num-traits", -] - [[package]] name = "num-rational" version = "0.4.1" @@ -2924,6 +2874,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg", + "num-bigint", "num-integer", "num-traits", ] @@ -3025,7 +2976,7 @@ dependencies = [ "js-sys", "lazy_static", "percent-encoding", - "pin-project 1.0.10", + "pin-project 1.0.11", "rand 0.8.5", "thiserror", "tokio", @@ -3270,11 +3221,11 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58ad3879ad3baf4e44784bc6a718a8698867bb991f8ce24d1bcbe2cfb4c3a75e" +checksum = "78203e83c48cffbe01e4a2d35d566ca4de445d79a85372fc64e378bfc812a260" dependencies = [ - "pin-project-internal 1.0.10", + "pin-project-internal 1.0.11", ] [[package]] @@ -3290,9 +3241,9 @@ dependencies = [ [[package]] name = "pin-project-internal" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "744b6f092ba29c3650faf274db506afd39944f48420f6c86b17cfe0ee1cb36bb" +checksum = "710faf75e1b33345361201d36d04e98ac1ed8909151a017ed384700836104c74" dependencies = [ "proc-macro2", "quote", @@ -3364,7 +3315,7 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede" dependencies = [ - "cpufeatures 0.2.2", + "cpufeatures", "opaque-debug 0.3.0", "universal-hash", ] @@ -3823,6 +3774,20 @@ dependencies = [ "semver", ] +[[package]] +name = "rustix" +version = "0.35.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef258c11e17f5c01979a10543a30a4e12faef6aab217a74266e747eefa3aed88" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys", +] + [[package]] name = "rustls" version = "0.19.1" @@ -3890,24 +3855,24 @@ dependencies = [ [[package]] name = "secrecy" -version = "0.8.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bd1c54ea06cfd2f6b63219704de0b9b4f72dcc2b8fdef820be6cd799780e91e" +checksum = "0673d6a6449f5e7d12a1caf424fd9363e2af3a4953023ed455e3c4beef4597c0" dependencies = [ "zeroize", ] [[package]] name = "secret-service" -version = "2.0.1" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2400fb1bf2a87b303ada204946294f932ade4929477e9e2bf66d7b49a66656ec" +checksum = "e1da5c423b8783185fd3fecd1c8796c267d2c089d894ce5a93c280a5d3f780a2" dependencies = [ "aes", "block-modes", "hkdf", "lazy_static", - "num 0.3.1", + "num", "rand 0.8.5", "serde", "sha2", @@ -3942,9 +3907,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.10" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a41d061efea015927ac527063765e73601444cdc344ba855bc7bd44578b25e1c" +checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1" [[package]] name = "send_wrapper" @@ -3960,9 +3925,9 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.137" +version = "1.0.138" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" +checksum = "1578c6245786b9d168c5447eeacfb96856573ca56c9d68fdcf394be134882a47" dependencies = [ "serde_derive", ] @@ -3988,9 +3953,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.137" +version = "1.0.138" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" +checksum = "023e9b1467aef8a10fb88f25611870ada9800ef7e22afce356bb0d2387b6f27c" dependencies = [ "proc-macro2", "quote", @@ -3999,9 +3964,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.81" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" +checksum = "82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7" dependencies = [ "itoa 1.0.2", "ryu", @@ -4021,9 +3986,9 @@ dependencies = [ [[package]] name = "serde_test" -version = "1.0.137" +version = "1.0.138" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe196827aea34242c314d2f0dd49ed00a129225e80dda71b0dbf65d54d25628d" +checksum = "844df772d885b3e52fddb7af284b402628e57a6b2e8eeda89816692c45317db9" dependencies = [ "serde", ] @@ -4086,7 +4051,7 @@ checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" dependencies = [ "block-buffer 0.9.0", "cfg-if 1.0.0", - "cpufeatures 0.2.2", + "cpufeatures", "digest 0.9.0", "opaque-debug 0.3.0", ] @@ -4098,7 +4063,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f" dependencies = [ "cfg-if 1.0.0", - "cpufeatures 0.2.2", + "cpufeatures", "digest 0.10.3", ] @@ -4110,7 +4075,7 @@ checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ "block-buffer 0.9.0", "cfg-if 1.0.0", - "cpufeatures 0.2.2", + "cpufeatures", "digest 0.9.0", "opaque-debug 0.3.0", ] @@ -4197,9 +4162,9 @@ checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32" [[package]] name = "smallvec" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc88c725d61fc6c3132893370cac4a0200e3fedf5da8331c570664b1987f5ca2" +checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" [[package]] name = "snailquote" @@ -4512,7 +4477,6 @@ checksum = "36943ee01a6d67977dd3f84a5a1d2efeb4ada3a1ae771cadfaa535d9d9fc6507" dependencies = [ "bytes 1.1.0", "futures-core", - "futures-io", "futures-sink", "log", "pin-project-lite", @@ -4561,7 +4525,7 @@ dependencies = [ "hyper", "hyper-timeout", "percent-encoding", - "pin-project 1.0.10", + "pin-project 1.0.11", "prost", "prost-derive", "tokio", @@ -4595,7 +4559,7 @@ dependencies = [ "futures-core", "futures-util", "indexmap", - "pin-project 1.0.10", + "pin-project 1.0.11", "pin-project-lite", "rand 0.8.5", "slab", @@ -4644,9 +4608,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.21" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc6b8ad3567499f98a1db7a752b07a7c8c7c7c34c332ec00effb2b0027974b7c" +checksum = "11c75893af559bc8e10716548bdef5cb2b983f8e637db9d0e15126b61b484ee2" dependencies = [ "proc-macro2", "quote", @@ -4679,7 +4643,7 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" dependencies = [ - "pin-project 1.0.10", + "pin-project 1.0.11", "tracing", ] @@ -4707,9 +4671,9 @@ dependencies = [ [[package]] name = "tracing-opentelemetry" -version = "0.17.3" +version = "0.17.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93600c803bb15e2a32bd376001b8625587f268fe887669b5ac86af524637c242" +checksum = "fbbe89715c1dbbb790059e2565353978564924ee85017b5fff365c872ff6721f" dependencies = [ "once_cell", "opentelemetry", @@ -4721,13 +4685,13 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.11" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bc28f93baff38037f64e6f43d34cfa1605f27a49c34e8a04c5e78b0babf2596" +checksum = "3a713421342a5a666b7577783721d3117f1b69a393df803ee17bb73b1e122a59" dependencies = [ "ansi_term", - "lazy_static", "matchers", + "once_cell", "regex", "sharded-slab", "smallvec", @@ -4875,9 +4839,9 @@ checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c" [[package]] name = "unicode-normalization" -version = "0.1.20" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81dee68f85cab8cf68dec42158baf3a79a1cdc065a8b103025965d6ccb7f6cbd" +checksum = "854cbdc4f7bc6ae19c820d44abdc3277ac3e1b2b93db20a636825d9322fb60e6" dependencies = [ "tinyvec", ] @@ -4973,7 +4937,7 @@ dependencies = [ "capnp-rpc", "capnpc", "cfg-if 1.0.0", - "clap 3.2.6", + "clap 3.2.8", "config", "crossbeam-channel", "cursive", @@ -4983,13 +4947,13 @@ dependencies = [ "flexi_logger", "futures", "log", - "parking_lot 0.11.2", + "parking_lot 0.12.1", "serde", "serde_derive", "serial_test", "thiserror", "tokio", - "tokio-util 0.6.10", + "tokio-util 0.7.3", "veilid-core", ] @@ -5084,6 +5048,7 @@ dependencies = [ "webpki-roots 0.22.3", "wee_alloc", "winapi", + "windows", "windows-permissions", "ws_stream_wasm", "x25519-dalek-ng", @@ -5129,7 +5094,7 @@ dependencies = [ "capnp-rpc", "capnpc", "cfg-if 1.0.0", - "clap 3.2.6", + "clap 3.2.8", "config", "ctrlc", "daemonize", @@ -5192,12 +5157,6 @@ 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" @@ -5469,6 +5428,19 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c47017195a790490df51a3e27f669a7d4f285920d90d03ef970c5d886ef0af1" +dependencies = [ + "windows_aarch64_msvc 0.38.0", + "windows_i686_gnu 0.38.0", + "windows_i686_msvc 0.38.0", + "windows_x86_64_gnu 0.38.0", + "windows_x86_64_msvc 0.38.0", +] + [[package]] name = "windows-permissions" version = "0.2.4" @@ -5497,11 +5469,11 @@ version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" dependencies = [ - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_msvc", + "windows_aarch64_msvc 0.36.1", + "windows_i686_gnu 0.36.1", + "windows_i686_msvc 0.36.1", + "windows_x86_64_gnu 0.36.1", + "windows_x86_64_msvc 0.36.1", ] [[package]] @@ -5510,30 +5482,60 @@ version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" +[[package]] +name = "windows_aarch64_msvc" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b12add87e2fb192fff3f4f7e4342b3694785d79f3a64e2c20d5ceb5ccbcfc3cd" + [[package]] name = "windows_i686_gnu" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" +[[package]] +name = "windows_i686_gnu" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c98f2db372c23965c5e0f43896a8f0316dc0fbe48d1aa65bea9bdd295d43c15" + [[package]] name = "windows_i686_msvc" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" +[[package]] +name = "windows_i686_msvc" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdf0569be0f2863ab6a12a6ba841fcfa7d107cbc7545a3ebd57685330db0a3ff" + [[package]] name = "windows_x86_64_gnu" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" +[[package]] +name = "windows_x86_64_gnu" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "905858262c8380a36f32cb8c1990d7e7c3b7a8170e58ed9a98ca6d940b7ea9f1" + [[package]] name = "windows_x86_64_msvc" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" +[[package]] +name = "windows_x86_64_msvc" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "890c3c6341d441ffb38f705f47196e3665dc6dd79f6d72fa185d937326730561" + [[package]] name = "winreg" version = "0.7.0" @@ -5599,9 +5601,9 @@ dependencies = [ [[package]] name = "zbus" -version = "1.9.1" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2326acc379a3ac4e34b794089f5bdb17086bf29a5fdf619b7b4cc772dc2e9dad" +checksum = "9cbeb2291cd7267a94489b71376eda33496c1b9881adf6b36f26cc2779f3fc49" dependencies = [ "async-io", "byteorder", @@ -5610,7 +5612,7 @@ dependencies = [ "fastrand", "futures", "nb-connect", - "nix 0.17.0", + "nix 0.22.3", "once_cell", "polling", "scoped-tls", @@ -5622,9 +5624,9 @@ dependencies = [ [[package]] name = "zbus_macros" -version = "1.9.1" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a482c56029e48681b89b92b5db3c446db0915e8dd1052c0328a574eda38d5f93" +checksum = "fa3959a7847cf95e3d51e312856617c5b1b77191176c65a79a5f14d778bbe0a6" dependencies = [ "proc-macro-crate 0.1.5", "proc-macro2", @@ -5634,9 +5636,9 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.5.5" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94693807d016b2f2d2e14420eb3bfcca689311ff775dcf113d74ea624b7cdf07" +checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" dependencies = [ "zeroize_derive", ] diff --git a/veilid-core/Cargo.toml b/veilid-core/Cargo.toml index 3efd2207..26bc0424 100644 --- a/veilid-core/Cargo.toml +++ b/veilid-core/Cargo.toml @@ -146,6 +146,7 @@ rtnetlink = { version = "^0", default-features = false } # Dependencies for Windows [target.'cfg(target_os = "windows")'.dependencies] winapi = { version = "^0", features = [ "iptypes", "iphlpapi" ] } +windows = { version = "^0", features = [ "Win32_NetworkManagement_Dns", "Win32_Foundation", "alloc" ]} windows-permissions = "^0" # Dependencies for iOS diff --git a/veilid-core/src/intf/native/system.rs b/veilid-core/src/intf/native/system.rs index 0466201f..ae69dfa5 100644 --- a/veilid-core/src/intf/native/system.rs +++ b/veilid-core/src/intf/native/system.rs @@ -1,35 +1,9 @@ #![allow(dead_code)] use crate::xx::*; -cfg_if! { - if #[cfg(feature="rt-async-std")] { - use async_std_resolver::{config, resolver, resolver_from_system_conf, AsyncStdResolver as AsyncResolver}; - } else if #[cfg(feature="rt-tokio")] { - use trust_dns_resolver::{config, TokioAsyncResolver as AsyncResolver, error::ResolveError}; - - pub async fn resolver( - config: config::ResolverConfig, - options: config::ResolverOpts, - ) -> Result { - AsyncResolver::tokio(config, options) - } - - /// Constructs a new async-std based Resolver with the system configuration. - /// - /// This will use `/etc/resolv.conf` on Unix OSes and the registry on Windows. - #[cfg(any(unix, target_os = "windows"))] - pub async fn resolver_from_system_conf() -> Result { - AsyncResolver::tokio_from_system_conf() - } - } -} use rand::prelude::*; use std::time::{Duration, SystemTime, UNIX_EPOCH}; -lazy_static::lazy_static! { - static ref RESOLVER: Arc>> = Arc::new(AsyncMutex::new(None)); -} - pub fn get_timestamp() -> u64 { match SystemTime::now().duration_since(UNIX_EPOCH) { Ok(n) => n.as_micros() as u64, @@ -213,50 +187,177 @@ where } */ -async fn get_resolver() -> Result { - let mut resolver_lock = RESOLVER.lock().await; - if let Some(r) = &*resolver_lock { - Ok(r.clone()) - } else { - let resolver = match resolver_from_system_conf().await { - Ok(v) => v, - Err(_) => resolver( - config::ResolverConfig::default(), - config::ResolverOpts::default(), - ) - .await - .expect("failed to connect resolver"), - }; +///////////////////////////////////////////////////////////////////////////////// +// Resolver +// +// Uses system resolver on windows and trust-dns-resolver elsewhere +// trust-dns-resolver hangs for a long time on Windows building some cache or something +// and we really should be using the built-in system resolver when possible - *resolver_lock = Some(resolver.clone()); - Ok(resolver) +cfg_if! { + if #[cfg(not(target_os = "windows"))] { + cfg_if! { + if #[cfg(feature="rt-async-std")] { + use async_std_resolver::{config, resolver, resolver_from_system_conf, AsyncStdResolver as AsyncResolver}; + } else if #[cfg(feature="rt-tokio")] { + use trust_dns_resolver::{config, TokioAsyncResolver as AsyncResolver, error::ResolveError}; + + pub async fn resolver( + config: config::ResolverConfig, + options: config::ResolverOpts, + ) -> Result { + AsyncResolver::tokio(config, options) + } + + /// Constructs a new async-std based Resolver with the system configuration. + /// + /// This will use `/etc/resolv.conf` on Unix OSes and the registry on Windows. + #[cfg(any(unix, target_os = "windows"))] + pub async fn resolver_from_system_conf() -> Result { + AsyncResolver::tokio_from_system_conf() + } + } + } + + + lazy_static::lazy_static! { + static ref RESOLVER: Arc>> = Arc::new(AsyncMutex::new(None)); + } + } +} + +cfg_if! { + if #[cfg(not(target_os = "windows"))] { + async fn get_resolver() -> Result { + let mut resolver_lock = RESOLVER.lock().await; + if let Some(r) = &*resolver_lock { + Ok(r.clone()) + } else { + let resolver = match resolver_from_system_conf().await { + Ok(v) => v, + Err(_) => resolver( + config::ResolverConfig::default(), + config::ResolverOpts::default(), + ) + .await + .expect("failed to connect resolver"), + }; + + *resolver_lock = Some(resolver.clone()); + Ok(resolver) + } + } } } pub async fn txt_lookup>(host: S) -> Result, String> { - let resolver = get_resolver().await?; - let txt_result = resolver - .txt_lookup(host.as_ref()) - .await - .map_err(|e| e.to_string())?; - let mut out = Vec::new(); - for x in txt_result.iter() { - for s in x.txt_data() { - out.push(String::from_utf8(s.to_vec()).map_err(|e| e.to_string())?); + cfg_if! { + if #[cfg(target_os = "windows")] { + use core::ffi::c_void; + use windows::core::PSTR; + use std::ffi::CStr; + use windows::Win32::NetworkManagement::Dns::{DnsQuery_UTF8, DnsFree, DNS_TYPE_TEXT, DNS_QUERY_STANDARD, DNS_RECORDA, DnsFreeRecordList}; + + let mut out = Vec::new(); + unsafe { + let mut p_query_results: *mut DNS_RECORDA = core::ptr::null_mut(); + let status = DnsQuery_UTF8(host.as_ref(), DNS_TYPE_TEXT as u16, DNS_QUERY_STANDARD, core::ptr::null_mut(), &mut p_query_results as *mut *mut DNS_RECORDA, core::ptr::null_mut()); + if status != 0 { + return Err("Failed to resolve TXT record".to_owned()); + } + + let mut p_record: *mut DNS_RECORDA = p_query_results; + while !p_record.is_null() { + if (*p_record).wType == DNS_TYPE_TEXT as u16 { + let count:usize = (*p_record).Data.TXT.dwStringCount.try_into().unwrap(); + let string_array: *const PSTR = &(*p_record).Data.TXT.pStringArray[0]; + for n in 0..count { + let pstr: PSTR = *(string_array.add(n)); + let c_str: &CStr = CStr::from_ptr(pstr.0 as *const i8); + if let Ok(str_slice) = c_str.to_str() { + let str_buf: String = str_slice.to_owned(); + out.push(str_buf); + } + } + } + p_record = (*p_record).pNext; + } + DnsFree(p_query_results as *const c_void, DnsFreeRecordList); + } + Ok(out) + + } else { + let resolver = get_resolver().await?; + let txt_result = resolver + .txt_lookup(host.as_ref()) + .await + .map_err(|e| e.to_string())?; + let mut out = Vec::new(); + for x in txt_result.iter() { + for s in x.txt_data() { + out.push(String::from_utf8(s.to_vec()).map_err(|e| e.to_string())?); + } + } + Ok(out) } } - Ok(out) } pub async fn ptr_lookup(ip_addr: IpAddr) -> Result { - let resolver = get_resolver().await?; - let ptr_result = resolver - .reverse_lookup(ip_addr) - .await - .map_err(|e| e.to_string())?; - if let Some(r) = ptr_result.iter().next() { - Ok(r.to_string().trim_end_matches('.').to_string()) - } else { - Err("PTR lookup returned an empty string".to_owned()) + cfg_if! { + if #[cfg(target_os = "windows")] { + use core::ffi::c_void; + use windows::core::PSTR; + use std::ffi::CStr; + use windows::Win32::NetworkManagement::Dns::{DnsQuery_UTF8, DnsFree, DNS_TYPE_PTR, DNS_QUERY_STANDARD, DNS_RECORDA, DnsFreeRecordList}; + + let host = match ip_addr { + IpAddr::V4(a) => { + let oct = a.octets(); + format!("{}.{}.{}.{}.in-addr.arpa",oct[3],oct[2],oct[1],oct[0]) + } + IpAddr::V6(a) => { + let mut s = String::new(); + for b in hex::encode(a.octets()).as_bytes().iter().rev() { + s.push_str(&format!("{}.",b)); + } + format!("{}ip6.arpa",s) + } + }; + + unsafe { + let mut p_query_results: *mut DNS_RECORDA = core::ptr::null_mut(); + let status = DnsQuery_UTF8(host, DNS_TYPE_PTR as u16, DNS_QUERY_STANDARD, core::ptr::null_mut(), &mut p_query_results as *mut *mut DNS_RECORDA, core::ptr::null_mut()); + if status != 0 { + return Err("Failed to resolve PTR record".to_owned()); + } + + let mut p_record: *mut DNS_RECORDA = p_query_results; + while !p_record.is_null() { + if (*p_record).wType == DNS_TYPE_PTR as u16 { + let p_name_host: PSTR = (*p_record).Data.PTR.pNameHost; + let c_str: &CStr = CStr::from_ptr(p_name_host.0 as *const i8); + if let Ok(str_slice) = c_str.to_str() { + let str_buf: String = str_slice.to_owned(); + return Ok(str_buf); + } + } + p_record = (*p_record).pNext; + } + DnsFree(p_query_results as *const c_void, DnsFreeRecordList); + } + return Err("No records returned".to_owned()); + } else { + let resolver = get_resolver().await?; + let ptr_result = resolver + .reverse_lookup(ip_addr) + .await + .map_err(|e| e.to_string())?; + if let Some(r) = ptr_result.iter().next() { + Ok(r.to_string().trim_end_matches('.').to_string()) + } else { + Err("PTR lookup returned an empty string".to_owned()) + } + } } } diff --git a/veilid-core/src/intf/native/utils/network_interfaces/mod.rs b/veilid-core/src/intf/native/utils/network_interfaces/mod.rs index 8dee7aae..514973e5 100644 --- a/veilid-core/src/intf/native/utils/network_interfaces/mod.rs +++ b/veilid-core/src/intf/native/utils/network_interfaces/mod.rs @@ -5,15 +5,15 @@ mod tools; cfg_if::cfg_if! { if #[cfg(any(target_os = "linux", target_os = "android"))] { mod netlink; - use netlink::PlatformSupportNetlink as PlatformSupport; + use self::netlink::PlatformSupportNetlink as PlatformSupport; } else if #[cfg(target_os = "windows")] { mod windows; mod sockaddr_tools; - use windows::PlatformSupportWindows as PlatformSupport; + use self::windows::PlatformSupportWindows as PlatformSupport; } else if #[cfg(any(target_os = "macos", target_os = "ios"))] { mod apple; mod sockaddr_tools; - use apple::PlatformSupportApple as PlatformSupport; + use self::apple::PlatformSupportApple as PlatformSupport; } else { compile_error!("No network interfaces support for this platform!"); } diff --git a/veilid-flutter/windows/rust.cmake b/veilid-flutter/windows/rust.cmake index 141fe937..66c040e2 100644 --- a/veilid-flutter/windows/rust.cmake +++ b/veilid-flutter/windows/rust.cmake @@ -9,12 +9,12 @@ include(FetchContent) FetchContent_Declare( Corrosion GIT_REPOSITORY https://github.com/AndrewGaspar/corrosion.git - GIT_TAG origin/master # Optionally specify a version tag or branch here + GIT_TAG v0.2.1 # Optionally specify a version tag or branch here ) FetchContent_MakeAvailable(Corrosion) -corrosion_import_crate(MANIFEST_PATH ${CMAKE_SOURCE_DIR}/../../rust/Cargo.toml) +corrosion_import_crate(MANIFEST_PATH ${CMAKE_SOURCE_DIR}/../../rust/Cargo.toml CRATES veilid-flutter FEATURES rt-tokio ) # Flutter-specific