diff --git a/.bumpversion.cfg b/.bumpversion.cfg new file mode 100644 index 00000000..16ad022b --- /dev/null +++ b/.bumpversion.cfg @@ -0,0 +1,34 @@ +[bumpversion] +current_version = 0.1.1 + +[bumpversion:file:veilid-server/Cargo.toml] +search = version = "{current_version}" +replace = version = "{new_version}" + +[bumpversion:file:veilid-flutter/rust/Cargo.toml] +search = version = "{current_version}" +replace = version = "{new_version}" + +[bumpversion:file:veilid-wasm/Cargo.toml] +search = version = "{current_version}" +replace = version = "{new_version}" + +[bumpversion:file:veilid-core/Cargo.toml] +search = version = "{current_version}" +replace = version = "{new_version}" + +[bumpversion:file:veilid-cli/Cargo.toml] +search = version = "{current_version}" +replace = version = "{new_version}" + +[bumpversion:file:veilid-tools/Cargo.toml] +search = version = "{current_version}" +replace = version = "{new_version}" + +[bumpversion:file:veilid-python/pyproject.toml] +search = version = "{current_version}" +replace = version = "{new_version}" + +[bumpversion:file:veilid-flutter/pubspec.yaml] +search = version: {current_version} +replace = version: {new_version} diff --git a/Cargo.lock b/Cargo.lock index 97c76291..9088eb4c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" +checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" dependencies = [ "gimli", ] @@ -79,32 +79,11 @@ dependencies = [ "atomic", ] -[[package]] -name = "alloc_counter" -version = "0.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a8c3a0a472b3a556e269be64dc65a5c013ba85e940d089367eb8c88f3fdfda9" -dependencies = [ - "alloc_counter_macro", - "pin-utils", -] - -[[package]] -name = "alloc_counter_macro" -version = "0.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a52f81f9add01deacdc1fcb05ba09523a8faefdec6c3f69cb752b9fa9c22e5a" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "allocator-api2" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56fc6cf8dc8c4158eed8649f9b8b0ea1518eb62b544fe9490d66fa0b349eafe9" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" [[package]] name = "android-logd-logger" @@ -120,7 +99,7 @@ dependencies = [ "redox_syscall 0.2.16", "thiserror", "time 0.2.27", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -156,12 +135,6 @@ dependencies = [ "libc", ] -[[package]] -name = "anes" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" - [[package]] name = "ansi-parser" version = "0.8.0" @@ -178,20 +151,14 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" dependencies = [ - "winapi 0.3.9", + "winapi", ] -[[package]] -name = "anstyle" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" - [[package]] name = "anyhow" -version = "1.0.71" +version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" +checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" [[package]] name = "arboard" @@ -209,18 +176,19 @@ dependencies = [ "once_cell", "parking_lot 0.12.1", "thiserror", - "winapi 0.3.9", + "winapi", "x11rb", ] [[package]] name = "argon2" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95c2fcf79ad1932ac6269a738109997a83c227c09b75842ae564dc8ede6a861c" +checksum = "b2e554a8638bdc1e4eae9984845306cc95f8a9208ba8d49c3859fd958b46774d" dependencies = [ "base64ct", "blake2", + "cpufeatures", "password-hash", ] @@ -238,9 +206,9 @@ checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" [[package]] name = "arrayvec" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8868f09ff8cea88b079da74ae569d9b8c62a23c68c746240b704ee6f7525c89c" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "as-slice" @@ -266,9 +234,9 @@ dependencies = [ [[package]] name = "async-channel" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833" +checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" dependencies = [ "concurrent-queue", "event-listener", @@ -373,7 +341,7 @@ dependencies = [ "log", "memchr", "once_cell", - "pin-project-lite 0.2.9", + "pin-project-lite", "pin-utils", "slab", "wasm-bindgen-futures", @@ -402,7 +370,7 @@ checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" dependencies = [ "async-stream-impl", "futures-core", - "pin-project-lite 0.2.9", + "pin-project-lite", ] [[package]] @@ -413,7 +381,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.26", ] [[package]] @@ -422,6 +390,18 @@ version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ecc7ab41815b3c653ccd2978ec3255c81349336702dfdf62ee6f7069b12a3aae" +[[package]] +name = "async-tls" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7e7fbc0843fc5ad3d5ca889c5b2bea9130984d34cd0e62db57ab70c2529a8e3" +dependencies = [ + "futures", + "rustls 0.18.1", + "webpki 0.21.4", + "webpki-roots 0.20.0", +] + [[package]] name = "async-tls" version = "0.11.0" @@ -444,20 +424,20 @@ dependencies = [ "futures-core", "futures-io", "rustls 0.20.8", - "rustls-pemfile 1.0.2", + "rustls-pemfile 1.0.3", "webpki 0.22.0", "webpki-roots 0.22.6", ] [[package]] name = "async-trait" -version = "0.1.68" +version = "0.1.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" +checksum = "a564d521dd56509c4c47480d00b80ee55f7e385ae48db5744c67ad50c92d2ebf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.26", ] [[package]] @@ -466,6 +446,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5c45a0dd44b7e6533ac4e7acc38ead1a3b39885f5bbb738140d30ea528abc7c" dependencies = [ + "async-tls 0.9.0", "futures-io", "futures-util", "log", @@ -483,7 +464,7 @@ dependencies = [ "futures-io", "futures-util", "log", - "pin-project-lite 0.2.9", + "pin-project-lite", "tungstenite 0.19.0", ] @@ -499,9 +480,9 @@ dependencies = [ "futures-task", "futures-timer", "futures-util", - "pin-project 1.1.0", + "pin-project 1.1.2", "rustc_version 0.4.0", - "tokio 1.28.2", + "tokio", "wasm-bindgen-futures", ] @@ -548,7 +529,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ "hermit-abi 0.1.19", "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -576,7 +557,7 @@ dependencies = [ "memchr", "mime", "percent-encoding", - "pin-project-lite 0.2.9", + "pin-project-lite", "rustversion", "serde", "sync_wrapper", @@ -604,15 +585,15 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.67" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" +checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" dependencies = [ "addr2line", "cc", "cfg-if 1.0.0", "libc", - "miniz_oxide 0.6.2", + "miniz_oxide", "object", "rustc-demangle", ] @@ -697,21 +678,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.3.2" +version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dbe3c979c178231552ecba20214a8272df4e09f232a87aef4320cf06539aded" - -[[package]] -name = "bitvec" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" -dependencies = [ - "funty", - "radium", - "tap", - "wyz", -] +checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" [[package]] name = "blake2" @@ -724,9 +693,9 @@ dependencies = [ [[package]] name = "blake3" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "729b71f35bd3fa1a4c86b85d32c8b9069ea7fe14f7a53cfabb65f62d4265b888" +checksum = "199c42ab6972d92c9f8995f086273d25c42fc0f7b2a1fcefba465c1352d25ba5" dependencies = [ "arrayref", "arrayvec", @@ -825,34 +794,6 @@ version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" -[[package]] -name = "byte-slice-cast" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" - -[[package]] -name = "bytecheck" -version = "0.6.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6372023ac861f6e6dc89c8344a8f398fb42aaba2b5dbc649ca0c0e9dbcb627" -dependencies = [ - "bytecheck_derive", - "ptr_meta", - "simdutf8", -] - -[[package]] -name = "bytecheck_derive" -version = "0.6.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7ec4c6f261935ad534c0c22dbef2201b45918860eb1c574b972bd213a76af61" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "bytemuck" version = "1.13.1" @@ -885,19 +826,13 @@ checksum = "95e65021d89250bbfe7c2791789ced2c4bdc21b0e8bb59c64f3fd6145a5fd678" [[package]] name = "capnpc" -version = "0.17.1" +version = "0.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93a9ad66f56468a890565d818ec4ab1300c1f6c62adbbc3295392f61d8f7dbd7" +checksum = "fbbc3763fb3e6635188e9cc51ee11a26f8777c553ca377430818dbebaaf6042b" dependencies = [ "capnp", ] -[[package]] -name = "cast" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" - [[package]] name = "cc" version = "1.0.79" @@ -988,34 +923,7 @@ dependencies = [ "num-traits", "time 0.1.45", "wasm-bindgen", - "winapi 0.3.9", -] - -[[package]] -name = "ciborium" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "effd91f6c78e5a4ace8a5d3c0b6bfaec9e2baaef55f3efc00e45fb2e477ee926" -dependencies = [ - "ciborium-io", - "ciborium-ll", - "serde", -] - -[[package]] -name = "ciborium-io" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdf919175532b369853f5d5e20b26b43112613fd6fe7aee757e35f7a44642656" - -[[package]] -name = "ciborium-ll" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "defaa24ecc093c77630e6c15e17c51f5e187bf35ee514f4e2d67baaa96dae22b" -dependencies = [ - "ciborium-io", - "half", + "winapi", ] [[package]] @@ -1071,33 +979,13 @@ checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" dependencies = [ "atty", "bitflags 1.3.2", - "clap_lex 0.2.4", - "indexmap", + "clap_lex", + "indexmap 1.9.3", "strsim 0.10.0", "termcolor", "textwrap 0.16.0", ] -[[package]] -name = "clap" -version = "4.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80672091db20273a15cf9fdd4e47ed43b5091ec9841bf4c6145c9dfbbcae09ed" -dependencies = [ - "clap_builder", -] - -[[package]] -name = "clap_builder" -version = "4.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1458a1df40e1e2afebb7ab60ce55c1fa8f431146205aa5f4887e0b111c27636" -dependencies = [ - "anstyle", - "bitflags 1.3.2", - "clap_lex 0.5.0", -] - [[package]] name = "clap_lex" version = "0.2.4" @@ -1107,12 +995,6 @@ dependencies = [ "os_str_bytes", ] -[[package]] -name = "clap_lex" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" - [[package]] name = "clipboard-win" version = "4.5.0" @@ -1121,7 +1003,7 @@ checksum = "7191c27c2357d9b7ef96baac1773290d4ca63b24205b82a3fd8a0637afcf0362" dependencies = [ "error-code", "str-buf", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1204,9 +1086,9 @@ dependencies = [ [[package]] name = "console-subscriber" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57ab2224a0311582eb03adba4caaf18644f7b1f10a760803a803b9b605187fc7" +checksum = "d4cf42660ac07fcebed809cfe561dd8730bcd35b075215e6479c516bcd0d11cb" dependencies = [ "console-api", "crossbeam-channel", @@ -1218,7 +1100,7 @@ dependencies = [ "serde", "serde_json", "thread_local", - "tokio 1.28.2", + "tokio", "tokio-stream", "tonic 0.9.2", "tracing", @@ -1236,16 +1118,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "console_log" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89f72f65e8501878b8a004d5a1afb780987e2ce2b4532c562e367a72c57499f" -dependencies = [ - "log", - "web-sys", -] - [[package]] name = "const_fn" version = "0.4.9" @@ -1254,9 +1126,9 @@ checksum = "fbdcdcb6d86f71c5e97409ad45898af11cbc995b4ee8112d59095a28d376c935" [[package]] name = "constant_time_eq" -version = "0.2.6" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21a53c0a4d288377e7415b53dcfc3c04da5cdc2cc95c8d5ac178b58f0b861ad6" +checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" [[package]] name = "core-foundation" @@ -1316,9 +1188,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03e69e28e9f7f77debdedbaafa2866e1de9ba56df55a8bd7cfc724c25a09987c" +checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" dependencies = [ "libc", ] @@ -1332,43 +1204,6 @@ dependencies = [ "cfg-if 1.0.0", ] -[[package]] -name = "criterion" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2b12d017a929603d80db1831cd3a24082f8137ce19c69e6447f54f5fc8d692f" -dependencies = [ - "anes", - "cast", - "ciborium", - "clap 4.3.4", - "criterion-plot", - "futures", - "is-terminal", - "itertools", - "num-traits", - "once_cell", - "oorandom", - "plotters", - "rayon", - "regex", - "serde", - "serde_derive", - "serde_json", - "tinytemplate", - "walkdir", -] - -[[package]] -name = "criterion-plot" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" -dependencies = [ - "cast", - "itertools", -] - [[package]] name = "crossbeam-channel" version = "0.5.8" @@ -1379,30 +1214,6 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "crossbeam-deque" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" -dependencies = [ - "cfg-if 1.0.0", - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" -dependencies = [ - "autocfg", - "cfg-if 1.0.0", - "crossbeam-utils", - "memoffset 0.9.0", - "scopeguard", -] - [[package]] name = "crossbeam-utils" version = "0.8.16" @@ -1421,11 +1232,11 @@ dependencies = [ "bitflags 1.3.2", "crossterm_winapi", "libc", - "mio 0.8.8", + "mio", "parking_lot 0.12.1", "signal-hook", "signal-hook-mio", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1434,15 +1245,9 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" dependencies = [ - "winapi 0.3.9", + "winapi", ] -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - [[package]] name = "crypto-common" version = "0.1.6" @@ -1487,7 +1292,7 @@ dependencies = [ "libc", "log", "signal-hook", - "tokio 1.28.2", + "tokio", "unicode-segmentation", "unicode-width", ] @@ -1502,7 +1307,7 @@ dependencies = [ "flexi_logger", "lazy_static", "log", - "time 0.3.22", + "time 0.3.9", "unicode-width", ] @@ -1517,7 +1322,7 @@ dependencies = [ [[package]] name = "cursive_buffered_backend" -version = "0.6.1-pre" +version = "0.6.1" dependencies = [ "cursive_core", "enumset", @@ -1544,9 +1349,9 @@ dependencies = [ "owning_ref", "serde_json", "serde_yaml", - "time 0.3.22", - "tokio 1.28.2", - "toml 0.7.4", + "time 0.3.9", + "tokio", + "toml 0.7.6", "unicode-segmentation", "unicode-width", "xi-unicode", @@ -1595,12 +1400,12 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.1" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0558d22a7b463ed0241e993f76f09f30b126687447751a8638587b864e4b3944" +checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" dependencies = [ - "darling_core 0.20.1", - "darling_macro 0.20.1", + "darling_core 0.20.3", + "darling_macro 0.20.3", ] [[package]] @@ -1619,15 +1424,15 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.1" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab8bfa2e259f8ee1ce5e97824a3c55ec4404a0d772ca7fa96bf19f0752a046eb" +checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.26", ] [[package]] @@ -1643,23 +1448,23 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.20.1" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29a358ff9f12ec09c3e61fef9b5a9902623a695a46a917b07f269bff1445611a" +checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ - "darling_core 0.20.1", + "darling_core 0.20.3", "quote", - "syn 2.0.18", + "syn 2.0.26", ] [[package]] name = "dashmap" -version = "5.4.0" +version = "5.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc" +checksum = "6943ae99c34386c84a470c499d3414f66502a41340aa895406e0d2e4a207b91d" dependencies = [ "cfg-if 1.0.0", - "hashbrown 0.12.3", + "hashbrown 0.14.0", "lock_api", "once_cell", "parking_lot_core 0.9.8", @@ -1719,7 +1524,7 @@ checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" dependencies = [ "libc", "redox_users", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1736,9 +1541,9 @@ checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257" [[package]] name = "dyn-clone" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b0cf012f1230e43cd00ebb729c6bb58707ecfa8ad08b52ef3a4ccd2697fc30" +checksum = "304e6508efa593091e97a9abbc10f90aa7ca635b6d2784feff3c89d41dd12272" [[package]] name = "ed25519" @@ -1782,22 +1587,22 @@ dependencies = [ [[package]] name = "enum-map" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "988f0d17a0fa38291e5f41f71ea8d46a5d5497b9054d5a759fae2cbb819f2356" +checksum = "017b207acb4cc917f4c31758ed95c0bc63ddb0f358b22eb38f80a2b2a43f6b1f" dependencies = [ "enum-map-derive", ] [[package]] name = "enum-map-derive" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a4da76b3b6116d758c7ba93f7ec6a35d2e2cf24feda76c6e38a375f4d5c59f2" +checksum = "8560b409800a72d2d7860f8e5f4e0b0bd22bea6a352ea2a9ce30ccdef7f16d2f" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.26", ] [[package]] @@ -1837,10 +1642,10 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e08b6c6ab82d70f08844964ba10c7babb716de2ecaeab9be5717918a5177d3af" dependencies = [ - "darling 0.20.1", + "darling 0.20.3", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.26", ] [[package]] @@ -1876,6 +1681,12 @@ dependencies = [ "regex", ] +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "errno" version = "0.3.1" @@ -1907,33 +1718,6 @@ dependencies = [ "str-buf", ] -[[package]] -name = "ethbloom" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" -dependencies = [ - "crunchy", - "fixed-hash", - "impl-rlp", - "impl-serde", - "tiny-keccak", -] - -[[package]] -name = "ethereum-types" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" -dependencies = [ - "ethbloom", - "fixed-hash", - "impl-rlp", - "impl-serde", - "primitive-types", - "uint", -] - [[package]] name = "event-listener" version = "2.5.3" @@ -2012,18 +1796,6 @@ dependencies = [ "log", ] -[[package]] -name = "fixed-hash" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" -dependencies = [ - "byteorder", - "rand 0.8.5", - "rustc-hex", - "static_assertions", -] - [[package]] name = "fixedbitset" version = "0.4.2" @@ -2037,7 +1809,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" dependencies = [ "crc32fast", - "miniz_oxide 0.7.1", + "miniz_oxide", ] [[package]] @@ -2055,7 +1827,7 @@ dependencies = [ "regex", "rustversion", "thiserror", - "time 0.3.22", + "time 0.3.9", ] [[package]] @@ -2067,7 +1839,7 @@ dependencies = [ "futures-core", "futures-sink", "nanorand", - "pin-project 1.1.0", + "pin-project 1.1.2", "spin 0.9.8", ] @@ -2114,31 +1886,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cef5c93884e5cef757f63446122c2f420713c3e03f85540d09485b9415983b4a" dependencies = [ "libc", - "winapi 0.3.9", + "winapi", ] -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags 1.3.2", - "fuchsia-zircon-sys", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" - -[[package]] -name = "funty" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" - [[package]] name = "futures" version = "0.3.28" @@ -2198,7 +1948,7 @@ dependencies = [ "futures-io", "memchr", "parking", - "pin-project-lite 0.2.9", + "pin-project-lite", "waker-fn", ] @@ -2210,7 +1960,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.26", ] [[package]] @@ -2248,16 +1998,16 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project-lite 0.2.9", + "pin-project-lite", "pin-utils", "slab", ] [[package]] name = "gen_ops" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7c56cad8ee78109d547e40bf4ad78968a25157e7963d799d79921655629825a" +checksum = "304de19db7028420975a296ab0fcbbc8e69438c4ed254a1e41e2a7f37d5f0e0a" [[package]] name = "generic-array" @@ -2294,7 +2044,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1ebd34e35c46e00bb73e81363248d627782724609fe1b6396f553f68fe3862e" dependencies = [ "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2347,9 +2097,9 @@ dependencies = [ [[package]] name = "gloo-utils" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8e8fc851e9c7b9852508bc6e3f690f452f474417e8545ec9857b7f7377036b5" +checksum = "037fcb07216cb3a30f7292bd0176b050b7b9a052ba830ef7d5d65f6dc64ba58e" dependencies = [ "js-sys", "serde", @@ -2390,9 +2140,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.19" +version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d357c7ae988e7d2182f7d7871d0b963962420b0678b0997ce7de72001aeab782" +checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" dependencies = [ "bytes 1.4.0", "fnv", @@ -2400,9 +2150,9 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap", + "indexmap 1.9.3", "slab", - "tokio 1.28.2", + "tokio", "tokio-util", "tracing", ] @@ -2509,18 +2259,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.2.6" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] - -[[package]] -name = "hermit-abi" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" [[package]] name = "hex" @@ -2556,7 +2297,7 @@ checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" dependencies = [ "libc", "match_cfg", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2578,7 +2319,7 @@ checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ "bytes 1.4.0", "http", - "pin-project-lite 0.2.9", + "pin-project-lite", ] [[package]] @@ -2601,9 +2342,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.26" +version = "0.14.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab302d72a6f11a3b910431ff93aae7e773078c769f0a3ef15fb9ec692ed147d4" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" dependencies = [ "bytes 1.4.0", "futures-channel", @@ -2615,9 +2356,9 @@ dependencies = [ "httparse", "httpdate", "itoa", - "pin-project-lite 0.2.9", + "pin-project-lite", "socket2 0.4.9", - "tokio 1.28.2", + "tokio", "tower-service", "tracing", "want", @@ -2630,8 +2371,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ "hyper", - "pin-project-lite 0.2.9", - "tokio 1.28.2", + "pin-project-lite", + "tokio", "tokio-io-timeout", ] @@ -2700,16 +2441,8 @@ name = "igd" version = "0.12.1" dependencies = [ "attohttpc", - "bytes 1.4.0", - "futures", - "http", - "hyper", "log", "rand 0.8.5", - "simplelog 0.9.0", - "tokio 0.2.25", - "tokio 0.3.7", - "tokio 1.28.2", "url", "xmltree", ] @@ -2729,44 +2462,6 @@ dependencies = [ "tiff", ] -[[package]] -name = "impl-codec" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" -dependencies = [ - "parity-scale-codec", -] - -[[package]] -name = "impl-rlp" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" -dependencies = [ - "rlp", -] - -[[package]] -name = "impl-serde" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" -dependencies = [ - "serde", -] - -[[package]] -name = "impl-trait-for-tuples" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "indent" version = "0.1.1" @@ -2789,6 +2484,16 @@ dependencies = [ "hashbrown 0.12.3", ] +[[package]] +name = "indexmap" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +dependencies = [ + "equivalent", + "hashbrown 0.14.0", +] + [[package]] name = "inout" version = "0.1.3" @@ -2825,20 +2530,11 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ - "hermit-abi 0.3.1", + "hermit-abi 0.3.2", "libc", "windows-sys 0.48.0", ] -[[package]] -name = "iovec" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" -dependencies = [ - "libc", -] - [[package]] name = "ipconfig" version = "0.3.2" @@ -2853,21 +2549,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.7.2" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12b6ee2129af8d4fb011108c73d99a1b83a85977f23b82460c0ae2e25bb4b57f" - -[[package]] -name = "is-terminal" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" -dependencies = [ - "hermit-abi 0.3.1", - "io-lifetimes", - "rustix", - "windows-sys 0.48.0", -] +checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" [[package]] name = "itertools" @@ -2880,9 +2564,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "jni" @@ -2952,26 +2636,6 @@ dependencies = [ "serde", ] -[[package]] -name = "keccak-hash" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b286e6b663fb926e1eeb68528e69cb70ed46c6d65871a21b2215ae8154c6d3c" -dependencies = [ - "primitive-types", - "tiny-keccak", -] - -[[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 = "keychain-services" version = "0.0.2" @@ -3005,7 +2669,7 @@ dependencies = [ "serde", "serde_cbor", "snailquote", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -3020,40 +2684,18 @@ name = "keyvaluedb-memorydb" version = "0.1.0" dependencies = [ "keyvaluedb", - "keyvaluedb-shared-tests", "parking_lot 0.12.1", - "tokio 1.28.2", - "wasm-bindgen-futures", - "wasm-bindgen-test", -] - -[[package]] -name = "keyvaluedb-shared-tests" -version = "0.1.0" -dependencies = [ - "keyvaluedb", ] [[package]] name = "keyvaluedb-sqlite" version = "0.1.0" dependencies = [ - "alloc_counter", - "chrono", - "criterion", - "ctrlc", - "ethereum-types", "hex", - "keccak-hash", "keyvaluedb", - "keyvaluedb-shared-tests", "log", "parking_lot 0.12.1", - "rand 0.8.5", "rusqlite", - "sysinfo 0.29.2", - "tempfile", - "tokio 1.28.2", ] [[package]] @@ -3061,19 +2703,15 @@ name = "keyvaluedb-web" version = "0.1.0" dependencies = [ "async-lock", - "console_log", "flume", "futures", "js-sys", "keyvaluedb", "keyvaluedb-memorydb", - "keyvaluedb-shared-tests", "log", "parking_lot 0.11.2", "send_wrapper 0.6.0", "wasm-bindgen", - "wasm-bindgen-futures", - "wasm-bindgen-test", "web-sys", ] @@ -3100,9 +2738,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.146" +version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] name = "libloading" @@ -3111,7 +2749,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" dependencies = [ "cfg-if 1.0.0", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -3177,6 +2815,12 @@ dependencies = [ "linked-hash-map", ] +[[package]] +name = "lz4_flex" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ea9b256699eda7b0387ffbc776dd625e28bde3918446381781245b7a50349d8" + [[package]] name = "malloc_buf" version = "0.0.6" @@ -3186,12 +2830,6 @@ dependencies = [ "libc", ] -[[package]] -name = "maplit" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" - [[package]] name = "match_cfg" version = "0.1.0" @@ -3204,7 +2842,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" dependencies = [ - "regex-automata", + "regex-automata 0.1.10", ] [[package]] @@ -3243,15 +2881,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "memoffset" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" -dependencies = [ - "autocfg", -] - [[package]] name = "memory_units" version = "0.4.0" @@ -3270,15 +2899,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" -[[package]] -name = "miniz_oxide" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" -dependencies = [ - "adler", -] - [[package]] name = "miniz_oxide" version = "0.7.1" @@ -3289,38 +2909,6 @@ dependencies = [ "simd-adler32", ] -[[package]] -name = "mio" -version = "0.6.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" -dependencies = [ - "cfg-if 0.1.10", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", - "libc", - "log", - "miow 0.2.2", - "net2", - "slab", - "winapi 0.2.8", -] - -[[package]] -name = "mio" -version = "0.7.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc" -dependencies = [ - "libc", - "log", - "miow 0.3.7", - "ntapi 0.3.7", - "winapi 0.3.9", -] - [[package]] name = "mio" version = "0.8.8" @@ -3333,38 +2921,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "mio-uds" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" -dependencies = [ - "iovec", - "libc", - "mio 0.6.23", -] - -[[package]] -name = "miow" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" -dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", -] - -[[package]] -name = "miow" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" -dependencies = [ - "winapi 0.3.9", -] - [[package]] name = "multimap" version = "0.8.3" @@ -3458,34 +3014,22 @@ dependencies = [ "jni-sys", ] -[[package]] -name = "net2" -version = "0.2.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b13b648036a2339d06de780866fbdfda0dde886de7b3af2ddeba8b14f4ee34ac" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "winapi 0.3.9", -] - [[package]] name = "netlink-packet-core" -version = "0.5.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e5cf0b54effda4b91615c40ff0fd12d0d4c9a6e0f5116874f03941792ff535a" +checksum = "72724faf704479d67b388da142b186f916188505e7e0b26719019c525882eda4" dependencies = [ "anyhow", "byteorder", - "libc", "netlink-packet-utils", ] [[package]] name = "netlink-packet-route" -version = "0.15.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea993e32c77d87f01236c38f572ecb6c311d592e56a06262a007fd2a6e31253c" +checksum = "f6de2fe935f44cbdfcab77dce2150d68eda75be715cd42d4d6f52b0bd4dcc5b1" dependencies = [ "anyhow", "bitflags 1.3.2", @@ -3509,9 +3053,9 @@ dependencies = [ [[package]] name = "netlink-proto" -version = "0.11.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26305d12193227ef7b8227e7d61ae4eaf174607f79bd8eeceff07aacaefde497" +checksum = "842c6770fc4bb33dd902f41829c61ef872b8e38de1405aa0b938b27b8fba12c3" dependencies = [ "bytes 1.4.0", "futures", @@ -3519,7 +3063,7 @@ dependencies = [ "netlink-packet-core", "netlink-sys", "thiserror", - "tokio 1.28.2", + "tokio", ] [[package]] @@ -3533,7 +3077,7 @@ dependencies = [ "futures", "libc", "log", - "tokio 1.28.2", + "tokio", ] [[package]] @@ -3605,22 +3149,13 @@ dependencies = [ "minimal-lexical", ] -[[package]] -name = "ntapi" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" -dependencies = [ - "winapi 0.3.9", -] - [[package]] name = "ntapi" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8a3895c6391c39d7fe7ebc444a87eb2991b2a0bc718fdabd071eec617fc68e4" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -3630,14 +3165,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" dependencies = [ "overload", - "winapi 0.3.9", + "winapi", ] [[package]] name = "num" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43db66d1170d347f9a065114077f7dccb00c1b9478c89384490a3425279a4606" +checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" dependencies = [ "num-bigint", "num-complex", @@ -3711,11 +3246,11 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.2.6", + "hermit-abi 0.3.2", "libc", ] @@ -3780,9 +3315,9 @@ dependencies = [ [[package]] name = "object" -version = "0.30.4" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385" +checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" dependencies = [ "memchr", ] @@ -3793,12 +3328,6 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" -[[package]] -name = "oorandom" -version = "11.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" - [[package]] name = "opaque-debug" version = "0.3.0" @@ -3831,7 +3360,7 @@ dependencies = [ "prost", "protobuf", "thiserror", - "tokio 1.28.2", + "tokio", "tonic 0.8.3", ] @@ -3869,10 +3398,10 @@ dependencies = [ "fnv", "futures-channel", "futures-util", - "indexmap", + "indexmap 1.9.3", "js-sys", "once_cell", - "pin-project-lite 0.2.9", + "pin-project-lite", "thiserror", ] @@ -3895,7 +3424,7 @@ dependencies = [ "percent-encoding", "rand 0.8.5", "thiserror", - "tokio 1.28.2", + "tokio", "tokio-stream", ] @@ -3961,32 +3490,6 @@ dependencies = [ "tracing-subscriber", ] -[[package]] -name = "parity-scale-codec" -version = "3.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "430d26d62e66cbff6ae144e8eebd43c0235922dec7e3aa0d2016c32d4575bf45" -dependencies = [ - "arrayvec", - "bitvec", - "byte-slice-cast", - "impl-trait-for-tuples", - "parity-scale-codec-derive", - "serde", -] - -[[package]] -name = "parity-scale-codec-derive" -version = "3.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1620b1e3fc72ebaee01ff56fca838bab537c5d093a18b3549c3bbea374aa0b6" -dependencies = [ - "proc-macro-crate 1.3.1", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "parking" version = "2.1.0" @@ -4025,7 +3528,7 @@ dependencies = [ "libc", "redox_syscall 0.2.16", "smallvec", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -4038,7 +3541,7 @@ dependencies = [ "libc", "redox_syscall 0.3.5", "smallvec", - "windows-targets 0.48.0", + "windows-targets 0.48.1", ] [[package]] @@ -4054,9 +3557,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.12" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] name = "pathdiff" @@ -4078,9 +3581,9 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pest" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e68e84bfb01f0507134eac1e9b410a12ba379d064eab48c50ba4ce329a527b70" +checksum = "f73935e4d55e2abf7f130186537b19e7a4abc886a0252380b59248af473a3fc9" dependencies = [ "thiserror", "ucd-trie", @@ -4088,9 +3591,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b79d4c71c865a25a4322296122e3924d30bc8ee0834c8bfc8b95f7f054afbfb" +checksum = "aef623c9bbfa0eedf5a0efba11a5ee83209c326653ca31ff019bec3a95bfff2b" dependencies = [ "pest", "pest_generator", @@ -4098,22 +3601,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c435bf1076437b851ebc8edc3a18442796b30f1728ffea6262d59bbe28b077e" +checksum = "b3e8cba4ec22bada7fc55ffe51e2deb6a0e0db2d0b7ab0b103acc80d2510c190" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.26", ] [[package]] name = "pest_meta" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "745a452f8eb71e39ffd8ee32b3c5f51d03845f99786fa9b68db6ff509c505411" +checksum = "a01f71cb40bd8bb94232df14b946909e14660e33fc05db3e50ae2a82d7ea0ca0" dependencies = [ "once_cell", "pest", @@ -4127,7 +3630,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" dependencies = [ "fixedbitset", - "indexmap", + "indexmap 1.9.3", ] [[package]] @@ -4151,11 +3654,11 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c95a7476719eab1e366eaf73d0260af3021184f18177925b07f54b30089ceead" +checksum = "030ad2bc4db10a8944cb0d837f158bdfec4d4a4873ab701a95046770d11f8842" dependencies = [ - "pin-project-internal 1.1.0", + "pin-project-internal 1.1.2", ] [[package]] @@ -4171,26 +3674,20 @@ dependencies = [ [[package]] name = "pin-project-internal" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39407670928234ebc5e6e580247dd567ad73a3578460c5990f9503df207e8f07" +checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.26", ] [[package]] name = "pin-project-lite" -version = "0.1.12" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" - -[[package]] -name = "pin-project-lite" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57" [[package]] name = "pin-utils" @@ -4204,34 +3701,6 @@ version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" -[[package]] -name = "plotters" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2c224ba00d7cadd4d5c660deaf2098e5e80e07846537c51f9cfa4be50c1fd45" -dependencies = [ - "num-traits", - "plotters-backend", - "plotters-svg", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "plotters-backend" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e76628b4d3a7581389a35d5b6e2139607ad7c75b17aed325f210aa91f4a9609" - -[[package]] -name = "plotters-svg" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f6d39893cca0701371e3c27294f09797214b86f1fb951b89ade8ec04e2abab" -dependencies = [ - "plotters-backend", -] - [[package]] name = "png" version = "0.17.9" @@ -4242,7 +3711,7 @@ dependencies = [ "crc32fast", "fdeflate", "flate2", - "miniz_oxide 0.7.1", + "miniz_oxide", ] [[package]] @@ -4257,7 +3726,7 @@ dependencies = [ "concurrent-queue", "libc", "log", - "pin-project-lite 0.2.9", + "pin-project-lite", "windows-sys 0.48.0", ] @@ -4288,19 +3757,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "primitive-types" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f3486ccba82358b11a77516035647c34ba167dfa53312630de83b12bd4f3d66" -dependencies = [ - "fixed-hash", - "impl-codec", - "impl-rlp", - "impl-serde", - "uint", -] - [[package]] name = "proc-macro-crate" version = "0.1.5" @@ -4328,9 +3784,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.60" +version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" +checksum = "92de25114670a878b1261c79c9f8f729fb97e95bac93f6312f583c60dd6a1dfe" dependencies = [ "unicode-ident", ] @@ -4395,26 +3851,6 @@ version = "2.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94" -[[package]] -name = "ptr_meta" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" -dependencies = [ - "ptr_meta_derive", -] - -[[package]] -name = "ptr_meta_derive" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "quick-error" version = "1.2.3" @@ -4423,19 +3859,13 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.28" +version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +checksum = "5907a1b7c277254a8b15170f6e7c97cfa60ee7872a3217663bb81151e48184bb" dependencies = [ "proc-macro2", ] -[[package]] -name = "radium" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" - [[package]] name = "rand" version = "0.7.3" @@ -4509,16 +3939,14 @@ dependencies = [ [[package]] name = "range-set-blaze" -version = "0.1.6" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85443a0bf00e4fca6fc4500501c8673d3255c46d5760e8b648308c3d1b9d2203" +checksum = "cf36131a8443d1cda3cd66eeac16d60ce46aa7c415f71e12c28d95c195e3ff23" dependencies = [ "gen_ops", "itertools", "num-integer", "num-traits", - "rand 0.8.5", - "thiserror", ] [[package]] @@ -4527,28 +3955,6 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" -[[package]] -name = "rayon" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" -dependencies = [ - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-utils", - "num_cpus", -] - [[package]] name = "redox_syscall" version = "0.2.16" @@ -4580,13 +3986,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.8.4" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" +checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.7.2", + "regex-automata 0.3.3", + "regex-syntax 0.7.4", ] [[package]] @@ -4598,6 +4005,17 @@ dependencies = [ "regex-syntax 0.6.29", ] +[[package]] +name = "regex-automata" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.7.4", +] + [[package]] name = "regex-syntax" version = "0.6.29" @@ -4606,18 +4024,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" - -[[package]] -name = "rend" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581008d2099240d37fb08d77ad713bcaec2c4d89d50b5b21a8bb1996bbab68ab" -dependencies = [ - "bytecheck", -] +checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" [[package]] name = "resolv-conf" @@ -4641,45 +4050,7 @@ dependencies = [ "spin 0.5.2", "untrusted", "web-sys", - "winapi 0.3.9", -] - -[[package]] -name = "rkyv" -version = "0.7.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0200c8230b013893c0b2d6213d6ec64ed2b9be2e0e016682b7224ff82cff5c58" -dependencies = [ - "bitvec", - "bytecheck", - "hashbrown 0.12.3", - "ptr_meta", - "rend", - "rkyv_derive", - "seahash", - "tinyvec", - "uuid", -] - -[[package]] -name = "rkyv_derive" -version = "0.7.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2e06b915b5c230a17d7a736d1e2e63ee753c256a8614ef3f5147b13a4f5541d" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "rlp" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" -dependencies = [ - "bytes 1.4.0", - "rustc-hex", + "winapi", ] [[package]] @@ -4702,14 +4073,14 @@ dependencies = [ "libc", "serde", "serde_json", - "winapi 0.3.9", + "winapi", ] [[package]] name = "rtnetlink" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed7d42da676fdf7e470e2502717587dd1089d8b48d9d1b846dcc3c01072858cb" +checksum = "6333af2adba73478936174a0ef3edf05fbfa058539c21d567344a53bb6d75cfd" dependencies = [ "async-global-executor", "futures", @@ -4721,7 +4092,7 @@ dependencies = [ "netlink-sys", "nix 0.26.2", "thiserror", - "tokio 1.28.2", + "tokio", ] [[package]] @@ -4730,7 +4101,7 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "549b9d036d571d42e6e85d1c1425e2ac83491075078ca9a15be021c56b1641f2" dependencies = [ - "bitflags 2.3.2", + "bitflags 2.3.3", "fallible-iterator", "fallible-streaming-iterator", "hashlink 0.8.3", @@ -4779,12 +4150,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" -[[package]] -name = "rustc-hex" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" - [[package]] name = "rustc_version" version = "0.2.3" @@ -4800,14 +4165,14 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.17", + "semver 1.0.18", ] [[package]] name = "rustix" -version = "0.37.20" +version = "0.37.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0" +checksum = "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06" dependencies = [ "bitflags 1.3.2", "errno", @@ -4817,6 +4182,19 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "rustls" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d1126dcf58e93cee7d098dbda643b5f92ed724f1f6a63007c1116eed6700c81" +dependencies = [ + "base64 0.12.3", + "log", + "ring", + "sct 0.6.1", + "webpki 0.21.4", +] + [[package]] name = "rustls" version = "0.19.1" @@ -4853,18 +4231,18 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" +checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" dependencies = [ "base64 0.21.2", ] [[package]] name = "rustls-webpki" -version = "0.100.1" +version = "0.101.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6207cd5ed3d8dca7816f8f3725513a34609c0c765bf652b8c3cb4cfd87db46b" +checksum = "15f36a6828982f422756984e47912a7a51dcbc2a197aa791158f8ca61cd8204e" dependencies = [ "ring", "untrusted", @@ -4872,15 +4250,15 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.12" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "ryu" -version = "1.0.13" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "same-file" @@ -4947,21 +4325,6 @@ dependencies = [ "untrusted", ] -[[package]] -name = "seahash" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" - -[[package]] -name = "secrecy" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0673d6a6449f5e7d12a1caf424fd9363e2af3a4953023ed455e3c4beef4597c0" -dependencies = [ - "zeroize", -] - [[package]] name = "secret-service" version = "2.0.2" @@ -5016,9 +4379,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" +checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" [[package]] name = "semver-parser" @@ -5043,9 +4406,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.164" +version = "1.0.171" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" +checksum = "30e27d1e4fd7659406c492fd6cfaf2066ba8773de45ca75e855590f856dc34a9" dependencies = [ "serde_derive", ] @@ -5071,13 +4434,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.164" +version = "1.0.171" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" +checksum = "389894603bd18c46fa56231694f8d827779c0951a667087194cf9de94ed24682" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.26", ] [[package]] @@ -5093,9 +4456,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.97" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdf3bf93142acad5821c99197022e170842cdbc1c30482b98750c688c640842a" +checksum = "d03b412469450d4404fe8499a268edd7f8b79fecb074b0d812ad64ca21f4031b" dependencies = [ "itoa", "ryu", @@ -5104,31 +4467,31 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.12" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcec881020c684085e55a25f7fd888954d56609ef363479dc5a1305eb0d40cab" +checksum = "1d89a8107374290037607734c0b73a85db7ed80cae314b3c5791f192a496e731" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.26", ] [[package]] name = "serde_spanned" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93107647184f6027e3b7dcb2e11034cf95ffa1e3a682c67951963ac69c1c007d" +checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" dependencies = [ "serde", ] [[package]] name = "serde_yaml" -version = "0.9.21" +version = "0.9.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9d684e3ec7de3bf5466b32bd75303ac16f0736426e5a4e0d6e489559ce1249c" +checksum = "da6075b41c7e3b079e5f246eb6094a44850d3a4c25a67c581c80796c80134012" dependencies = [ - "indexmap", + "indexmap 2.0.0", "itoa", "ryu", "serde", @@ -5252,9 +4615,9 @@ checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" [[package]] name = "signal-hook" -version = "0.3.15" +version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "732768f1176d21d09e076c23a93123d40bba92d50c4058da34d45c8de8e682b9" +checksum = "b824b6e687aff278cdbf3b36f07aa52d4bd4099699324d5da86a2ebce3aa00b3" dependencies = [ "libc", "signal-hook-registry", @@ -5279,7 +4642,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af" dependencies = [ "libc", - "mio 0.8.8", + "mio", "signal-hook", ] @@ -5304,23 +4667,6 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "238abfbb77c1915110ad968465608b68e869e0772622c9656714e73e5a1a522f" -[[package]] -name = "simdutf8" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" - -[[package]] -name = "simplelog" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bc0ffd69814a9b251d43afcabf96dad1b29f5028378056257be9e3fecc9f720" -dependencies = [ - "chrono", - "log", - "termcolor", -] - [[package]] name = "simplelog" version = "0.12.1" @@ -5329,7 +4675,7 @@ checksum = "acee08041c5de3d5048c8b3f6f13fafb3026b24ba43c6a695a0c76179b844369" dependencies = [ "log", "termcolor", - "time 0.3.22", + "time 0.3.9", ] [[package]] @@ -5343,9 +4689,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" [[package]] name = "snailquote" @@ -5364,7 +4710,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" dependencies = [ "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -5471,7 +4817,7 @@ dependencies = [ "async-channel", "cfg-if 1.0.0", "futures-core", - "pin-project-lite 0.2.9", + "pin-project-lite", ] [[package]] @@ -5511,9 +4857,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.18" +version = "2.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" +checksum = "45c3457aacde3c65315de5031ec191ce46604304d2446e803d71ade03308d970" dependencies = [ "proc-macro2", "quote", @@ -5547,32 +4893,11 @@ dependencies = [ "cfg-if 1.0.0", "core-foundation-sys 0.8.4", "libc", - "ntapi 0.4.1", + "ntapi", "once_cell", - "winapi 0.3.9", + "winapi", ] -[[package]] -name = "sysinfo" -version = "0.29.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9557d0845b86eea8182f7b10dff120214fb6cd9fd937b6f4917714e546a38695" -dependencies = [ - "cfg-if 1.0.0", - "core-foundation-sys 0.8.4", - "libc", - "ntapi 0.4.1", - "once_cell", - "rayon", - "winapi 0.3.9", -] - -[[package]] -name = "tap" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" - [[package]] name = "tempfile" version = "3.6.0" @@ -5613,22 +4938,22 @@ checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" [[package]] name = "thiserror" -version = "1.0.40" +version = "1.0.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" +checksum = "a35fc5b8971143ca348fa6df4f024d4d55264f3468c71ad1c2f365b0a4d58c42" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.40" +version = "1.0.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" +checksum = "463fe12d7993d3b327787537ce8dd4dfa058de32fc2b195ef3cde03dc4771e8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.26", ] [[package]] @@ -5660,7 +4985,7 @@ checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" dependencies = [ "libc", "wasi 0.10.0+wasi-snapshot-preview1", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -5675,29 +5000,21 @@ dependencies = [ "stdweb", "time-macros 0.1.1", "version_check 0.9.4", - "winapi 0.3.9", + "winapi", ] [[package]] name = "time" -version = "0.3.22" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd" +checksum = "c2702e08a7a860f005826c6815dcac101b19b5eb330c27fe4a5928fec1d20ddd" dependencies = [ "itoa", "libc", "num_threads", - "serde", - "time-core", - "time-macros 0.2.9", + "time-macros 0.2.4", ] -[[package]] -name = "time-core" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" - [[package]] name = "time-macros" version = "0.1.1" @@ -5710,12 +5027,9 @@ dependencies = [ [[package]] name = "time-macros" -version = "0.2.9" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "372950940a5f07bf38dbe211d7283c9e6d7327df53794992d293e534c733d09b" -dependencies = [ - "time-core", -] +checksum = "42657b1a6f4d817cda8e7a0ace261fe0cc946cf3a80314390b22cc61ae080792" [[package]] name = "time-macros-impl" @@ -5730,25 +5044,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "tiny-keccak" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] - -[[package]] -name = "tinytemplate" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" -dependencies = [ - "serde", - "serde_json", -] - [[package]] name = "tinyvec" version = "1.6.0" @@ -5766,45 +5061,18 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "0.2.25" +version = "1.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6703a273949a90131b290be1fe7b039d0fc884aa1935860dfcbe056f28cd8092" -dependencies = [ - "bytes 0.5.6", - "iovec", - "lazy_static", - "libc", - "mio 0.6.23", - "mio-uds", - "pin-project-lite 0.1.12", - "slab", -] - -[[package]] -name = "tokio" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46409491c9375a693ce7032101970a54f8a2010efb77e13f70788f0d84489e39" -dependencies = [ - "autocfg", - "libc", - "mio 0.7.14", - "pin-project-lite 0.2.9", -] - -[[package]] -name = "tokio" -version = "1.28.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2" +checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da" dependencies = [ "autocfg", + "backtrace", "bytes 1.4.0", "libc", - "mio 0.8.8", + "mio", "num_cpus", "parking_lot 0.12.1", - "pin-project-lite 0.2.9", + "pin-project-lite", "signal-hook-registry", "socket2 0.4.9", "tokio-macros", @@ -5818,8 +5086,8 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" dependencies = [ - "pin-project-lite 0.2.9", - "tokio 1.28.2", + "pin-project-lite", + "tokio", ] [[package]] @@ -5830,7 +5098,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.26", ] [[package]] @@ -5840,8 +5108,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" dependencies = [ "futures-core", - "pin-project-lite 0.2.9", - "tokio 1.28.2", + "pin-project-lite", + "tokio", ] [[package]] @@ -5854,8 +5122,8 @@ dependencies = [ "futures-core", "futures-io", "futures-sink", - "pin-project-lite 0.2.9", - "tokio 1.28.2", + "pin-project-lite", + "tokio", "tracing", ] @@ -5870,9 +5138,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6135d499e69981f9ff0ef2167955a5333c35e36f6937d382974566b3d5b94ec" +checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542" dependencies = [ "serde", "serde_spanned", @@ -5882,20 +5150,20 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a76a9312f5ba4c2dec6b9161fdf25d87ad8a09256ccea5a556fef03c706a10f" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.19.10" +version = "0.19.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2380d56e8670370eee6566b0bfd4265f65b3f432e8c6d85623f728d4fa31f739" +checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" dependencies = [ - "indexmap", + "indexmap 2.0.0", "serde", "serde_spanned", "toml_datetime", @@ -5921,10 +5189,10 @@ dependencies = [ "hyper", "hyper-timeout", "percent-encoding", - "pin-project 1.1.0", + "pin-project 1.1.2", "prost", "prost-derive", - "tokio 1.28.2", + "tokio", "tokio-stream", "tokio-util", "tower", @@ -5952,9 +5220,9 @@ dependencies = [ "hyper", "hyper-timeout", "percent-encoding", - "pin-project 1.1.0", + "pin-project 1.1.2", "prost", - "tokio 1.28.2", + "tokio", "tokio-stream", "tower", "tower-layer", @@ -5983,12 +5251,12 @@ checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" dependencies = [ "futures-core", "futures-util", - "indexmap", - "pin-project 1.1.0", - "pin-project-lite 0.2.9", + "indexmap 1.9.3", + "pin-project 1.1.2", + "pin-project-lite", "rand 0.8.5", "slab", - "tokio 1.28.2", + "tokio", "tokio-util", "tower-layer", "tower-service", @@ -6015,7 +5283,7 @@ checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ "cfg-if 1.0.0", "log", - "pin-project-lite 0.2.9", + "pin-project-lite", "tracing-attributes", "tracing-core", ] @@ -6027,19 +5295,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09d48f71a791638519505cefafe162606f706c25592e4bde4d97600c0195312e" dependencies = [ "crossbeam-channel", - "time 0.3.22", + "time 0.3.9", "tracing-subscriber", ] [[package]] name = "tracing-attributes" -version = "0.1.24" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74" +checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.26", ] [[package]] @@ -6068,7 +5336,7 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" dependencies = [ - "pin-project 1.1.0", + "pin-project 1.1.2", "tracing", ] @@ -6155,9 +5423,9 @@ dependencies = [ [[package]] name = "triomphe" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1ee9bd9239c339d714d657fac840c6d2a4f9c45f4f9ec7b0975113458be78db" +checksum = "0eee8098afad3fb0c54a9007aab6804558410503ad676d4633f9c2559a00ac0f" dependencies = [ "serde", "stable_deref_trait", @@ -6183,7 +5451,7 @@ dependencies = [ "smallvec", "thiserror", "tinyvec", - "tokio 1.28.2", + "tokio", "tracing", "url", ] @@ -6203,7 +5471,7 @@ dependencies = [ "resolv-conf", "smallvec", "thiserror", - "tokio 1.28.2", + "tokio", "tracing", "trust-dns-proto", ] @@ -6260,21 +5528,9 @@ checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "ucd-trie" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" - -[[package]] -name = "uint" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" -dependencies = [ - "byteorder", - "crunchy", - "hex", - "static_assertions", -] +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" [[package]] name = "unicode-bidi" @@ -6284,9 +5540,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" [[package]] name = "unicode-normalization" @@ -6333,9 +5589,9 @@ dependencies = [ [[package]] name = "unsafe-libyaml" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1865806a559042e51ab5414598446a5871b561d21b6764f2eabb0dd481d880a6" +checksum = "f28467d3e1d3c6586d8f25fa243f544f5800fec42d97032474e17222c2b75cfa" [[package]] name = "untrusted" @@ -6360,12 +5616,6 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" -[[package]] -name = "uuid" -version = "1.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa2982af2eec27de306107c027578ff7f423d65f7250e40ce0fea8f45248b81" - [[package]] name = "valuable" version = "0.1.0" @@ -6374,9 +5624,9 @@ checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] name = "value-bag" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4d330786735ea358f3bc09eea4caa098569c1c93f342d9aca0514915022fe7e" +checksum = "d92ccd67fb88503048c01b59152a04effd0782d035a83a6d256ce6085f08f4a3" [[package]] name = "vcpkg" @@ -6421,7 +5671,7 @@ dependencies = [ "serial_test", "stop-token", "thiserror", - "tokio 1.28.2", + "tokio", "tokio-util", "veilid-tools", ] @@ -6474,7 +5724,7 @@ dependencies = [ "keyvaluedb-web", "lazy_static", "libc", - "maplit", + "lz4_flex", "ndk", "ndk-glue", "netlink-packet-route", @@ -6487,25 +5737,23 @@ dependencies = [ "parking_lot 0.12.1", "paste", "range-set-blaze", - "rkyv", "rtnetlink", "rusqlite", "rustls 0.19.1", "rustls-pemfile 0.2.1", "schemars", - "secrecy", "send_wrapper 0.6.0", "serde", "serde-big-array", "serde_json", "serial_test", "shell-words", - "simplelog 0.12.1", + "simplelog", "socket2 0.5.3", "static_assertions", "stop-token", "thiserror", - "tokio 1.28.2", + "tokio", "tokio-stream", "tokio-util", "tracing", @@ -6522,9 +5770,9 @@ dependencies = [ "weak-table", "web-sys", "webpki 0.22.0", - "webpki-roots 0.23.1", + "webpki-roots 0.24.0", "wee_alloc", - "winapi 0.3.9", + "winapi", "windows 0.38.0", "windows-permissions", "ws_stream_wasm", @@ -6551,7 +5799,7 @@ dependencies = [ "parking_lot 0.12.1", "serde", "serde_json", - "tokio 1.28.2", + "tokio", "tokio-stream", "tokio-util", "tracing", @@ -6566,7 +5814,7 @@ version = "0.1.0" dependencies = [ "ansi_term", "async-std", - "async-tungstenite 0.22.2", + "async-tungstenite 0.8.0", "backtrace", "bugsalot", "cfg-if 1.0.0", @@ -6582,11 +5830,11 @@ dependencies = [ "hostname", "json", "lazy_static", - "nix 0.26.2", + "nix 0.22.3", "opentelemetry", "opentelemetry-otlp", "opentelemetry-semantic-conventions", - "parking_lot 0.12.1", + "parking_lot 0.11.2", "rpassword", "serde", "serde_derive", @@ -6595,8 +5843,8 @@ dependencies = [ "signal-hook", "signal-hook-async-std", "stop-token", - "sysinfo 0.28.4", - "tokio 1.28.2", + "sysinfo", + "tokio", "tokio-stream", "tokio-util", "tracing", @@ -6632,7 +5880,6 @@ dependencies = [ "lazy_static", "libc", "log", - "maplit", "ndk", "ndk-glue", "nix 0.26.2", @@ -6645,11 +5892,11 @@ dependencies = [ "rust-fsm", "send_wrapper 0.6.0", "serial_test", - "simplelog 0.12.1", + "simplelog", "static_assertions", "stop-token", "thiserror", - "tokio 1.28.2", + "tokio", "tokio-util", "tracing", "tracing-oslog", @@ -6764,7 +6011,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.26", "wasm-bindgen-shared", ] @@ -6798,7 +6045,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.26", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -6880,6 +6127,15 @@ dependencies = [ "untrusted", ] +[[package]] +name = "webpki-roots" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f20dea7535251981a9670857150d571846545088359b28e4951d350bdaf179f" +dependencies = [ + "webpki 0.21.4", +] + [[package]] name = "webpki-roots" version = "0.21.1" @@ -6900,9 +6156,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.23.1" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b03058f88386e5ff5310d9111d53f48b17d732b401aeb83a8d5190f2ac459338" +checksum = "b291546d5d9d1eab74f069c77749f2cb8504a12caa20f0f2de93ddbf6f411888" dependencies = [ "rustls-webpki", ] @@ -6916,7 +6172,7 @@ dependencies = [ "cfg-if 0.1.10", "libc", "memory_units", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -6959,12 +6215,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f44b95f62d34113cf558c93511ac93027e03e9c29a60dd0fd70e6e025c7270a" -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" - [[package]] name = "winapi" version = "0.3.9" @@ -6975,12 +6225,6 @@ dependencies = [ "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" @@ -6993,7 +6237,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -7002,7 +6246,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44c17110f57155602a80dca10be03852116403c9ff3cd25b079d666f2aa3df6e" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -7030,7 +6274,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-targets 0.48.0", + "windows-targets 0.48.1", ] [[package]] @@ -7040,7 +6284,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e2ccdc3c6bf4d4a094e031b63fadd08d8e42abd259940eb8aa5fdc09d4bf9be" dependencies = [ "bitflags 1.3.2", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -7069,7 +6313,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.0", + "windows-targets 0.48.1", ] [[package]] @@ -7089,9 +6333,9 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.0" +version = "0.48.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" dependencies = [ "windows_aarch64_gnullvm 0.48.0", "windows_aarch64_msvc 0.48.0", @@ -7218,9 +6462,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.4.7" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca0ace3845f0d96209f0375e6d367e3eb87eb65d27d445bdc9f1843a26f39448" +checksum = "81fac9742fd1ad1bd9643b991319f72dd031016d44b77039a26977eb667141e7" dependencies = [ "memchr", ] @@ -7235,16 +6479,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "ws2_32-sys" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - [[package]] name = "ws_stream_wasm" version = "0.7.4" @@ -7264,15 +6498,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "wyz" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" -dependencies = [ - "tap", -] - [[package]] name = "x11rb" version = "0.10.1" @@ -7281,7 +6506,7 @@ checksum = "592b4883219f345e712b3209c62654ebda0bb50887f330cbd018d0f654bfd507" dependencies = [ "gethostname", "nix 0.24.3", - "winapi 0.3.9", + "winapi", "winapi-wsapoll", "x11rb-protocol", ] @@ -7314,9 +6539,9 @@ checksum = "a67300977d3dc3f8034dae89778f502b6ba20b269527b3223ba59c0cf393bb8a" [[package]] name = "xml-rs" -version = "0.8.14" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52839dc911083a8ef63efa4d039d1f58b5e409f923e44c80828f206f66e5541c" +checksum = "5a56c84a8ccd4258aed21c92f70c0f6dea75356b6892ae27c24139da456f9336" [[package]] name = "xmltree" @@ -7388,7 +6613,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.26", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index e95b3f66..5de9ca41 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,8 +7,7 @@ members = [ "veilid-flutter/rust", "veilid-wasm", ] - -exclude = [ "./external/keyring-manager", "./external/cursive", "./external/hashlink" ] +exclude = [ "./external" ] [patch.crates-io] cursive = { path = "./external/cursive/cursive" } diff --git a/RELEASING.md b/RELEASING.md index f56ab501..f866b5ae 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -68,3 +68,13 @@ Occasionally a release will happen that needs to be reverted. This is done manua > * Standalone RedHat/CentOS RPM file as a 'release file' on the `veilid` GitLab repository > * Pushed to Yum repository at https://packages.veilid.com +### Version Numbering: + +All versions of Veilid Rust crates as well as `veilid-python` and `veilid-flutter` packages are versioned using Semver. Versions can differ per crate and package, and it is important for the Semver rules to be followed (https://semver.org/): + +* MAJOR version when you make incompatible API changes +* MINOR version when you add functionality in a backward compatible manner +* PATCH version when you make backward compatible bug fixes + +The `version_bump.sh` script should be run on every release to stable. All of the Rust crates are versioned together and should have the same version, as well as the `veilid-python` Python package and `veilid-flutter` Flutter plugin. + diff --git a/external/cursive_buffered_backend b/external/cursive_buffered_backend index c4a7301b..89d84d57 160000 --- a/external/cursive_buffered_backend +++ b/external/cursive_buffered_backend @@ -1 +1 @@ -Subproject commit c4a7301b865d5af525fad30e76c2c5d121189943 +Subproject commit 89d84d57e1880f2b0dbc37b44a0289d8c76858bd diff --git a/setup_linux.sh b/setup_linux.sh index 1a307c9f..cd629446 100755 --- a/setup_linux.sh +++ b/setup_linux.sh @@ -85,12 +85,23 @@ else exit 1 fi +# ensure pip3 is installed +if command -v pip3 &> /dev/null; then + echo '[X] pip3 is available in the path' +else + echo 'pip3 is not available in the path' + exit 1 +fi + # install targets rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android wasm32-unknown-unknown # install cargo packages cargo install wasm-bindgen-cli wasm-pack +# install pip packages +pip3 install --upgrade bumpversion + # Install capnproto using the same mechanism as our earthly build $SCRIPTDIR/scripts/earthly/install_capnproto.sh # Install protoc using the same mechanism as our earthly build diff --git a/setup_macos.sh b/setup_macos.sh index 4a39ef8b..3f37caec 100755 --- a/setup_macos.sh +++ b/setup_macos.sh @@ -96,10 +96,18 @@ else exit 1 fi +# ensure pip3 is installed +if command -v pip3 &> /dev/null; then + echo '[X] pip3 is available in the path' +else + echo 'pip3 is not available in the path' + exit 1 +fi + # ensure we have command line tools xcode-select --install 2> /dev/null || true until [ -d /Library/Developer/CommandLineTools/usr/bin ]; do - sleep 5; + sleep 5; done # ensure packages are installed @@ -126,4 +134,7 @@ rustup target add aarch64-apple-darwin aarch64-apple-ios x86_64-apple-darwin x86 # install cargo packages cargo install wasm-bindgen-cli wasm-pack +# install pip packages +pip3 install --upgrade bumpversion + sudo gem install cocoapods diff --git a/veilid-cli/Cargo.toml b/veilid-cli/Cargo.toml index 781ee798..1b8c3c52 100644 --- a/veilid-cli/Cargo.toml +++ b/veilid-cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "veilid-cli" -version = "0.1.0" +version = "0.1.1" authors = ["John Smith "] edition = "2021" license = "LGPL-2.0-or-later OR MPL-2.0 OR (MIT AND BSD-3-Clause)" diff --git a/veilid-core/Cargo.toml b/veilid-core/Cargo.toml index baced512..bc2380c4 100644 --- a/veilid-core/Cargo.toml +++ b/veilid-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "veilid-core" -version = "0.1.0" +version = "0.1.1" authors = ["John Smith "] edition = "2021" build = "build.rs" @@ -31,100 +31,127 @@ veilid_core_android_tests = ["dep:paranoid-android"] veilid_core_ios_tests = ["dep:tracing-oslog"] network-result-extra = ["veilid-tools/network-result-extra"] +### DEPENDENCIES + [dependencies] + +# Tools veilid-tools = { path = "../veilid-tools", features = [ "tracing" ] } +paste = "1.0.12" +once_cell = "^1" +owning_ref = "^0" +backtrace = { version = "^0" } +num-traits = "0.2.15" +shell-words = "1.1.0" +static_assertions = "^1" +cfg-if = "^1" +hex = "^0" +lazy_static = "^1" +directories = "^4" + +# Logging tracing = { version = "^0", features = ["log", "attributes"] } tracing-subscriber = "^0" tracing-error = "^0" eyre = "^0" -capnp = { version = "^0", default_features = false } -static_assertions = "^1" -cfg-if = "^1" thiserror = "^1" -hex = "^0" -generic-array = "^0" -secrecy = "^0" -chacha20poly1305 = "^0" -chacha20 = "^0" -hashlink = { path = "../external/hashlink", features = ["serde_impl"] } -serde = { version = "^1", features = ["derive" ] } -serde_json = { version = "^1" } -serde-big-array = "^0" -futures-util = { version = "^0", default_features = false, features = ["alloc"] } -parking_lot = "^0" -lazy_static = "^1" -directories = "^4" -once_cell = "^1" -json = "^0" -owning_ref = "^0" -flume = { version = "^0", features = ["async"] } -enumset = { version= "^1", features = ["serde"] } -backtrace = { version = "^0" } -stop-token = { version = "^0", default-features = false } -num-traits = "0.2.15" -shell-words = "1.1.0" +# Data structures +enumset = { version= "^1", features = ["serde"] } +keyvaluedb = { path = "../external/keyvaluedb/keyvaluedb" } +range-set-blaze = "0.1.5" +weak-table = "0.3.2" +generic-array = "^0" +hashlink = { path = "../external/hashlink", features = ["serde_impl"] } + +# System +futures-util = { version = "^0", default_features = false, features = ["alloc"] } +flume = { version = "^0", features = ["async"] } +parking_lot = "^0" +stop-token = { version = "^0", default-features = false } + +# Crypto ed25519-dalek = { version = "^1", default_features = false, features = ["alloc", "u64_backend"] } x25519-dalek = { version = "^1", default_features = false, features = ["u64_backend"] } curve25519-dalek = { version = "^3", default_features = false, features = ["alloc", "u64_backend"] } blake3 = { version = "^1" } +chacha20poly1305 = "^0" +chacha20 = "^0" +argon2 = "0.5.0" - +# Network async-std-resolver = { version = "^0", optional = true } trust-dns-resolver = { version = "^0", optional = true } enum-as-inner = "=0.5.1" # temporary fix for trust-dns-resolver v0.22.0 -keyvaluedb = { path = "../external/keyvaluedb/keyvaluedb" } - -rkyv = { version = "^0", default_features = false, features = ["std", "alloc", "strict", "size_32", "validation"] } +# Serialization +capnp = { version = "^0", default_features = false } +serde = { version = "^1", features = ["derive" ] } +serde_json = { version = "^1" } +serde-big-array = "^0" +json = "^0" data-encoding = { version = "^2" } -weak-table = "0.3.2" -range-set-blaze = "0.1.5" -argon2 = "0.5.0" -paste = "1.0.12" schemars = "0.8.12" +lz4_flex = { version = "0.11.1", default-features = false, features = ["safe-encode", "safe-decode"] } # Dependencies for native builds only # Linux, Windows, Mac, iOS, Android [target.'cfg(not(target_arch = "wasm32"))'.dependencies] -async-std = { version = "^1", features = ["unstable"], optional = true} -tokio = { version = "^1", features = ["full"], optional = true} -tokio-util = { version = "^0", features = ["compat"], optional = true} -tokio-stream = { version = "^0", features = ["net"], optional = true} -async-io = { version = "^1" } -async-tungstenite = { version = "^0", features = ["async-tls"] } -maplit = "^1" + +# Tools config = { version = "^0", features = ["yaml"] } -keyring-manager = { path = "../external/keyring-manager" } -async-tls = "^0.11" -igd = { path = "../external/rust-igd" } -webpki = "^0" -webpki-roots = "^0" -rustls = "^0.19" -rustls-pemfile = "^0.2" -futures-util = { version = "^0", default-features = false, features = ["async-await", "sink", "std", "io"] } -keyvaluedb-sqlite = { path = "../external/keyvaluedb/keyvaluedb-sqlite" } -socket2 = { version = "^0", features = ["all"] } bugsalot = { git = "https://github.com/crioux/bugsalot.git" } chrono = "^0" libc = "^0" nix = "^0" +# System +async-std = { version = "^1", features = ["unstable"], optional = true} +tokio = { version = "^1", features = ["full"], optional = true} +tokio-util = { version = "^0", features = ["compat"], optional = true} +tokio-stream = { version = "^0", features = ["net"], optional = true} +async-io = { version = "^1" } +futures-util = { version = "^0", default-features = false, features = ["async-await", "sink", "std", "io"] } + +# Data structures +keyring-manager = { path = "../external/keyring-manager" } +keyvaluedb-sqlite = { path = "../external/keyvaluedb/keyvaluedb-sqlite" } + +# Network +async-tungstenite = { version = "^0", features = ["async-tls"] } +igd = { path = "../external/rust-igd" } +async-tls = "^0.11" +webpki = "^0" +webpki-roots = "^0" +rustls = "^0.19" +rustls-pemfile = "^0.2" +socket2 = { version = "^0", features = ["all"] } + # Dependencies for WASM builds only [target.'cfg(target_arch = "wasm32")'.dependencies] + +# Tools +getrandom = { version = "^0", features = ["js"] } + +# System +async_executors = { version = "^0", default-features = false, features = [ "bindgen", "timer" ]} +async-lock = "^2" wasm-bindgen = "^0" js-sys = "^0" wasm-bindgen-futures = "^0" -keyvaluedb-web = { path = "../external/keyvaluedb/keyvaluedb-web" } -getrandom = { version = "^0", features = ["js"] } -ws_stream_wasm = "^0" -async_executors = { version = "^0", default-features = false, features = [ "bindgen", "timer" ]} -async-lock = "^2" send_wrapper = { version = "^0", features = ["futures"] } + +# Network +ws_stream_wasm = "^0" + +# Logging wasm-logger = "^0" tracing-wasm = "^0" -# Configuration for WASM32 'web-sys' crate +# Data Structures +keyvaluedb-web = { path = "../external/keyvaluedb/keyvaluedb-web" } + +### Configuration for WASM32 'web-sys' crate [target.'cfg(target_arch = "wasm32")'.dependencies.web-sys] version = "^0" features = [ @@ -154,9 +181,9 @@ ifstructs = "^0" # Dependencies for Linux or Android [target.'cfg(any(target_os = "android", target_os = "linux"))'.dependencies] -rtnetlink = { version = "^0", default-features = false} -netlink-sys = { version = "0.8" } -netlink-packet-route = { version = "0.15" } +rtnetlink = { version = "=0.13.0", default-features = false} +netlink-sys = { version = "=0.8.5" } +netlink-packet-route = { version = "=0.17.0" } # Dependencies for Windows [target.'cfg(target_os = "windows")'.dependencies] diff --git a/veilid-core/src/crypto/envelope.rs b/veilid-core/src/crypto/envelope.rs index 21c940f4..f7116e59 100644 --- a/veilid-core/src/crypto/envelope.rs +++ b/veilid-core/src/crypto/envelope.rs @@ -213,6 +213,10 @@ impl Envelope { &dh_secret, ); + // Decompress body + let body = decompress_size_prepended(&body) + .map_err(|e| VeilidAPIError::parse_error("failed to decompress", e))?; + Ok(body) } @@ -223,10 +227,25 @@ impl Envelope { node_id_secret: &SecretKey, network_key: &Option, ) -> VeilidAPIResult> { + // Ensure body isn't too long + let uncompressed_body_size: usize = body.len() + MIN_ENVELOPE_SIZE; + if uncompressed_body_size > MAX_ENVELOPE_SIZE { + apibail_parse_error!( + "envelope size before compression is too large", + uncompressed_body_size + ); + } + + // Compress body + let body = compress_prepend_size(&body); + // Ensure body isn't too long let envelope_size: usize = body.len() + MIN_ENVELOPE_SIZE; if envelope_size > MAX_ENVELOPE_SIZE { - apibail_parse_error!("envelope size is too large", envelope_size); + apibail_parse_error!( + "envelope size after compression is too large", + envelope_size + ); } // Generate dh secret let vcrypto = crypto @@ -271,7 +290,7 @@ impl Envelope { } // Encrypt and authenticate message - let encrypted_body = vcrypto.crypt_no_auth_unaligned(body, &self.nonce.bytes, &dh_secret); + let encrypted_body = vcrypto.crypt_no_auth_unaligned(&body, &self.nonce.bytes, &dh_secret); // Write body if !encrypted_body.is_empty() { diff --git a/veilid-core/src/crypto/types/byte_array_types.rs b/veilid-core/src/crypto/types/byte_array_types.rs index 9d60d4f4..4cdf2300 100644 --- a/veilid-core/src/crypto/types/byte_array_types.rs +++ b/veilid-core/src/crypto/types/byte_array_types.rs @@ -77,8 +77,7 @@ where macro_rules! byte_array_type { ($name:ident, $size:expr, $encoded_size:expr) => { - #[derive(Clone, Copy, Hash, RkyvArchive, RkyvSerialize, RkyvDeserialize)] - #[archive_attr(repr(C), derive(CheckBytes, Hash, Eq, PartialEq, PartialOrd, Ord))] + #[derive(Clone, Copy, Hash)] pub struct $name { pub bytes: [u8; $size], } diff --git a/veilid-core/src/crypto/types/crypto_typed.rs b/veilid-core/src/crypto/types/crypto_typed.rs index b0d3c61a..740f888c 100644 --- a/veilid-core/src/crypto/types/crypto_typed.rs +++ b/veilid-core/src/crypto/types/crypto_typed.rs @@ -1,7 +1,6 @@ use super::*; -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, RkyvArchive, RkyvSerialize, RkyvDeserialize)] -#[archive_attr(repr(C), derive(CheckBytes, Hash, PartialEq, Eq))] +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] pub struct CryptoTyped where K: Clone @@ -14,9 +13,7 @@ where + Ord + PartialOrd + Hash - + RkyvArchive + Encodable, - ::Archived: Hash + PartialEq + Eq, { pub kind: CryptoKind, pub value: K, @@ -34,9 +31,7 @@ where + Ord + PartialOrd + Hash - + RkyvArchive + Encodable, - ::Archived: Hash + PartialEq + Eq, { pub fn new(kind: CryptoKind, value: K) -> Self { Self { kind, value } @@ -54,9 +49,7 @@ where + Ord + PartialOrd + Hash - + RkyvArchive + Encodable, - ::Archived: Hash + PartialEq + Eq, { fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) @@ -75,9 +68,7 @@ where + Ord + PartialOrd + Hash - + RkyvArchive + Encodable, - ::Archived: Hash + PartialEq + Eq, { fn cmp(&self, other: &Self) -> cmp::Ordering { let x = compare_crypto_kind(&self.kind, &other.kind); @@ -100,9 +91,7 @@ where + Ord + PartialOrd + Hash - + RkyvArchive + Encodable, - ::Archived: Hash + PartialEq + Eq, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { write!(f, "{}:{}", self.kind, self.value) @@ -120,9 +109,7 @@ where + Ord + PartialOrd + Hash - + RkyvArchive + Encodable, - ::Archived: Hash + PartialEq + Eq, { type Err = VeilidAPIError; fn from_str(s: &str) -> Result { @@ -152,9 +139,7 @@ where + Ord + PartialOrd + Hash - + RkyvArchive + Encodable, - ::Archived: Hash + PartialEq + Eq, { fn deserialize(deserializer: D) -> Result where @@ -176,9 +161,7 @@ where + Ord + PartialOrd + Hash - + RkyvArchive + Encodable, - ::Archived: Hash + PartialEq + Eq, { fn serialize(&self, serializer: S) -> Result where diff --git a/veilid-core/src/crypto/types/crypto_typed_group.rs b/veilid-core/src/crypto/types/crypto_typed_group.rs index fd2efb33..80f717bc 100644 --- a/veilid-core/src/crypto/types/crypto_typed_group.rs +++ b/veilid-core/src/crypto/types/crypto_typed_group.rs @@ -1,21 +1,6 @@ use super::*; -#[derive( - Clone, - Debug, - Serialize, - Deserialize, - PartialOrd, - Ord, - PartialEq, - Eq, - Hash, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - Default, -)] -#[archive_attr(repr(C), derive(CheckBytes, Hash, PartialEq, Eq))] +#[derive(Clone, Debug, Serialize, Deserialize, PartialOrd, Ord, PartialEq, Eq, Hash, Default)] #[serde(from = "Vec>", into = "Vec>")] pub struct CryptoTypedGroup where @@ -29,10 +14,7 @@ where + PartialOrd + Ord + Hash - + RkyvArchive + Encodable, - ::Archived: Hash + PartialEq + Eq, - > as RkyvArchive>::Archived: Hash + PartialEq + Eq, { items: Vec>, } @@ -49,9 +31,7 @@ where + PartialOrd + Ord + Hash - + RkyvArchive + Encodable, - ::Archived: Hash + PartialEq + Eq, { pub fn new() -> Self { Self { items: Vec::new() } @@ -163,9 +143,7 @@ where + PartialOrd + Ord + Hash - + RkyvArchive + Encodable, - ::Archived: Hash + PartialEq + Eq, { type Target = [CryptoTyped]; @@ -187,9 +165,7 @@ where + PartialOrd + Ord + Hash - + RkyvArchive + Encodable, - ::Archived: Hash + PartialEq + Eq, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { write!(f, "[")?; @@ -217,9 +193,7 @@ where + PartialOrd + Ord + Hash - + RkyvArchive + Encodable, - ::Archived: Hash + PartialEq + Eq, { type Err = VeilidAPIError; fn from_str(s: &str) -> Result { @@ -250,9 +224,7 @@ where + PartialOrd + Ord + Hash - + RkyvArchive + Encodable, - ::Archived: Hash + PartialEq + Eq, { fn from(x: CryptoTyped) -> Self { let mut tks = CryptoTypedGroup::::with_capacity(1); @@ -272,9 +244,7 @@ where + PartialOrd + Ord + Hash - + RkyvArchive + Encodable, - ::Archived: Hash + PartialEq + Eq, { fn from(x: Vec>) -> Self { let mut tks = CryptoTypedGroup::::with_capacity(x.len()); @@ -294,9 +264,7 @@ where + PartialOrd + Ord + Hash - + RkyvArchive + Encodable, - ::Archived: Hash + PartialEq + Eq, { fn from(x: &[CryptoTyped]) -> Self { let mut tks = CryptoTypedGroup::::with_capacity(x.len()); @@ -316,9 +284,7 @@ where + PartialOrd + Ord + Hash - + RkyvArchive + Encodable, - ::Archived: Hash + PartialEq + Eq, { fn into(self) -> Vec> { self.items diff --git a/veilid-core/src/crypto/types/keypair.rs b/veilid-core/src/crypto/types/keypair.rs index d17a12a0..f8e6e6da 100644 --- a/veilid-core/src/crypto/types/keypair.rs +++ b/veilid-core/src/crypto/types/keypair.rs @@ -1,19 +1,6 @@ use super::*; -#[derive( - Clone, - Copy, - Default, - PartialOrd, - Ord, - PartialEq, - Eq, - Hash, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, -)] -#[archive_attr(repr(C), derive(CheckBytes, Hash, PartialEq, Eq))] +#[derive(Clone, Copy, Default, PartialOrd, Ord, PartialEq, Eq, Hash)] pub struct KeyPair { pub key: PublicKey, pub secret: SecretKey, diff --git a/veilid-core/src/intf/native/protected_store.rs b/veilid-core/src/intf/native/protected_store.rs index 380a0c34..7faa0f49 100644 --- a/veilid-core/src/intf/native/protected_store.rs +++ b/veilid-core/src/intf/native/protected_store.rs @@ -141,16 +141,6 @@ impl ProtectedStore { } } - #[instrument(level = "trace", skip(self, value))] - pub async fn save_user_secret_rkyv(&self, key: K, value: &T) -> EyreResult - where - K: AsRef + fmt::Debug, - T: RkyvSerialize, - { - let v = to_rkyv(value)?; - self.save_user_secret(key, &v).await - } - #[instrument(level = "trace", skip(self, value))] pub async fn save_user_secret_json(&self, key: K, value: &T) -> EyreResult where @@ -161,27 +151,6 @@ impl ProtectedStore { self.save_user_secret(&key, &v).await } - #[instrument(level = "trace", skip(self))] - pub async fn load_user_secret_rkyv(&self, key: K) -> EyreResult> - where - K: AsRef + fmt::Debug, - T: RkyvArchive, - ::Archived: - for<'t> CheckBytes>, - ::Archived: RkyvDeserialize, - { - let out = self.load_user_secret(key).await?; - let b = match out { - Some(v) => v, - None => { - return Ok(None); - } - }; - - let obj = from_rkyv(b)?; - Ok(Some(obj)) - } - #[instrument(level = "trace", skip(self))] pub async fn load_user_secret_json(&self, key: K) -> EyreResult> where diff --git a/veilid-core/src/intf/wasm/protected_store.rs b/veilid-core/src/intf/wasm/protected_store.rs index 39c9bacd..087596ef 100644 --- a/veilid-core/src/intf/wasm/protected_store.rs +++ b/veilid-core/src/intf/wasm/protected_store.rs @@ -1,9 +1,5 @@ use super::*; use data_encoding::BASE64URL_NOPAD; -use rkyv::{ - bytecheck::CheckBytes, Archive as RkyvArchive, Deserialize as RkyvDeserialize, - Serialize as RkyvSerialize, -}; use web_sys::*; @@ -126,16 +122,6 @@ impl ProtectedStore { } } - #[instrument(level = "trace", skip(self, value))] - pub async fn save_user_secret_rkyv(&self, key: K, value: &T) -> EyreResult - where - K: AsRef + fmt::Debug, - T: RkyvSerialize, - { - let v = to_rkyv(value)?; - self.save_user_secret(key, &v).await - } - #[instrument(level = "trace", skip(self, value))] pub async fn save_user_secret_json(&self, key: K, value: &T) -> EyreResult where @@ -146,27 +132,6 @@ impl ProtectedStore { self.save_user_secret(key, &v).await } - #[instrument(level = "trace", skip(self))] - pub async fn load_user_secret_rkyv(&self, key: K) -> EyreResult> - where - K: AsRef + fmt::Debug, - T: RkyvArchive, - ::Archived: - for<'t> CheckBytes>, - ::Archived: RkyvDeserialize, - { - let out = self.load_user_secret(key).await?; - let b = match out { - Some(v) => v, - None => { - return Ok(None); - } - }; - - let obj = from_rkyv(b)?; - Ok(Some(obj)) - } - #[instrument(level = "trace", skip(self))] pub async fn load_user_secret_json(&self, key: K) -> EyreResult> where diff --git a/veilid-core/src/lib.rs b/veilid-core/src/lib.rs index ef3bdeb9..0c973e7d 100644 --- a/veilid-core/src/lib.rs +++ b/veilid-core/src/lib.rs @@ -88,16 +88,12 @@ pub static DEFAULT_LOG_IGNORE_LIST: [&str; 21] = [ use cfg_if::*; use enumset::*; use eyre::{bail, eyre, Report as EyreReport, Result as EyreResult, WrapErr}; -use parking_lot::*; -use rkyv::{ - bytecheck, bytecheck::CheckBytes, de::deserializers::SharedDeserializeMap, with::Skip, - Archive as RkyvArchive, Deserialize as RkyvDeserialize, Serialize as RkyvSerialize, -}; -use tracing::*; -use veilid_tools::*; -type RkyvDefaultValidator<'t> = rkyv::validation::validators::DefaultValidator<'t>; use futures_util::stream::FuturesUnordered; +use lz4_flex::block::{compress_prepend_size, decompress_size_prepended}; +use parking_lot::*; use schemars::{schema_for, JsonSchema}; use serde::*; use stop_token::*; use thiserror::Error as ThisError; +use tracing::*; +use veilid_tools::*; diff --git a/veilid-core/src/network_manager/address_filter.rs b/veilid-core/src/network_manager/address_filter.rs index 326a41b0..5bb1ec4b 100644 --- a/veilid-core/src/network_manager/address_filter.rs +++ b/veilid-core/src/network_manager/address_filter.rs @@ -3,6 +3,7 @@ use alloc::collections::btree_map::Entry; // XXX: Move to config eventually? const PUNISHMENT_DURATION_MIN: usize = 60; +const MAX_PUNISHMENTS_BY_NODE_ID: usize = 65536; #[derive(ThisError, Debug, Clone, Copy, PartialEq, Eq)] pub enum AddressFilterError { @@ -26,15 +27,37 @@ struct AddressFilterInner { conn_timestamps_by_ip6_prefix: BTreeMap>, punishments_by_ip4: BTreeMap, punishments_by_ip6_prefix: BTreeMap, + punishments_by_node_id: BTreeMap, } -#[derive(Debug)] struct AddressFilterUnlockedInner { max_connections_per_ip4: usize, max_connections_per_ip6_prefix: usize, max_connections_per_ip6_prefix_size: usize, max_connection_frequency_per_min: usize, punishment_duration_min: usize, + routing_table: RoutingTable, +} + +impl fmt::Debug for AddressFilterUnlockedInner { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("AddressFilterUnlockedInner") + .field("max_connections_per_ip4", &self.max_connections_per_ip4) + .field( + "max_connections_per_ip6_prefix", + &self.max_connections_per_ip6_prefix, + ) + .field( + "max_connections_per_ip6_prefix_size", + &self.max_connections_per_ip6_prefix_size, + ) + .field( + "max_connection_frequency_per_min", + &self.max_connection_frequency_per_min, + ) + .field("punishment_duration_min", &self.punishment_duration_min) + .finish() + } } #[derive(Clone, Debug)] @@ -44,7 +67,7 @@ pub struct AddressFilter { } impl AddressFilter { - pub fn new(config: VeilidConfig) -> Self { + pub fn new(config: VeilidConfig, routing_table: RoutingTable) -> Self { let c = config.get(); Self { unlocked_inner: Arc::new(AddressFilterUnlockedInner { @@ -55,6 +78,7 @@ impl AddressFilter { max_connection_frequency_per_min: c.network.max_connection_frequency_per_min as usize, punishment_duration_min: PUNISHMENT_DURATION_MIN, + routing_table, }), inner: Arc::new(Mutex::new(AddressFilterInner { conn_count_by_ip4: BTreeMap::new(), @@ -63,6 +87,7 @@ impl AddressFilter { conn_timestamps_by_ip6_prefix: BTreeMap::new(), punishments_by_ip4: BTreeMap::new(), punishments_by_ip6_prefix: BTreeMap::new(), + punishments_by_node_id: BTreeMap::new(), })), } } @@ -135,9 +160,29 @@ impl AddressFilter { inner.punishments_by_ip6_prefix.remove(&key); } } + // node id + { + let mut dead_keys = Vec::::new(); + for (key, value) in &mut inner.punishments_by_node_id { + // Drop punishments older than the punishment duration + if cur_ts.as_u64().saturating_sub(value.as_u64()) + > self.unlocked_inner.punishment_duration_min as u64 * 60_000_000u64 + { + dead_keys.push(*key); + } + } + for key in dead_keys { + log_net!(debug ">>> FORGIVING: {}", key); + inner.punishments_by_node_id.remove(&key); + // make the entry alive again if it's still here + if let Ok(Some(nr)) = self.unlocked_inner.routing_table.lookup_node_ref(key) { + nr.operate_mut(|_rti, e| e.set_punished(false)); + } + } + } } - fn is_punished_inner(&self, inner: &AddressFilterInner, ipblock: IpAddr) -> bool { + fn is_ip_addr_punished_inner(&self, inner: &AddressFilterInner, ipblock: IpAddr) -> bool { match ipblock { IpAddr::V4(v4) => { if inner.punishments_by_ip4.contains_key(&v4) { @@ -153,16 +198,16 @@ impl AddressFilter { false } - pub fn is_punished(&self, addr: IpAddr) -> bool { + pub fn is_ip_addr_punished(&self, addr: IpAddr) -> bool { let inner = self.inner.lock(); let ipblock = ip_to_ipblock( self.unlocked_inner.max_connections_per_ip6_prefix_size, addr, ); - self.is_punished_inner(&*inner, ipblock) + self.is_ip_addr_punished_inner(&*inner, ipblock) } - pub fn punish(&self, addr: IpAddr) { + pub fn punish_ip_addr(&self, addr: IpAddr) { log_net!(debug ">>> PUNISHED: {}", addr); let ts = get_aligned_timestamp(); @@ -186,6 +231,39 @@ impl AddressFilter { }; } + fn is_node_id_punished_inner(&self, inner: &AddressFilterInner, node_id: TypedKey) -> bool { + if inner.punishments_by_node_id.contains_key(&node_id) { + return true; + } + false + } + + pub fn is_node_id_punished(&self, node_id: TypedKey) -> bool { + let inner = self.inner.lock(); + self.is_node_id_punished_inner(&*inner, node_id) + } + + pub fn punish_node_id(&self, node_id: TypedKey) { + if let Ok(Some(nr)) = self.unlocked_inner.routing_table.lookup_node_ref(node_id) { + // make the entry dead if it's punished + nr.operate_mut(|_rti, e| e.set_punished(true)); + } + + let ts = get_aligned_timestamp(); + + let mut inner = self.inner.lock(); + if inner.punishments_by_node_id.len() >= MAX_PUNISHMENTS_BY_NODE_ID { + log_net!(debug ">>> PUNISHMENT TABLE FULL: {}", node_id); + return; + } + log_net!(debug ">>> PUNISHED: {}", node_id); + inner + .punishments_by_node_id + .entry(node_id) + .and_modify(|v| *v = ts) + .or_insert(ts); + } + pub async fn address_filter_task_routine( self, _stop_token: StopToken, @@ -207,7 +285,7 @@ impl AddressFilter { self.unlocked_inner.max_connections_per_ip6_prefix_size, addr, ); - if self.is_punished_inner(inner, ipblock) { + if self.is_ip_addr_punished_inner(inner, ipblock) { return Err(AddressFilterError::Punished); } diff --git a/veilid-core/src/network_manager/connection_manager.rs b/veilid-core/src/network_manager/connection_manager.rs index cf6744ef..febad51c 100644 --- a/veilid-core/src/network_manager/connection_manager.rs +++ b/veilid-core/src/network_manager/connection_manager.rs @@ -173,6 +173,7 @@ impl ConnectionManager { Ok(Some(conn)) => { // Connection added and a different one LRU'd out // Send it to be terminated + log_net!(debug "== LRU kill connection due to limit: {:?}", conn); let _ = inner.sender.send(ConnectionManagerEvent::Dead(conn)); } Err(ConnectionTableAddError::AddressFilter(conn, e)) => { @@ -205,40 +206,6 @@ impl ConnectionManager { .get_connection_by_descriptor(descriptor) } - // Terminate any connections that would collide with a new connection - // using different protocols to the same remote address and port. Used to ensure - // that we can switch quickly between TCP and WS if necessary to the same node - // Returns true if we killed off colliding connections - async fn kill_off_colliding_connections(&self, dial_info: &DialInfo) -> bool { - let protocol_type = dial_info.protocol_type(); - let socket_address = dial_info.socket_address(); - - let killed = self.arc.connection_table.drain_filter(|prior_descriptor| { - // If the protocol types aren't the same, then this is a candidate to be killed off - // If they are the same, then we would just return the exact same connection from get_or_create_connection() - if prior_descriptor.protocol_type() == protocol_type { - return false; - } - // If the prior remote is not the same address, then we're not going to collide - if *prior_descriptor.remote().socket_address() != socket_address { - return false; - } - - log_net!(debug - ">< Terminating connection prior_descriptor={:?}", - prior_descriptor - ); - true - }); - // Wait for the killed connections to end their recv loops - let did_kill = !killed.is_empty(); - for mut k in killed { - k.close(); - k.await; - } - did_kill - } - /// Called when we want to create a new connection or get the current one that already exists /// This will kill off any connections that are in conflict with the new connection to be made /// in order to make room for the new connection in the system's connection table @@ -246,45 +213,53 @@ impl ConnectionManager { #[instrument(level = "trace", skip(self), ret, err)] pub async fn get_or_create_connection( &self, - local_addr: Option, dial_info: DialInfo, ) -> EyreResult> { - // Async lock on the remote address for atomicity per remote let peer_address = dial_info.to_peer_address(); let remote_addr = peer_address.to_socket_addr(); + let mut preferred_local_address = self + .network_manager() + .net() + .get_preferred_local_address(&dial_info); + let best_port = preferred_local_address.map(|pla| pla.port()); + // Async lock on the remote address for atomicity per remote let _lock_guard = self.arc.address_lock_table.lock_tag(remote_addr).await; - log_net!( - "== get_or_create_connection local_addr={:?} dial_info={:?}", - local_addr, - dial_info - ); - - // Kill off any possibly conflicting connections - let did_kill = self.kill_off_colliding_connections(&dial_info).await; - let mut retry_count = if did_kill { 2 } else { 0 }; + log_net!("== get_or_create_connection dial_info={:?}", dial_info); // If any connection to this remote exists that has the same protocol, return it - // Any connection will do, we don't have to match the local address - if let Some(conn) = self + // Any connection will do, we don't have to match the local address but if we can + // match the preferred port do it + if let Some(best_existing_conn) = self .arc .connection_table - .get_last_connection_by_remote(peer_address) + .get_best_connection_by_remote(best_port, peer_address) { log_net!( - "== Returning existing connection local_addr={:?} peer_address={:?}", - local_addr, - peer_address + "== Returning best existing connection {:?}", + best_existing_conn ); - return Ok(NetworkResult::Value(conn)); + return Ok(NetworkResult::Value(best_existing_conn)); + } + + // If there is a low-level connection collision here, then we release the 'preferred local address' + // so we can make a second connection with an ephemeral port + if self + .arc + .connection_table + .check_for_colliding_connection(&dial_info) + { + preferred_local_address = None; } // Attempt new connection + let mut retry_count = 0; // Someday, if we need this + let prot_conn = network_result_try!(loop { let result_net_res = ProtocolNetworkConnection::connect( - local_addr, + preferred_local_address, &dial_info, self.arc.connection_initial_timeout_ms, self.network_manager().address_filter(), @@ -292,24 +267,28 @@ impl ConnectionManager { .await; match result_net_res { Ok(net_res) => { - // If the connection 'already exists', then try one last time to return a connection from the table, in case - // an 'accept' happened at literally the same time as our connect - if net_res.is_already_exists() { - if let Some(conn) = self - .arc - .connection_table - .get_last_connection_by_remote(peer_address) - { - log_net!( - "== Returning existing connection in race local_addr={:?} peer_address={:?}", - local_addr, - peer_address - ); - - return Ok(NetworkResult::Value(conn)); - } - } + // // If the connection 'already exists', then try one last time to return a connection from the table, in case + // // an 'accept' happened at literally the same time as our connect. A preferred local address must have been + // // specified otherwise we would have picked a different ephemeral port and this could not have happened + // if net_res.is_already_exists() && preferred_local_address.is_some() { + // // Make 'already existing' connection descriptor + // let conn_desc = ConnectionDescriptor::new( + // dial_info.to_peer_address(), + // SocketAddress::from_socket_addr(preferred_local_address.unwrap()), + // ); + // // Return the connection for this if we have it + // if let Some(conn) = self + // .arc + // .connection_table + // .get_connection_by_descriptor(conn_desc) + // { + // // Should not really happen, lets make sure we see this if it does + // log_net!(warn "== Returning existing connection in race: {:?}", conn_desc); + // return Ok(NetworkResult::Value(conn)); + // } + // } if net_res.is_value() || retry_count == 0 { + // Successful new connection, return it break net_res; } } diff --git a/veilid-core/src/network_manager/connection_table.rs b/veilid-core/src/network_manager/connection_table.rs index 3e8f11e8..2ece5f05 100644 --- a/veilid-core/src/network_manager/connection_table.rs +++ b/veilid-core/src/network_manager/connection_table.rs @@ -92,6 +92,37 @@ impl ConnectionTable { while unord.next().await.is_some() {} } + // Return true if there is another connection in the table using a different protocol type + // to the same address and port with the same low level protocol type. + // Specifically right now this checks for a TCP connection that exists to the same + // low level TCP remote as a WS or WSS connection, since they are all low-level TCP + #[instrument(level = "trace", skip(self), ret)] + pub fn check_for_colliding_connection(&self, dial_info: &DialInfo) -> bool { + let inner = self.inner.lock(); + + let protocol_type = dial_info.protocol_type(); + let low_level_protocol_type = protocol_type.low_level_protocol_type(); + + // check protocol types + let mut check_protocol_types = ProtocolTypeSet::empty(); + for check_pt in ProtocolTypeSet::all().iter() { + if check_pt != protocol_type + && check_pt.low_level_protocol_type() == low_level_protocol_type + { + check_protocol_types.insert(check_pt); + } + } + let socket_address = dial_info.socket_address(); + + for check_pt in check_protocol_types { + let check_pa = PeerAddress::new(socket_address, check_pt); + if inner.ids_by_remote.contains_key(&check_pa) { + return true; + } + } + false + } + #[instrument(level = "trace", skip(self), ret, err)] pub fn add_connection( &self, @@ -183,14 +214,42 @@ impl ConnectionTable { Some(out.get_handle()) } - //#[instrument(level = "trace", skip(self), ret)] - pub fn get_last_connection_by_remote(&self, remote: PeerAddress) -> Option { + // #[instrument(level = "trace", skip(self), ret)] + pub fn get_best_connection_by_remote( + &self, + best_port: Option, + remote: PeerAddress, + ) -> Option { let mut inner = self.inner.lock(); - let id = inner.ids_by_remote.get(&remote).map(|v| v[v.len() - 1])?; + let all_ids_by_remote = inner.ids_by_remote.get(&remote)?; let protocol_index = Self::protocol_to_index(remote.protocol_type()); - let out = inner.conn_by_id[protocol_index].get(&id).unwrap(); - Some(out.get_handle()) + if all_ids_by_remote.len() == 0 { + // no connections + return None; + } + if all_ids_by_remote.len() == 1 { + // only one connection + let id = all_ids_by_remote[0]; + let nc = inner.conn_by_id[protocol_index].get(&id).unwrap(); + return Some(nc.get_handle()); + } + // multiple connections, find the one that matches the best port, or the most recent + if let Some(best_port) = best_port { + for id in all_ids_by_remote.iter().copied() { + let nc = inner.conn_by_id[protocol_index].peek(&id).unwrap(); + if let Some(local_addr) = nc.connection_descriptor().local() { + if local_addr.port() == best_port { + let nc = inner.conn_by_id[protocol_index].get(&id).unwrap(); + return Some(nc.get_handle()); + } + } + } + } + // just return most recent network connection if a best port match can not be found + let best_id = *all_ids_by_remote.last().unwrap(); + let nc = inner.conn_by_id[protocol_index].get(&best_id).unwrap(); + Some(nc.get_handle()) } //#[instrument(level = "trace", skip(self), ret)] @@ -204,26 +263,26 @@ impl ConnectionTable { .unwrap_or_default() } - pub fn drain_filter(&self, mut filter: F) -> Vec - where - F: FnMut(ConnectionDescriptor) -> bool, - { - let mut inner = self.inner.lock(); - let mut filtered_ids = Vec::new(); - for cbi in &mut inner.conn_by_id { - for (id, conn) in cbi { - if filter(conn.connection_descriptor()) { - filtered_ids.push(*id); - } - } - } - let mut filtered_connections = Vec::new(); - for id in filtered_ids { - let conn = Self::remove_connection_records(&mut *inner, id); - filtered_connections.push(conn) - } - filtered_connections - } + // pub fn drain_filter(&self, mut filter: F) -> Vec + // where + // F: FnMut(ConnectionDescriptor) -> bool, + // { + // let mut inner = self.inner.lock(); + // let mut filtered_ids = Vec::new(); + // for cbi in &mut inner.conn_by_id { + // for (id, conn) in cbi { + // if filter(conn.connection_descriptor()) { + // filtered_ids.push(*id); + // } + // } + // } + // let mut filtered_connections = Vec::new(); + // for id in filtered_ids { + // let conn = Self::remove_connection_records(&mut *inner, id); + // filtered_connections.push(conn) + // } + // filtered_connections + // } pub fn connection_count(&self) -> usize { let inner = self.inner.lock(); diff --git a/veilid-core/src/network_manager/mod.rs b/veilid-core/src/network_manager/mod.rs index 02387a9e..6578fb1a 100644 --- a/veilid-core/src/network_manager/mod.rs +++ b/veilid-core/src/network_manager/mod.rs @@ -36,12 +36,16 @@ use hashlink::LruCache; use intf::*; #[cfg(not(target_arch = "wasm32"))] use native::*; +#[cfg(not(target_arch = "wasm32"))] +pub use native::{LOCAL_NETWORK_CAPABILITIES, MAX_CAPABILITIES, PUBLIC_INTERNET_CAPABILITIES}; use receipt_manager::*; use routing_table::*; use rpc_processor::*; use storage_manager::*; #[cfg(target_arch = "wasm32")] use wasm::*; +#[cfg(target_arch = "wasm32")] +pub use wasm::{LOCAL_NETWORK_CAPABILITIES, MAX_CAPABILITIES, PUBLIC_INTERNET_CAPABILITIES}; //////////////////////////////////////////////////////////////////////////////////////// @@ -139,9 +143,9 @@ struct NetworkManagerUnlockedInner { #[cfg(feature = "unstable-blockstore")] block_store: BlockStore, crypto: Crypto, - address_filter: AddressFilter, // Accessors routing_table: RwLock>, + address_filter: RwLock>, components: RwLock>, update_callback: RwLock>, // Background processes @@ -185,7 +189,7 @@ impl NetworkManager { #[cfg(feature = "unstable-blockstore")] block_store, crypto, - address_filter: AddressFilter::new(config), + address_filter: RwLock::new(None), routing_table: RwLock::new(None), components: RwLock::new(None), update_callback: RwLock::new(None), @@ -288,7 +292,12 @@ impl NetworkManager { self.unlocked_inner.crypto.clone() } pub fn address_filter(&self) -> AddressFilter { - self.unlocked_inner.address_filter.clone() + self.unlocked_inner + .address_filter + .read() + .as_ref() + .unwrap() + .clone() } pub fn routing_table(&self) -> RoutingTable { self.unlocked_inner @@ -347,7 +356,9 @@ impl NetworkManager { pub async fn init(&self, update_callback: UpdateCallback) -> EyreResult<()> { let routing_table = RoutingTable::new(self.clone()); routing_table.init().await?; + let address_filter = AddressFilter::new(self.config(), routing_table.clone()); *self.unlocked_inner.routing_table.write() = Some(routing_table.clone()); + *self.unlocked_inner.address_filter.write() = Some(address_filter); *self.unlocked_inner.update_callback.write() = Some(update_callback); Ok(()) } @@ -665,7 +676,11 @@ impl NetworkManager { // Process a received signal #[instrument(level = "trace", skip(self), err)] - pub async fn handle_signal(&self, signal_info: SignalInfo) -> EyreResult> { + pub async fn handle_signal( + &self, + connection_descriptor: ConnectionDescriptor, + signal_info: SignalInfo, + ) -> EyreResult> { match signal_info { SignalInfo::ReverseConnect { receipt, peer_info } => { let routing_table = self.routing_table(); @@ -686,6 +701,10 @@ impl NetworkManager { } }; + // Restrict reverse connection to same protocol as inbound signal + let peer_nr = peer_nr + .filtered_clone(NodeRefFilter::from(connection_descriptor.protocol_type())); + // Make a reverse connection to the peer and send the receipt to it rpc.rpc_call_return_receipt(Destination::direct(peer_nr), receipt) .await @@ -900,7 +919,7 @@ impl NetworkManager { // Ensure we can read the magic number if data.len() < 4 { log_net!(debug "short packet"); - self.address_filter().punish(remote_addr); + self.address_filter().punish_ip_addr(remote_addr); return Ok(false); } @@ -935,7 +954,7 @@ impl NetworkManager { Ok(v) => v, Err(e) => { log_net!(debug "envelope failed to decode: {}", e); - self.address_filter().punish(remote_addr); + self.address_filter().punish_ip_addr(remote_addr); return Ok(false); } }; @@ -987,6 +1006,10 @@ impl NetworkManager { // Peek at header and see if we need to relay this // If the recipient id is not our node id, then it needs relaying let sender_id = TypedKey::new(envelope.get_crypto_kind(), envelope.get_sender_id()); + if self.address_filter().is_node_id_punished(sender_id) { + return Ok(false); + } + let recipient_id = TypedKey::new(envelope.get_crypto_kind(), envelope.get_recipient_id()); if !routing_table.matches_own_node_id(&[recipient_id]) { // See if the source node is allowed to resolve nodes @@ -1023,16 +1046,11 @@ impl NetworkManager { }; if let Some(relay_nr) = some_relay_nr { - // Force sequencing if this came in sequenced. - // The sender did the prefer/ensure calculation when it did get_contact_method, - // so we don't need to do it here. - let relay_nr = if connection_descriptor.remote().protocol_type().is_ordered() { - let mut relay_nr = relay_nr.clone(); - relay_nr.set_sequencing(Sequencing::EnsureOrdered); - relay_nr - } else { - relay_nr - }; + // Ensure the protocol is forwarded exactly as is + // Address type is allowed to change if connectivity is better + let relay_nr = relay_nr.filtered_clone( + NodeRefFilter::new().with_protocol_type(connection_descriptor.protocol_type()), + ); // Relay the packet to the desired destination log_net!("relaying {} bytes to {}", data.len(), relay_nr); @@ -1066,7 +1084,7 @@ impl NetworkManager { Ok(v) => v, Err(e) => { log_net!(debug "failed to decrypt envelope body: {}",e); - self.address_filter().punish(remote_addr); + self.address_filter().punish_ip_addr(remote_addr); return Ok(false); } }; diff --git a/veilid-core/src/network_manager/native/mod.rs b/veilid-core/src/network_manager/native/mod.rs index cf04b50a..4611dc3b 100644 --- a/veilid-core/src/network_manager/native/mod.rs +++ b/veilid-core/src/network_manager/native/mod.rs @@ -30,6 +30,43 @@ use std::path::{Path, PathBuf}; pub const PEEK_DETECT_LEN: usize = 64; +cfg_if! { + if #[cfg(all(feature = "unstable-blockstore", feature="unstable-tunnels"))] { + const PUBLIC_INTERNET_CAPABILITIES_LEN: usize = 8; + } else if #[cfg(any(feature = "unstable-blockstore", feature="unstable-tunnels"))] { + const PUBLIC_INTERNET_CAPABILITIES_LEN: usize = 7; + } else { + const PUBLIC_INTERNET_CAPABILITIES_LEN: usize = 6; + } +} +pub const PUBLIC_INTERNET_CAPABILITIES: [Capability; PUBLIC_INTERNET_CAPABILITIES_LEN] = [ + CAP_ROUTE, + #[cfg(feature = "unstable-tunnels")] + CAP_TUNNEL, + CAP_SIGNAL, + CAP_RELAY, + CAP_VALIDATE_DIAL_INFO, + CAP_DHT, + CAP_APPMESSAGE, + #[cfg(feature = "unstable-blockstore")] + CAP_BLOCKSTORE, +]; + +#[cfg(feature = "unstable-blockstore")] +const LOCAL_NETWORK_CAPABILITIES_LEN: usize = 4; +#[cfg(not(feature = "unstable-blockstore"))] +const LOCAL_NETWORK_CAPABILITIES_LEN: usize = 3; + +pub const LOCAL_NETWORK_CAPABILITIES: [Capability; LOCAL_NETWORK_CAPABILITIES_LEN] = [ + CAP_RELAY, + CAP_DHT, + CAP_APPMESSAGE, + #[cfg(feature = "unstable-blockstore")] + CAP_BLOCKSTORE, +]; + +pub const MAX_CAPABILITIES: usize = 64; + ///////////////////////////////////////////////////////////////// struct NetworkInner { @@ -296,7 +333,7 @@ impl Network { } } - pub fn get_local_port(&self, protocol_type: ProtocolType) -> u16 { + pub fn get_local_port(&self, protocol_type: ProtocolType) -> Option { let inner = self.inner.lock(); let local_port = match protocol_type { ProtocolType::UDP => inner.udp_port, @@ -304,10 +341,10 @@ impl Network { ProtocolType::WS => inner.ws_port, ProtocolType::WSS => inner.wss_port, }; - local_port + Some(local_port) } - fn get_preferred_local_address(&self, dial_info: &DialInfo) -> SocketAddr { + pub fn get_preferred_local_address(&self, dial_info: &DialInfo) -> Option { let inner = self.inner.lock(); let local_port = match dial_info.protocol_type() { @@ -317,10 +354,10 @@ impl Network { ProtocolType::WSS => inner.wss_port, }; - match dial_info.address_type() { + Some(match dial_info.address_type() { AddressType::IPV4 => SocketAddr::new(IpAddr::V4(Ipv4Addr::UNSPECIFIED), local_port), AddressType::IPV6 => SocketAddr::new(IpAddr::V6(Ipv6Addr::UNSPECIFIED), local_port), - } + }) } pub fn is_usable_interface_address(&self, addr: IpAddr) -> bool { @@ -373,7 +410,7 @@ impl Network { if self .network_manager() .address_filter() - .is_punished(dial_info.address().to_ip_addr()) + .is_ip_addr_punished(dial_info.address().to_ip_addr()) { return Ok(NetworkResult::no_connection_other("punished")); } @@ -440,7 +477,7 @@ impl Network { if self .network_manager() .address_filter() - .is_punished(dial_info.address().to_ip_addr()) + .is_ip_addr_punished(dial_info.address().to_ip_addr()) { return Ok(NetworkResult::no_connection_other("punished")); } @@ -594,10 +631,9 @@ impl Network { .wrap_err("failed to send data to dial info")?); } else { // Handle connection-oriented protocols - let local_addr = self.get_preferred_local_address(&dial_info); let conn = network_result_try!( self.connection_manager() - .get_or_create_connection(Some(local_addr), dial_info.clone()) + .get_or_create_connection(dial_info.clone()) .await? ); diff --git a/veilid-core/src/network_manager/native/network_class_discovery.rs b/veilid-core/src/network_manager/native/network_class_discovery.rs index 0b13c521..d729f231 100644 --- a/veilid-core/src/network_manager/native/network_class_discovery.rs +++ b/veilid-core/src/network_manager/native/network_class_discovery.rs @@ -256,7 +256,7 @@ impl DiscoveryContext { let at = inner.address_type.unwrap(); let external_address_1 = inner.external_1_address.unwrap(); let node_1 = inner.node_1.as_ref().unwrap().clone(); - let local_port = self.net.get_local_port(pt); + let local_port = self.net.get_local_port(pt).unwrap(); (pt, llpt, at, external_address_1, node_1, local_port) }; diff --git a/veilid-core/src/network_manager/native/network_tcp.rs b/veilid-core/src/network_manager/native/network_tcp.rs index 3c9434bf..d79fa414 100644 --- a/veilid-core/src/network_manager/native/network_tcp.rs +++ b/veilid-core/src/network_manager/native/network_tcp.rs @@ -120,7 +120,7 @@ impl Network { }; // Check to see if it is punished let address_filter = self.network_manager().address_filter(); - if address_filter.is_punished(peer_addr.ip()) { + if address_filter.is_ip_addr_punished(peer_addr.ip()) { return; } diff --git a/veilid-core/src/network_manager/native/protocol/mod.rs b/veilid-core/src/network_manager/native/protocol/mod.rs index 7af29c46..6cbd79e9 100644 --- a/veilid-core/src/network_manager/native/protocol/mod.rs +++ b/veilid-core/src/network_manager/native/protocol/mod.rs @@ -24,7 +24,7 @@ impl ProtocolNetworkConnection { timeout_ms: u32, address_filter: AddressFilter, ) -> io::Result> { - if address_filter.is_punished(dial_info.address().to_ip_addr()) { + if address_filter.is_ip_addr_punished(dial_info.address().to_ip_addr()) { return Ok(NetworkResult::no_connection_other("punished")); } match dial_info.protocol_type() { diff --git a/veilid-core/src/network_manager/native/protocol/udp.rs b/veilid-core/src/network_manager/native/protocol/udp.rs index da129a75..f0519235 100644 --- a/veilid-core/src/network_manager/native/protocol/udp.rs +++ b/veilid-core/src/network_manager/native/protocol/udp.rs @@ -25,7 +25,7 @@ impl RawUdpProtocolHandler { // Check to see if it is punished if let Some(af) = self.address_filter.as_ref() { - if af.is_punished(remote_addr.ip()) { + if af.is_ip_addr_punished(remote_addr.ip()) { continue; } } @@ -97,7 +97,7 @@ impl RawUdpProtocolHandler { // Check to see if it is punished if let Some(af) = self.address_filter.as_ref() { - if af.is_punished(remote_addr.ip()) { + if af.is_ip_addr_punished(remote_addr.ip()) { return Ok(NetworkResult::no_connection_other("punished")); } } diff --git a/veilid-core/src/network_manager/native/protocol/ws.rs b/veilid-core/src/network_manager/native/protocol/ws.rs index 39c48de7..e724e4a0 100644 --- a/veilid-core/src/network_manager/native/protocol/ws.rs +++ b/veilid-core/src/network_manager/native/protocol/ws.rs @@ -21,9 +21,10 @@ fn err_to_network_result(err: async_tungstenite::tungstenite::Error) -> Netwo match err { async_tungstenite::tungstenite::Error::ConnectionClosed | async_tungstenite::tungstenite::Error::AlreadyClosed - | async_tungstenite::tungstenite::Error::Io(_) => { - NetworkResult::NoConnection(to_io_error_other(err)) - } + | async_tungstenite::tungstenite::Error::Io(_) + | async_tungstenite::tungstenite::Error::Protocol( + async_tungstenite::tungstenite::error::ProtocolError::ResetWithoutClosingHandshake, + ) => NetworkResult::NoConnection(to_io_error_other(err)), _ => NetworkResult::InvalidMessage(err.to_string()), } } diff --git a/veilid-core/src/network_manager/network_connection.rs b/veilid-core/src/network_manager/network_connection.rs index f657037b..9d7b7eb6 100644 --- a/veilid-core/src/network_manager/network_connection.rs +++ b/veilid-core/src/network_manager/network_connection.rs @@ -305,7 +305,7 @@ impl NetworkConnection { let peer_address = protocol_connection.descriptor().remote(); // Check to see if it is punished - if address_filter.is_punished(peer_address.to_socket_addr().ip()) { + if address_filter.is_ip_addr_punished(peer_address.to_socket_addr().ip()) { return RecvLoopAction::Finish; } diff --git a/veilid-core/src/network_manager/send_data.rs b/veilid-core/src/network_manager/send_data.rs index f1a7345b..fea17fe8 100644 --- a/veilid-core/src/network_manager/send_data.rs +++ b/veilid-core/src/network_manager/send_data.rs @@ -307,6 +307,11 @@ impl NetworkManager { ) -> EyreResult { let routing_table = self.routing_table(); + // If a node is punished, then don't try to contact it + if target_node_ref.node_ids().iter().find(|nid| self.address_filter().is_node_id_punished(**nid)).is_some() { + return Ok(NodeContactMethod::Unreachable); + } + // Figure out the best routing domain to get the contact method over let routing_domain = match target_node_ref.best_routing_domain() { Some(rd) => rd, diff --git a/veilid-core/src/network_manager/tests/test_connection_table.rs b/veilid-core/src/network_manager/tests/test_connection_table.rs index 5a52cd46..c683b6d7 100644 --- a/veilid-core/src/network_manager/tests/test_connection_table.rs +++ b/veilid-core/src/network_manager/tests/test_connection_table.rs @@ -2,10 +2,11 @@ use super::*; use super::connection_table::*; use crate::tests::common::test_veilid_config::*; +use crate::tests::mock_routing_table; pub async fn test_add_get_remove() { let config = get_config(); - let address_filter = AddressFilter::new(config.clone()); + let address_filter = AddressFilter::new(config.clone(), mock_routing_table()); let table = ConnectionTable::new(config, address_filter); let a1 = ConnectionDescriptor::new_no_local(PeerAddress::new( diff --git a/veilid-core/src/network_manager/types/address.rs b/veilid-core/src/network_manager/types/address.rs index 0dbb0e95..e89ed185 100644 --- a/veilid-core/src/network_manager/types/address.rs +++ b/veilid-core/src/network_manager/types/address.rs @@ -2,22 +2,7 @@ use super::*; // Ordering here matters, IPV6 is preferred to IPV4 in dial info sorts // See issue #236 for eventual resolution of this unfortunate implementation -#[derive( - Copy, - Clone, - Debug, - PartialEq, - PartialOrd, - Ord, - Eq, - Hash, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, -)] -#[archive_attr(repr(u8), derive(CheckBytes))] +#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Ord, Eq, Hash, Serialize, Deserialize)] pub enum Address { IPV6(Ipv6Addr), IPV4(Ipv4Addr), diff --git a/veilid-core/src/network_manager/types/address_type.rs b/veilid-core/src/network_manager/types/address_type.rs index 5193654e..53ddcb4f 100644 --- a/veilid-core/src/network_manager/types/address_type.rs +++ b/veilid-core/src/network_manager/types/address_type.rs @@ -1,22 +1,11 @@ +#![allow(non_snake_case)] use super::*; #[allow(clippy::derive_hash_xor_eq)] -#[derive( - Debug, - PartialOrd, - Ord, - Hash, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - EnumSetType, -)] +#[derive(Debug, PartialOrd, Ord, Hash, Serialize, Deserialize, EnumSetType)] #[enumset(repr = "u8")] -#[archive_attr(repr(u8), derive(CheckBytes))] pub enum AddressType { - IPV4, - IPV6, + IPV6 = 0, + IPV4 = 1, } pub type AddressTypeSet = EnumSet; diff --git a/veilid-core/src/network_manager/types/connection_descriptor.rs b/veilid-core/src/network_manager/types/connection_descriptor.rs index 54481c39..b57fcc91 100644 --- a/veilid-core/src/network_manager/types/connection_descriptor.rs +++ b/veilid-core/src/network_manager/types/connection_descriptor.rs @@ -7,22 +7,7 @@ use super::*; /// If the medium does not allow local addresses, None should have been used or 'new_no_local' /// If we are specifying only a port, then the socket's 'local_address()' should have been used, since an /// established connection is always from a real address to another real address. -#[derive( - Copy, - Clone, - Debug, - PartialEq, - Eq, - PartialOrd, - Ord, - Hash, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] pub struct ConnectionDescriptor { remote: PeerAddress, local: Option, diff --git a/veilid-core/src/network_manager/types/dial_info/mod.rs b/veilid-core/src/network_manager/types/dial_info/mod.rs index 5eec84f5..1450b3b3 100644 --- a/veilid-core/src/network_manager/types/dial_info/mod.rs +++ b/veilid-core/src/network_manager/types/dial_info/mod.rs @@ -12,21 +12,7 @@ pub use wss::*; // Keep member order appropriate for sorting < preference // Must match ProtocolType order -#[derive( - Clone, - Debug, - PartialEq, - PartialOrd, - Ord, - Eq, - Hash, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, -)] -#[archive_attr(repr(u8), derive(CheckBytes))] +#[derive(Clone, Debug, PartialEq, PartialOrd, Ord, Eq, Hash, Serialize, Deserialize)] #[serde(tag = "kind")] pub enum DialInfo { UDP(DialInfoUDP), diff --git a/veilid-core/src/network_manager/types/dial_info/tcp.rs b/veilid-core/src/network_manager/types/dial_info/tcp.rs index ce7de8b4..062893a3 100644 --- a/veilid-core/src/network_manager/types/dial_info/tcp.rs +++ b/veilid-core/src/network_manager/types/dial_info/tcp.rs @@ -1,21 +1,6 @@ use super::*; -#[derive( - Clone, - Default, - Debug, - PartialEq, - PartialOrd, - Ord, - Eq, - Hash, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Clone, Default, Debug, PartialEq, PartialOrd, Ord, Eq, Hash, Serialize, Deserialize)] pub struct DialInfoTCP { pub socket_address: SocketAddress, } diff --git a/veilid-core/src/network_manager/types/dial_info/udp.rs b/veilid-core/src/network_manager/types/dial_info/udp.rs index d799e116..4f2f86fe 100644 --- a/veilid-core/src/network_manager/types/dial_info/udp.rs +++ b/veilid-core/src/network_manager/types/dial_info/udp.rs @@ -1,21 +1,6 @@ use super::*; -#[derive( - Clone, - Default, - Debug, - PartialEq, - PartialOrd, - Ord, - Eq, - Hash, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Clone, Default, Debug, PartialEq, PartialOrd, Ord, Eq, Hash, Serialize, Deserialize)] pub struct DialInfoUDP { pub socket_address: SocketAddress, } diff --git a/veilid-core/src/network_manager/types/dial_info/ws.rs b/veilid-core/src/network_manager/types/dial_info/ws.rs index 18e2a37c..a79c28f4 100644 --- a/veilid-core/src/network_manager/types/dial_info/ws.rs +++ b/veilid-core/src/network_manager/types/dial_info/ws.rs @@ -1,22 +1,7 @@ use super::*; -#[derive( - Clone, - Default, - Debug, - PartialEq, - PartialOrd, - Ord, - Eq, - Hash, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Clone, Default, Debug, PartialEq, PartialOrd, Ord, Eq, Hash, Serialize, Deserialize)] pub struct DialInfoWS { pub socket_address: SocketAddress, pub request: String, -} \ No newline at end of file +} diff --git a/veilid-core/src/network_manager/types/dial_info/wss.rs b/veilid-core/src/network_manager/types/dial_info/wss.rs index e999430d..b2adcf8c 100644 --- a/veilid-core/src/network_manager/types/dial_info/wss.rs +++ b/veilid-core/src/network_manager/types/dial_info/wss.rs @@ -1,21 +1,6 @@ use super::*; -#[derive( - Clone, - Default, - Debug, - PartialEq, - PartialOrd, - Ord, - Eq, - Hash, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Clone, Default, Debug, PartialEq, PartialOrd, Ord, Eq, Hash, Serialize, Deserialize)] pub struct DialInfoWSS { pub socket_address: SocketAddress, pub request: String, diff --git a/veilid-core/src/network_manager/types/dial_info_class.rs b/veilid-core/src/network_manager/types/dial_info_class.rs index f3f91376..3348fd1b 100644 --- a/veilid-core/src/network_manager/types/dial_info_class.rs +++ b/veilid-core/src/network_manager/types/dial_info_class.rs @@ -1,22 +1,7 @@ use super::*; // Keep member order appropriate for sorting < preference -#[derive( - Copy, - Clone, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, -)] -#[archive_attr(repr(u8), derive(CheckBytes))] +#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum DialInfoClass { Direct = 0, // D = Directly reachable with public IP and no firewall, with statically configured port Mapped = 1, // M = Directly reachable with via portmap behind any NAT or firewalled with dynamically negotiated port diff --git a/veilid-core/src/network_manager/types/dial_info_filter.rs b/veilid-core/src/network_manager/types/dial_info_filter.rs index c51a5acb..4f7fce87 100644 --- a/veilid-core/src/network_manager/types/dial_info_filter.rs +++ b/veilid-core/src/network_manager/types/dial_info_filter.rs @@ -1,24 +1,8 @@ use super::*; -#[derive( - Copy, - Clone, - PartialEq, - Eq, - PartialOrd, - Ord, - Hash, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] pub struct DialInfoFilter { - #[with(RkyvEnumSet)] pub protocol_type_set: ProtocolTypeSet, - #[with(RkyvEnumSet)] pub address_type_set: AddressTypeSet, } diff --git a/veilid-core/src/network_manager/types/low_level_protocol_type.rs b/veilid-core/src/network_manager/types/low_level_protocol_type.rs index 69dfeae7..be552282 100644 --- a/veilid-core/src/network_manager/types/low_level_protocol_type.rs +++ b/veilid-core/src/network_manager/types/low_level_protocol_type.rs @@ -1,25 +1,15 @@ +#![allow(non_snake_case)] + use super::*; // Keep member order appropriate for sorting < preference // Must match DialInfo order #[allow(clippy::derive_hash_xor_eq)] -#[derive( - Debug, - PartialOrd, - Ord, - Hash, - EnumSetType, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, -)] +#[derive(Debug, PartialOrd, Ord, Hash, EnumSetType, Serialize, Deserialize)] #[enumset(repr = "u8")] -#[archive_attr(repr(u8), derive(CheckBytes))] pub enum LowLevelProtocolType { - UDP, - TCP, + UDP = 0, + TCP = 1, } impl LowLevelProtocolType { diff --git a/veilid-core/src/network_manager/types/network_class.rs b/veilid-core/src/network_manager/types/network_class.rs index 828edac7..0570b9d2 100644 --- a/veilid-core/src/network_manager/types/network_class.rs +++ b/veilid-core/src/network_manager/types/network_class.rs @@ -1,21 +1,6 @@ use super::*; -#[derive( - Copy, - Clone, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, -)] -#[archive_attr(repr(u8), derive(CheckBytes))] +#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum NetworkClass { InboundCapable = 0, // I = Inbound capable without relay, may require signal OutboundOnly = 1, // O = Outbound only, inbound relay required except with reverse connect signal diff --git a/veilid-core/src/network_manager/types/peer_address.rs b/veilid-core/src/network_manager/types/peer_address.rs index 83df0bea..e505aa1c 100644 --- a/veilid-core/src/network_manager/types/peer_address.rs +++ b/veilid-core/src/network_manager/types/peer_address.rs @@ -1,24 +1,9 @@ use super::*; -#[derive( - Copy, - Clone, - Debug, - PartialEq, - PartialOrd, - Eq, - Ord, - Hash, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, Ord, Hash, Serialize, Deserialize)] pub struct PeerAddress { protocol_type: ProtocolType, - #[serde(with = "json_as_string")] + #[serde(with = "as_human_string")] socket_address: SocketAddress, } diff --git a/veilid-core/src/network_manager/types/protocol_type.rs b/veilid-core/src/network_manager/types/protocol_type.rs index 41167580..54319322 100644 --- a/veilid-core/src/network_manager/types/protocol_type.rs +++ b/veilid-core/src/network_manager/types/protocol_type.rs @@ -1,27 +1,16 @@ +#![allow(non_snake_case)] use super::*; // Keep member order appropriate for sorting < preference // Must match DialInfo order #[allow(clippy::derive_hash_xor_eq)] -#[derive( - Debug, - PartialOrd, - Ord, - Hash, - EnumSetType, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, -)] +#[derive(Debug, PartialOrd, Ord, Hash, EnumSetType, Serialize, Deserialize)] #[enumset(repr = "u8")] -#[archive_attr(repr(u8), derive(CheckBytes))] pub enum ProtocolType { - UDP, - TCP, - WS, - WSS, + UDP = 0, + TCP = 1, + WS = 2, + WSS = 3, } impl ProtocolType { diff --git a/veilid-core/src/network_manager/types/signal_info.rs b/veilid-core/src/network_manager/types/signal_info.rs index bf2aa861..0fb49746 100644 --- a/veilid-core/src/network_manager/types/signal_info.rs +++ b/veilid-core/src/network_manager/types/signal_info.rs @@ -1,8 +1,7 @@ use super::*; /// Parameter for Signal operation -#[derive(Clone, Debug, Serialize, Deserialize, RkyvArchive, RkyvSerialize, RkyvDeserialize)] -#[archive_attr(repr(u8), derive(CheckBytes))] +#[derive(Clone, Debug, Serialize, Deserialize)] pub enum SignalInfo { /// UDP Hole Punch Request HolePunch { diff --git a/veilid-core/src/network_manager/types/socket_address.rs b/veilid-core/src/network_manager/types/socket_address.rs index 35515b90..c68cd805 100644 --- a/veilid-core/src/network_manager/types/socket_address.rs +++ b/veilid-core/src/network_manager/types/socket_address.rs @@ -1,22 +1,8 @@ use super::*; #[derive( - Copy, - Default, - Clone, - Debug, - PartialEq, - PartialOrd, - Ord, - Eq, - Hash, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, + Copy, Default, Clone, Debug, PartialEq, PartialOrd, Ord, Eq, Hash, Serialize, Deserialize, )] -#[archive_attr(repr(C), derive(CheckBytes))] pub struct SocketAddress { address: Address, port: u16, diff --git a/veilid-core/src/network_manager/wasm/mod.rs b/veilid-core/src/network_manager/wasm/mod.rs index dcdd0f85..7c3b40e0 100644 --- a/veilid-core/src/network_manager/wasm/mod.rs +++ b/veilid-core/src/network_manager/wasm/mod.rs @@ -10,6 +10,45 @@ use std::io; ///////////////////////////////////////////////////////////////// +cfg_if! { + if #[cfg(all(feature = "unstable-blockstore", feature="unstable-tunnels"))] { + const PUBLIC_INTERNET_CAPABILITIES_LEN: usize = 6; + } else if #[cfg(any(feature = "unstable-blockstore", feature="unstable-tunnels"))] { + const PUBLIC_INTERNET_CAPABILITIES_LEN: usize = 5; + } else { + const PUBLIC_INTERNET_CAPABILITIES_LEN: usize = 4; + } +} +pub const PUBLIC_INTERNET_CAPABILITIES: [Capability; PUBLIC_INTERNET_CAPABILITIES_LEN] = [ + CAP_ROUTE, + #[cfg(feature = "unstable-tunnels")] + CAP_TUNNEL, + CAP_SIGNAL, + //CAP_RELAY, + //CAP_VALIDATE_DIAL_INFO, + CAP_DHT, + CAP_APPMESSAGE, + #[cfg(feature = "unstable-blockstore")] + CAP_BLOCKSTORE, +]; + +#[cfg(feature = "unstable-blockstore")] +const LOCAL_NETWORK_CAPABILITIES_LEN: usize = 3; +#[cfg(not(feature = "unstable-blockstore"))] +const LOCAL_NETWORK_CAPABILITIES_LEN: usize = 2; + +pub const LOCAL_NETWORK_CAPABILITIES: [Capability; LOCAL_NETWORK_CAPABILITIES_LEN] = [ + //CAP_RELAY, + CAP_DHT, + CAP_APPMESSAGE, + #[cfg(feature = "unstable-blockstore")] + CAP_BLOCKSTORE, +]; + +pub const MAX_CAPABILITIES: usize = 64; + +///////////////////////////////////////////////////////////////// + struct NetworkInner { network_started: bool, network_needs_restart: bool, @@ -94,7 +133,7 @@ impl Network { if self .network_manager() .address_filter() - .is_punished(dial_info.address().to_ip_addr()) + .is_ip_addr_punished(dial_info.address().to_ip_addr()) { return Ok(NetworkResult::no_connection_other("punished")); } @@ -143,7 +182,7 @@ impl Network { if self .network_manager() .address_filter() - .is_punished(dial_info.address().to_ip_addr()) + .is_ip_addr_punished(dial_info.address().to_ip_addr()) { return Ok(NetworkResult::no_connection_other("punished")); } @@ -245,7 +284,7 @@ impl Network { // Handle connection-oriented protocols let conn = network_result_try!( self.connection_manager() - .get_or_create_connection(None, dial_info.clone()) + .get_or_create_connection(dial_info.clone()) .await? ); @@ -273,10 +312,10 @@ impl Network { let inbound = ProtocolTypeSet::new(); let mut outbound = ProtocolTypeSet::new(); - if c.network.protocol.ws.connect && c.capabilities.protocol_connect_ws { + if c.network.protocol.ws.connect { outbound.insert(ProtocolType::WS); } - if c.network.protocol.wss.connect && c.capabilities.protocol_connect_wss { + if c.network.protocol.wss.connect { outbound.insert(ProtocolType::WSS); } @@ -301,15 +340,26 @@ impl Network { // set up the routing table's network config // if we have static public dialinfo, upgrade our network class + + let public_internet_capabilities = { + let c = self.config.get(); + PUBLIC_INTERNET_CAPABILITIES + .iter() + .copied() + .filter(|cap| !c.capabilities.disable.contains(cap)) + .collect::>() + }; + editor_public_internet.setup_network( protocol_config.outbound, protocol_config.inbound, protocol_config.family_global, + public_internet_capabilities, ); editor_public_internet.set_network_class(Some(NetworkClass::WebApp)); // commit routing table edits - editor_public_internet.commit().await; + editor_public_internet.commit(); self.inner.lock().network_started = true; Ok(()) @@ -339,8 +389,7 @@ impl Network { .clear_dial_info_details() .set_network_class(None) .clear_relay_node() - .commit() - .await; + .commit(); // Cancels all async background tasks by dropping join handles *self.inner.lock() = Self::new_inner(); @@ -356,6 +405,14 @@ impl Network { Vec::new() } + pub fn get_local_port(&self, protocol_type: ProtocolType) -> Option { + None + } + + pub fn get_preferred_local_address(&self, dial_info: &DialInfo) -> Option { + None + } + ////////////////////////////////////////// pub fn set_needs_public_dial_info_check( diff --git a/veilid-core/src/network_manager/wasm/protocol/mod.rs b/veilid-core/src/network_manager/wasm/protocol/mod.rs index 4b08e7b1..846cff18 100644 --- a/veilid-core/src/network_manager/wasm/protocol/mod.rs +++ b/veilid-core/src/network_manager/wasm/protocol/mod.rs @@ -19,7 +19,7 @@ impl ProtocolNetworkConnection { timeout_ms: u32, address_filter: AddressFilter, ) -> io::Result> { - if address_filter.is_punished(dial_info.address().to_ip_addr()) { + if address_filter.is_ip_addr_punished(dial_info.address().to_ip_addr()) { return Ok(NetworkResult::no_connection_other("punished")); } match dial_info.protocol_type() { diff --git a/veilid-core/src/routing_table/bucket.rs b/veilid-core/src/routing_table/bucket.rs index 93c1a65d..f34405f6 100644 --- a/veilid-core/src/routing_table/bucket.rs +++ b/veilid-core/src/routing_table/bucket.rs @@ -1,6 +1,5 @@ use super::*; use core::sync::atomic::Ordering; -use rkyv::{Archive as RkyvArchive, Deserialize as RkyvDeserialize, Serialize as RkyvSerialize}; /// Routing Table Bucket /// Stores map of public keys to entries, which may be in multiple routing tables per crypto kind @@ -16,15 +15,13 @@ pub struct Bucket { pub(super) type EntriesIter<'a> = alloc::collections::btree_map::Iter<'a, PublicKey, Arc>; -#[derive(Debug, RkyvArchive, RkyvSerialize, RkyvDeserialize)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Debug, Serialize, Deserialize)] struct SerializedBucketEntryData { key: PublicKey, value: u32, // index into serialized entries list } -#[derive(Debug, RkyvArchive, RkyvSerialize, RkyvDeserialize)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Debug, Serialize, Deserialize)] struct SerializedBucketData { entries: Vec, } @@ -50,7 +47,7 @@ impl Bucket { data: Vec, all_entries: &[Arc], ) -> EyreResult<()> { - let bucket_data: SerializedBucketData = from_rkyv(data)?; + let bucket_data: SerializedBucketData = deserialize_json_bytes(&data)?; for e in bucket_data.entries { self.entries @@ -64,7 +61,7 @@ impl Bucket { &self, all_entries: &mut Vec>, entry_map: &mut HashMap<*const BucketEntry, u32>, - ) -> EyreResult> { + ) -> Vec { let mut entries = Vec::new(); for (k, v) in &self.entries { let entry_index = entry_map.entry(Arc::as_ptr(v)).or_insert_with(|| { @@ -78,8 +75,8 @@ impl Bucket { }); } let bucket_data = SerializedBucketData { entries }; - let out = to_rkyv(&bucket_data)?; - Ok(out) + let out = serialize_json_bytes(&bucket_data); + out } /// Create a new entry with a node_id of this crypto kind and return it diff --git a/veilid-core/src/routing_table/bucket_entry.rs b/veilid-core/src/routing_table/bucket_entry.rs index e400875d..b2066539 100644 --- a/veilid-core/src/routing_table/bucket_entry.rs +++ b/veilid-core/src/routing_table/bucket_entry.rs @@ -39,8 +39,7 @@ pub enum BucketEntryState { pub struct LastConnectionKey(ProtocolType, AddressType); /// Bucket entry information specific to the LocalNetwork RoutingDomain -#[derive(Debug, RkyvArchive, RkyvSerialize, RkyvDeserialize)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Debug, Serialize, Deserialize)] pub struct BucketEntryPublicInternet { /// The PublicInternet node info signed_node_info: Option>, @@ -51,8 +50,7 @@ pub struct BucketEntryPublicInternet { } /// Bucket entry information specific to the LocalNetwork RoutingDomain -#[derive(Debug, RkyvArchive, RkyvSerialize, RkyvDeserialize)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Debug, Serialize, Deserialize)] pub struct BucketEntryLocalNetwork { /// The LocalNetwork node info signed_node_info: Option>, @@ -63,8 +61,7 @@ pub struct BucketEntryLocalNetwork { } /// The data associated with each bucket entry -#[derive(Debug, RkyvArchive, RkyvSerialize, RkyvDeserialize)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Debug, Serialize, Deserialize)] pub struct BucketEntryInner { /// The node ids matching this bucket entry, with the cryptography versions supported by this node as the 'kind' field validated_node_ids: TypedKeyGroup, @@ -79,7 +76,7 @@ pub struct BucketEntryInner { /// unreachable may now be reachable with the same SignedNodeInfo/DialInfo updated_since_last_network_change: bool, /// The last connection descriptors used to contact this node, per protocol type - #[with(Skip)] + #[serde(skip)] last_connections: BTreeMap, /// The node info for this entry on the publicinternet routing domain public_internet: BucketEntryPublicInternet, @@ -88,18 +85,21 @@ pub struct BucketEntryInner { /// Statistics gathered for the peer peer_stats: PeerStats, /// The accounting for the latency statistics - #[with(Skip)] + #[serde(skip)] latency_stats_accounting: LatencyStatsAccounting, /// The accounting for the transfer statistics - #[with(Skip)] + #[serde(skip)] transfer_stats_accounting: TransferStatsAccounting, + /// If the entry is being punished and should be considered dead + #[serde(skip)] + is_punished: bool, /// Tracking identifier for NodeRef debugging #[cfg(feature = "tracking")] - #[with(Skip)] + #[serde(skip)] next_track_id: usize, /// Backtraces for NodeRef debugging #[cfg(feature = "tracking")] - #[with(Skip)] + #[serde(skip)] node_ref_tracks: HashMap, } @@ -259,6 +259,7 @@ impl BucketEntryInner { }; // See if we have an existing signed_node_info to update or not + let mut node_info_changed = false; if let Some(current_sni) = opt_current_sni { // Always allow overwriting invalid/unsigned node if current_sni.has_any_signature() { @@ -277,6 +278,11 @@ impl BucketEntryInner { } return; } + + // See if anything has changed in this update beside the timestamp + if signed_node_info.node_info() != current_sni.node_info() { + node_info_changed = true; + } } } @@ -294,7 +300,9 @@ impl BucketEntryInner { // because the dial info could have changed and its safer to just reconnect. // The latest connection would have been the once we got the new node info // over so that connection is still valid. - self.clear_last_connections_except_latest(); + if node_info_changed { + self.clear_last_connections_except_latest(); + } } pub fn has_node_info(&self, routing_domain_set: RoutingDomainSet) -> bool { @@ -406,6 +414,10 @@ impl BucketEntryInner { // Stores a connection descriptor in this entry's table of last connections pub fn set_last_connection(&mut self, last_connection: ConnectionDescriptor, timestamp: Timestamp) { + if self.is_punished { + // Don't record connection if this entry is currently punished + return; + } let key = self.descriptor_to_key(last_connection); self.last_connections .insert(key, (last_connection, timestamp)); @@ -534,6 +546,9 @@ impl BucketEntryInner { } pub fn state(&self, cur_ts: Timestamp) -> BucketEntryState { + if self.is_punished { + return BucketEntryState::Dead; + } if self.check_reliable(cur_ts) { BucketEntryState::Reliable } else if self.check_dead(cur_ts) { @@ -542,6 +557,12 @@ impl BucketEntryInner { BucketEntryState::Unreliable } } + pub fn set_punished(&mut self, punished: bool) { + self.is_punished = punished; + if punished { + self.clear_last_connections(); + } + } pub fn peer_stats(&self) -> &PeerStats { &self.peer_stats @@ -848,6 +869,7 @@ impl BucketEntry { }, latency_stats_accounting: LatencyStatsAccounting::new(), transfer_stats_accounting: TransferStatsAccounting::new(), + is_punished: false, #[cfg(feature = "tracking")] next_track_id: 0, #[cfg(feature = "tracking")] diff --git a/veilid-core/src/routing_table/debug.rs b/veilid-core/src/routing_table/debug.rs index 32c9d366..8f3875d9 100644 --- a/veilid-core/src/routing_table/debug.rs +++ b/veilid-core/src/routing_table/debug.rs @@ -90,19 +90,16 @@ impl RoutingTable { for (n, gdi) in gdis.iter().enumerate() { out += &format!(" {:>2}: {:?}\n", n, gdi); } + out + } - out += "LocalNetwork PeerInfo:\n"; + pub(crate) fn debug_info_peerinfo(&self, routing_domain: RoutingDomain) -> String { + let mut out = String::new(); out += &format!( - " {:#?}\n", - self.get_own_peer_info(RoutingDomain::LocalNetwork) + "{:?} PeerInfo:\n {:#?}\n", + routing_domain, + self.get_own_peer_info(routing_domain) ); - - out += "PublicInternet PeerInfo:\n"; - out += &format!( - " {:#?}\n", - self.get_own_peer_info(RoutingDomain::PublicInternet) - ); - out } diff --git a/veilid-core/src/routing_table/mod.rs b/veilid-core/src/routing_table/mod.rs index 4981aa60..a44223bb 100644 --- a/veilid-core/src/routing_table/mod.rs +++ b/veilid-core/src/routing_table/mod.rs @@ -48,6 +48,12 @@ pub const PRIVATE_ROUTE_MANAGEMENT_INTERVAL_SECS: u32 = 1; // We should ping them with some frequency and 30 seconds is typical timeout pub const CONNECTIONLESS_TIMEOUT_SECS: u32 = 29; +// Table store keys +const ALL_ENTRY_BYTES: &[u8] = b"all_entry_bytes"; +const ROUTING_TABLE: &str = "routing_table"; +const SERIALIZED_BUCKET_MAP: &[u8] = b"serialized_bucket_map"; +const CACHE_VALIDITY_KEY: &[u8] = b"cache_validity_key"; + pub type LowLevelProtocolPorts = BTreeSet<(LowLevelProtocolType, AddressType, u16)>; pub type ProtocolToPortMapping = BTreeMap<(ProtocolType, AddressType), (LowLevelProtocolType, u16)>; #[derive(Clone, Debug)] @@ -295,7 +301,7 @@ impl RoutingTable { } /// Serialize the routing table. - fn serialized_buckets(&self) -> EyreResult<(SerializedBucketMap, SerializedBuckets)> { + fn serialized_buckets(&self) -> (SerializedBucketMap, SerializedBuckets) { // Since entries are shared by multiple buckets per cryptokind // we need to get the list of all unique entries when serializing let mut all_entries: Vec> = Vec::new(); @@ -309,7 +315,7 @@ impl RoutingTable { let buckets = inner.buckets.get(&ck).unwrap(); let mut serialized_buckets = Vec::new(); for bucket in buckets.iter() { - serialized_buckets.push(bucket.save_bucket(&mut all_entries, &mut entry_map)?) + serialized_buckets.push(bucket.save_bucket(&mut all_entries, &mut entry_map)) } serialized_bucket_map.insert(ck, serialized_buckets); } @@ -319,25 +325,25 @@ impl RoutingTable { let mut all_entry_bytes = Vec::with_capacity(all_entries.len()); for entry in all_entries { // Serialize entry - let entry_bytes = entry.with_inner(|e| to_rkyv(e))?; + let entry_bytes = entry.with_inner(|e| serialize_json_bytes(e)); all_entry_bytes.push(entry_bytes); } - Ok((serialized_bucket_map, all_entry_bytes)) + (serialized_bucket_map, all_entry_bytes) } /// Write the serialized routing table to the table store. async fn save_buckets(&self) -> EyreResult<()> { - let (serialized_bucket_map, all_entry_bytes) = self.serialized_buckets()?; + let (serialized_bucket_map, all_entry_bytes) = self.serialized_buckets(); let table_store = self.unlocked_inner.network_manager().table_store(); - let tdb = table_store.open("routing_table", 1).await?; + let tdb = table_store.open(ROUTING_TABLE, 1).await?; let dbx = tdb.transact(); - if let Err(e) = dbx.store_rkyv(0, b"serialized_bucket_map", &serialized_bucket_map) { + if let Err(e) = dbx.store_json(0, SERIALIZED_BUCKET_MAP, &serialized_bucket_map) { dbx.rollback(); return Err(e.into()); } - if let Err(e) = dbx.store_rkyv(0, b"all_entry_bytes", &all_entry_bytes) { + if let Err(e) = dbx.store_json(0, ALL_ENTRY_BYTES, &all_entry_bytes) { dbx.rollback(); return Err(e.into()); } @@ -362,9 +368,9 @@ impl RoutingTable { // Deserialize bucket map and all entries from the table store let table_store = self.unlocked_inner.network_manager().table_store(); - let db = table_store.open("routing_table", 1).await?; + let db = table_store.open(ROUTING_TABLE, 1).await?; - let caches_valid = match db.load(0, b"cache_validity_key").await? { + let caches_valid = match db.load(0, CACHE_VALIDITY_KEY).await? { Some(v) => v == cache_validity_key, None => false, }; @@ -372,19 +378,18 @@ impl RoutingTable { // Caches not valid, start over log_rtab!(debug "cache validity key changed, emptying routing table"); drop(db); - table_store.delete("routing_table").await?; - let db = table_store.open("routing_table", 1).await?; - db.store(0, b"cache_validity_key", &cache_validity_key) - .await?; + table_store.delete(ROUTING_TABLE).await?; + let db = table_store.open(ROUTING_TABLE, 1).await?; + db.store(0, CACHE_VALIDITY_KEY, &cache_validity_key).await?; return Ok(()); } // Caches valid, load saved routing table - let Some(serialized_bucket_map): Option = db.load_rkyv(0, b"serialized_bucket_map").await? else { + let Some(serialized_bucket_map): Option = db.load_json(0, SERIALIZED_BUCKET_MAP).await? else { log_rtab!(debug "no bucket map in saved routing table"); return Ok(()); }; - let Some(all_entry_bytes): Option = db.load_rkyv(0, b"all_entry_bytes").await? else { + let Some(all_entry_bytes): Option = db.load_json(0, ALL_ENTRY_BYTES).await? else { log_rtab!(debug "no all_entry_bytes in saved routing table"); return Ok(()); }; @@ -405,8 +410,8 @@ impl RoutingTable { ) -> EyreResult<()> { let mut all_entries: Vec> = Vec::with_capacity(all_entry_bytes.len()); for entry_bytes in all_entry_bytes { - let entryinner = - from_rkyv(entry_bytes).wrap_err("failed to deserialize bucket entry")?; + let entryinner = deserialize_json_bytes(&entry_bytes) + .wrap_err("failed to deserialize bucket entry")?; let entry = Arc::new(BucketEntry::new_with_inner(entryinner)); // Keep strong reference in table diff --git a/veilid-core/src/routing_table/route_spec_store/route_set_spec_detail.rs b/veilid-core/src/routing_table/route_spec_store/route_set_spec_detail.rs index a61473a8..e4f58462 100644 --- a/veilid-core/src/routing_table/route_spec_store/route_set_spec_detail.rs +++ b/veilid-core/src/routing_table/route_spec_store/route_set_spec_detail.rs @@ -1,7 +1,6 @@ use super::*; -#[derive(Clone, Debug, RkyvArchive, RkyvSerialize, RkyvDeserialize)] -#[archive_attr(repr(C, align(8)), derive(CheckBytes))] +#[derive(Clone, Debug, Serialize, Deserialize)] pub struct RouteSpecDetail { /// Crypto kind pub crypto_kind: CryptoKind, @@ -11,20 +10,18 @@ pub struct RouteSpecDetail { pub hops: Vec, } -#[derive(Clone, Debug, RkyvArchive, RkyvSerialize, RkyvDeserialize)] -#[archive_attr(repr(C, align(8)), derive(CheckBytes))] +#[derive(Clone, Debug, Serialize, Deserialize)] pub struct RouteSetSpecDetail { /// Route set per crypto kind route_set: BTreeMap, /// Route noderefs - #[with(Skip)] + #[serde(skip)] hop_node_refs: Vec, /// Published private route, do not reuse for ephemeral routes /// Not serialized because all routes should be re-published when restarting - #[with(Skip)] + #[serde(skip)] published: bool, /// Directions this route is guaranteed to work in - #[with(RkyvEnumSet)] directions: DirectionSet, /// Stability preference (prefer reliable nodes over faster) stability: Stability, diff --git a/veilid-core/src/routing_table/route_spec_store/route_spec_store_content.rs b/veilid-core/src/routing_table/route_spec_store/route_spec_store_content.rs index 9c5fbafe..e1d003e3 100644 --- a/veilid-core/src/routing_table/route_spec_store/route_spec_store_content.rs +++ b/veilid-core/src/routing_table/route_spec_store/route_spec_store_content.rs @@ -1,8 +1,7 @@ use super::*; /// The core representation of the RouteSpecStore that can be serialized -#[derive(Debug, Clone, Default, RkyvArchive, RkyvSerialize, RkyvDeserialize)] -#[archive_attr(repr(C, align(8)), derive(CheckBytes))] +#[derive(Debug, Clone, Default, Serialize, Deserialize)] pub struct RouteSpecStoreContent { /// All of the route sets we have allocated so far indexed by key id_by_key: HashMap, @@ -23,7 +22,7 @@ impl RouteSpecStoreContent { let table_store = routing_table.network_manager().table_store(); let rsstdb = table_store.open("RouteSpecStore", 1).await?; let mut content: RouteSpecStoreContent = - rsstdb.load_rkyv(0, b"content").await?.unwrap_or_default(); + rsstdb.load_json(0, b"content").await?.unwrap_or_default(); // Look up all route hop noderefs since we can't serialize those let mut dead_ids = Vec::new(); @@ -63,7 +62,7 @@ impl RouteSpecStoreContent { // This skips #[with(Skip)] saving the secret keys, we save them in the protected store instead let table_store = routing_table.network_manager().table_store(); let rsstdb = table_store.open("RouteSpecStore", 1).await?; - rsstdb.store_rkyv(0, b"content", self).await?; + rsstdb.store_json(0, b"content", self).await?; Ok(()) } @@ -96,9 +95,9 @@ impl RouteSpecStoreContent { pub fn get_id_by_key(&self, key: &PublicKey) -> Option { self.id_by_key.get(key).cloned() } - pub fn iter_ids(&self) -> std::collections::hash_map::Keys { - self.details.keys() - } + // pub fn iter_ids(&self) -> std::collections::hash_map::Keys { + // self.details.keys() + // } pub fn iter_details(&self) -> std::collections::hash_map::Iter { self.details.iter() } diff --git a/veilid-core/src/routing_table/route_spec_store/route_stats.rs b/veilid-core/src/routing_table/route_spec_store/route_stats.rs index 1327e87f..ad7bdf70 100644 --- a/veilid-core/src/routing_table/route_spec_store/route_stats.rs +++ b/veilid-core/src/routing_table/route_spec_store/route_stats.rs @@ -1,34 +1,33 @@ use super::*; -#[derive(Clone, Debug, Default, RkyvArchive, RkyvSerialize, RkyvDeserialize)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Clone, Debug, Default, Serialize, Deserialize)] pub struct RouteStats { /// Consecutive failed to send count - #[with(Skip)] + #[serde(skip)] pub failed_to_send: u32, /// Questions lost - #[with(Skip)] + #[serde(skip)] pub questions_lost: u32, /// Timestamp of when the route was created pub created_ts: Timestamp, /// Timestamp of when the route was last checked for validity - #[with(Skip)] + #[serde(skip)] pub last_tested_ts: Option, /// Timestamp of when the route was last sent to - #[with(Skip)] + #[serde(skip)] pub last_sent_ts: Option, /// Timestamp of when the route was last received over - #[with(Skip)] + #[serde(skip)] pub last_received_ts: Option, /// Transfers up and down pub transfer_stats_down_up: TransferStatsDownUp, /// Latency stats pub latency_stats: LatencyStats, /// Accounting mechanism for this route's RPC latency - #[with(Skip)] + #[serde(skip)] latency_stats_accounting: LatencyStatsAccounting, /// Accounting mechanism for the bandwidth across this route - #[with(Skip)] + #[serde(skip)] transfer_stats_accounting: TransferStatsAccounting, } diff --git a/veilid-core/src/routing_table/tests/mod.rs b/veilid-core/src/routing_table/tests/mod.rs index 44ed3a79..45780128 100644 --- a/veilid-core/src/routing_table/tests/mod.rs +++ b/veilid-core/src/routing_table/tests/mod.rs @@ -1 +1,29 @@ +use super::*; + pub mod test_serialize_routing_table; + +pub(crate) fn mock_routing_table() -> routing_table::RoutingTable { + let veilid_config = VeilidConfig::new(); + #[cfg(feature = "unstable-blockstore")] + let block_store = BlockStore::new(veilid_config.clone()); + let protected_store = ProtectedStore::new(veilid_config.clone()); + let table_store = TableStore::new(veilid_config.clone(), protected_store.clone()); + let crypto = Crypto::new(veilid_config.clone(), table_store.clone()); + let storage_manager = storage_manager::StorageManager::new( + veilid_config.clone(), + crypto.clone(), + table_store.clone(), + #[cfg(feature = "unstable-blockstore")] + block_store.clone(), + ); + let network_manager = network_manager::NetworkManager::new( + veilid_config.clone(), + storage_manager, + protected_store.clone(), + table_store.clone(), + #[cfg(feature = "unstable-blockstore")] + block_store.clone(), + crypto.clone(), + ); + RoutingTable::new(network_manager) +} diff --git a/veilid-core/src/routing_table/tests/test_serialize_routing_table.rs b/veilid-core/src/routing_table/tests/test_serialize_routing_table.rs index 89811612..bbf2ac30 100644 --- a/veilid-core/src/routing_table/tests/test_serialize_routing_table.rs +++ b/veilid-core/src/routing_table/tests/test_serialize_routing_table.rs @@ -1,41 +1,14 @@ -use crate::*; -use routing_table::*; - -fn fake_routing_table() -> routing_table::RoutingTable { - let veilid_config = VeilidConfig::new(); - #[cfg(feature = "unstable-blockstore")] - let block_store = BlockStore::new(veilid_config.clone()); - let protected_store = ProtectedStore::new(veilid_config.clone()); - let table_store = TableStore::new(veilid_config.clone(), protected_store.clone()); - let crypto = Crypto::new(veilid_config.clone(), table_store.clone()); - let storage_manager = storage_manager::StorageManager::new( - veilid_config.clone(), - crypto.clone(), - table_store.clone(), - #[cfg(feature = "unstable-blockstore")] - block_store.clone(), - ); - let network_manager = network_manager::NetworkManager::new( - veilid_config.clone(), - storage_manager, - protected_store.clone(), - table_store.clone(), - #[cfg(feature = "unstable-blockstore")] - block_store.clone(), - crypto.clone(), - ); - RoutingTable::new(network_manager) -} +use super::*; pub async fn test_routingtable_buckets_round_trip() { - let original = fake_routing_table(); - let copy = fake_routing_table(); + let original = mock_routing_table(); + let copy = mock_routing_table(); original.init().await.unwrap(); copy.init().await.unwrap(); // Add lots of routes to `original` here to exercise all various types. - let (serialized_bucket_map, all_entry_bytes) = original.serialized_buckets().unwrap(); + let (serialized_bucket_map, all_entry_bytes) = original.serialized_buckets(); copy.populate_routing_table( &mut copy.inner.write(), diff --git a/veilid-core/src/routing_table/types/dial_info_detail.rs b/veilid-core/src/routing_table/types/dial_info_detail.rs index 52e51492..4e59b1af 100644 --- a/veilid-core/src/routing_table/types/dial_info_detail.rs +++ b/veilid-core/src/routing_table/types/dial_info_detail.rs @@ -1,21 +1,7 @@ use super::*; // Keep member order appropriate for sorting < preference -#[derive( - Debug, - Clone, - PartialEq, - PartialOrd, - Ord, - Eq, - Hash, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Debug, Clone, PartialEq, PartialOrd, Ord, Eq, Hash, Serialize, Deserialize)] pub struct DialInfoDetail { pub class: DialInfoClass, pub dial_info: DialInfo, diff --git a/veilid-core/src/routing_table/types/direction.rs b/veilid-core/src/routing_table/types/direction.rs index 98f50182..76187032 100644 --- a/veilid-core/src/routing_table/types/direction.rs +++ b/veilid-core/src/routing_table/types/direction.rs @@ -1,22 +1,12 @@ +#![allow(non_snake_case)] + use super::*; #[allow(clippy::derive_hash_xor_eq)] -#[derive( - Debug, - PartialOrd, - Ord, - Hash, - EnumSetType, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, -)] +#[derive(Debug, PartialOrd, Ord, Hash, EnumSetType, Serialize, Deserialize)] #[enumset(repr = "u8")] -#[archive_attr(repr(u8), derive(CheckBytes))] pub enum Direction { - Inbound, - Outbound, + Inbound = 0, + Outbound = 1, } pub type DirectionSet = EnumSet; diff --git a/veilid-core/src/routing_table/types/node_info.rs b/veilid-core/src/routing_table/types/node_info.rs index 4bbf31da..838022e3 100644 --- a/veilid-core/src/routing_table/types/node_info.rs +++ b/veilid-core/src/routing_table/types/node_info.rs @@ -12,61 +12,10 @@ pub const CAP_APPMESSAGE: Capability = FourCC(*b"APPM"); #[cfg(feature = "unstable-blockstore")] pub const CAP_BLOCKSTORE: Capability = FourCC(*b"BLOC"); -cfg_if! { - if #[cfg(all(feature = "unstable-blockstore", feature="unstable-tunnels"))] { - const PUBLIC_INTERNET_CAPABILITIES_LEN: usize = 8; - } else if #[cfg(any(feature = "unstable-blockstore", feature="unstable-tunnels"))] { - const PUBLIC_INTERNET_CAPABILITIES_LEN: usize = 7; - } else { - const PUBLIC_INTERNET_CAPABILITIES_LEN: usize = 6; - } -} -pub const PUBLIC_INTERNET_CAPABILITIES: [Capability; PUBLIC_INTERNET_CAPABILITIES_LEN] = [ - CAP_ROUTE, - #[cfg(feature = "unstable-tunnels")] - CAP_TUNNEL, - CAP_SIGNAL, - CAP_RELAY, - CAP_VALIDATE_DIAL_INFO, - CAP_DHT, - CAP_APPMESSAGE, - #[cfg(feature = "unstable-blockstore")] - CAP_BLOCKSTORE, -]; - -#[cfg(feature = "unstable-blockstore")] -const LOCAL_NETWORK_CAPABILITIES_LEN: usize = 4; -#[cfg(not(feature = "unstable-blockstore"))] -const LOCAL_NETWORK_CAPABILITIES_LEN: usize = 3; - -pub const LOCAL_NETWORK_CAPABILITIES: [Capability; LOCAL_NETWORK_CAPABILITIES_LEN] = [ - CAP_RELAY, - CAP_DHT, - CAP_APPMESSAGE, - #[cfg(feature = "unstable-blockstore")] - CAP_BLOCKSTORE, -]; - -pub const MAX_CAPABILITIES: usize = 64; - -#[derive( - Clone, - Default, - PartialEq, - Eq, - Debug, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Clone, Default, PartialEq, Eq, Debug, Serialize, Deserialize)] pub struct NodeInfo { network_class: NetworkClass, - #[with(RkyvEnumSet)] outbound_protocols: ProtocolTypeSet, - #[with(RkyvEnumSet)] address_types: AddressTypeSet, envelope_support: Vec, crypto_support: Vec, diff --git a/veilid-core/src/routing_table/types/node_status.rs b/veilid-core/src/routing_table/types/node_status.rs index 2ecb1460..8d937860 100644 --- a/veilid-core/src/routing_table/types/node_status.rs +++ b/veilid-core/src/routing_table/types/node_status.rs @@ -2,8 +2,7 @@ use super::*; /// Non-nodeinfo status for each node is returned by the StatusA call -#[derive(Clone, Debug, Serialize, Deserialize, RkyvArchive, RkyvSerialize, RkyvDeserialize)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Clone, Debug, Serialize, Deserialize)] pub struct NodeStatus { // Reserved for expansion } diff --git a/veilid-core/src/routing_table/types/peer_info.rs b/veilid-core/src/routing_table/types/peer_info.rs index 0f0e453d..60e83430 100644 --- a/veilid-core/src/routing_table/types/peer_info.rs +++ b/veilid-core/src/routing_table/types/peer_info.rs @@ -1,9 +1,6 @@ use super::*; -#[derive( - Clone, Debug, Serialize, Deserialize, PartialEq, Eq, RkyvArchive, RkyvSerialize, RkyvDeserialize, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] pub struct PeerInfo { node_ids: TypedKeyGroup, signed_node_info: SignedNodeInfo, diff --git a/veilid-core/src/routing_table/types/routing_domain.rs b/veilid-core/src/routing_table/types/routing_domain.rs index dcd143a9..8947fd82 100644 --- a/veilid-core/src/routing_table/types/routing_domain.rs +++ b/veilid-core/src/routing_table/types/routing_domain.rs @@ -4,20 +4,8 @@ use super::*; // Routing domain here is listed in order of preference, keep in order #[allow(clippy::derive_hash_xor_eq)] -#[derive( - Debug, - Ord, - PartialOrd, - Hash, - EnumSetType, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, -)] +#[derive(Debug, Ord, PartialOrd, Hash, EnumSetType, Serialize, Deserialize)] #[enumset(repr = "u8")] -#[archive_attr(repr(u8), derive(CheckBytes))] pub enum RoutingDomain { LocalNetwork = 0, PublicInternet = 1, diff --git a/veilid-core/src/routing_table/types/signed_direct_node_info.rs b/veilid-core/src/routing_table/types/signed_direct_node_info.rs index 4ebb2717..521b1bbe 100644 --- a/veilid-core/src/routing_table/types/signed_direct_node_info.rs +++ b/veilid-core/src/routing_table/types/signed_direct_node_info.rs @@ -1,10 +1,7 @@ use super::*; /// Signed NodeInfo that can be passed around amongst peers and verifiable -#[derive( - Clone, Debug, PartialEq, Eq, Serialize, Deserialize, RkyvArchive, RkyvSerialize, RkyvDeserialize, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct SignedDirectNodeInfo { node_info: NodeInfo, timestamp: Timestamp, diff --git a/veilid-core/src/routing_table/types/signed_node_info.rs b/veilid-core/src/routing_table/types/signed_node_info.rs index 3246ef73..801de847 100644 --- a/veilid-core/src/routing_table/types/signed_node_info.rs +++ b/veilid-core/src/routing_table/types/signed_node_info.rs @@ -1,9 +1,6 @@ use super::*; -#[derive( - Clone, Debug, PartialEq, Eq, Serialize, Deserialize, RkyvArchive, RkyvSerialize, RkyvDeserialize, -)] -#[archive_attr(repr(u8), derive(CheckBytes))] +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub enum SignedNodeInfo { Direct(SignedDirectNodeInfo), Relayed(SignedRelayedNodeInfo), diff --git a/veilid-core/src/routing_table/types/signed_relayed_node_info.rs b/veilid-core/src/routing_table/types/signed_relayed_node_info.rs index 68f62bdc..462ebb31 100644 --- a/veilid-core/src/routing_table/types/signed_relayed_node_info.rs +++ b/veilid-core/src/routing_table/types/signed_relayed_node_info.rs @@ -1,10 +1,7 @@ use super::*; /// Signed NodeInfo with a relay that can be passed around amongst peers and verifiable -#[derive( - Clone, Debug, PartialEq, Eq, Serialize, Deserialize, RkyvArchive, RkyvSerialize, RkyvDeserialize, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct SignedRelayedNodeInfo { node_info: NodeInfo, relay_ids: TypedKeyGroup, diff --git a/veilid-core/src/rpc_processor/mod.rs b/veilid-core/src/rpc_processor/mod.rs index 96de25d7..3f73c048 100644 --- a/veilid-core/src/rpc_processor/mod.rs +++ b/veilid-core/src/rpc_processor/mod.rs @@ -1454,28 +1454,39 @@ impl RPCProcessor { &self, encoded_msg: RPCMessageEncoded, ) -> Result, RPCError> { + let address_filter = self.network_manager.address_filter(); + // Decode operation appropriately based on header detail let msg = match &encoded_msg.header.detail { RPCMessageHeaderDetail::Direct(detail) => { + // Get sender node id + let sender_node_id = TypedKey::new( + detail.envelope.get_crypto_kind(), + detail.envelope.get_sender_id(), + ); + // Decode and validate the RPC operation let operation = match self.decode_rpc_operation(&encoded_msg) { Ok(v) => v, - Err(e) => return Ok(NetworkResult::invalid_message(e)), + Err(e) => { + // Punish nodes that send direct undecodable crap + if matches!(e, RPCError::Protocol(_) | RPCError::InvalidFormat(_)) { + address_filter.punish_node_id(sender_node_id); + } + return Ok(NetworkResult::invalid_message(e)); + } }; // Get the routing domain this message came over let routing_domain = detail.routing_domain; // Get the sender noderef, incorporating sender's peer info - let sender_node_id = TypedKey::new( - detail.envelope.get_crypto_kind(), - detail.envelope.get_sender_id(), - ); let mut opt_sender_nr: Option = None; if let Some(sender_peer_info) = operation.sender_peer_info() { // Ensure the sender peer info is for the actual sender specified in the envelope if !sender_peer_info.node_ids().contains(&sender_node_id) { // Attempted to update peer info for the wrong node id + address_filter.punish_node_id(sender_node_id); return Ok(NetworkResult::invalid_message( "attempt to update peer info for non-sender node id", )); @@ -1487,6 +1498,7 @@ impl RPCProcessor { sender_peer_info.signed_node_info(), &[], ) { + address_filter.punish_node_id(sender_node_id); return Ok(NetworkResult::invalid_message( "sender peerinfo has invalid peer scope", )); @@ -1497,7 +1509,10 @@ impl RPCProcessor { false, ) { Ok(v) => Some(v), - Err(e) => return Ok(NetworkResult::invalid_message(e)), + Err(e) => { + address_filter.punish_node_id(sender_node_id); + return Ok(NetworkResult::invalid_message(e)); + } } } @@ -1505,7 +1520,10 @@ impl RPCProcessor { if opt_sender_nr.is_none() { opt_sender_nr = match self.routing_table().lookup_node_ref(sender_node_id) { Ok(v) => v, - Err(e) => return Ok(NetworkResult::invalid_message(e)), + Err(e) => { + address_filter.punish_node_id(sender_node_id); + return Ok(NetworkResult::invalid_message(e)); + } } } @@ -1525,7 +1543,14 @@ impl RPCProcessor { } RPCMessageHeaderDetail::SafetyRouted(_) | RPCMessageHeaderDetail::PrivateRouted(_) => { // Decode and validate the RPC operation - let operation = self.decode_rpc_operation(&encoded_msg)?; + let operation = match self.decode_rpc_operation(&encoded_msg) { + Ok(v) => v, + Err(e) => { + // Punish routes that send routed undecodable crap + // address_filter.punish_route_id(xxx); + return Ok(NetworkResult::invalid_message(e)); + } + }; // Make the RPC message RPCMessage { @@ -1612,7 +1637,7 @@ impl RPCProcessor { let rpc_worker_span = span!(parent: None, Level::TRACE, "rpc_worker recv"); // xxx: causes crash (Missing otel data span extensions) // rpc_worker_span.follows_from(span_id); - + network_result_value_or_log!(match self .process_rpc_message(msg) .instrument(rpc_worker_span) @@ -1623,7 +1648,9 @@ impl RPCProcessor { continue; } - Ok(v) => v, + Ok(v) => { + v + } } => [ format!(": msg.header={:?}", msg.header) ] {}); } } diff --git a/veilid-core/src/rpc_processor/rpc_signal.rs b/veilid-core/src/rpc_processor/rpc_signal.rs index b24a4efe..3226ae00 100644 --- a/veilid-core/src/rpc_processor/rpc_signal.rs +++ b/veilid-core/src/rpc_processor/rpc_signal.rs @@ -52,8 +52,8 @@ impl RPCProcessor { // Can't allow anything other than direct packets here, as handling reverse connections // or anything like via signals over private routes would deanonymize the route - match &msg.header.detail { - RPCMessageHeaderDetail::Direct(_) => {} + let connection_descriptor = match &msg.header.detail { + RPCMessageHeaderDetail::Direct(d) => d.connection_descriptor, RPCMessageHeaderDetail::SafetyRouted(_) | RPCMessageHeaderDetail::PrivateRouted(_) => { return Ok(NetworkResult::invalid_message("signal must be direct")); } @@ -73,7 +73,7 @@ impl RPCProcessor { let network_manager = self.network_manager(); let signal_info = signal.destructure(); network_manager - .handle_signal(signal_info) + .handle_signal(connection_descriptor, signal_info) .await .map_err(RPCError::network) } diff --git a/veilid-core/src/storage_manager/record_store.rs b/veilid-core/src/storage_manager/record_store.rs index b9208635..70bbf694 100644 --- a/veilid-core/src/storage_manager/record_store.rs +++ b/veilid-core/src/storage_manager/record_store.rs @@ -9,9 +9,7 @@ use hashlink::LruCache; pub struct RecordStore where - D: fmt::Debug + Clone + RkyvArchive + RkyvSerialize, - for<'t> ::Archived: CheckBytes>, - ::Archived: RkyvDeserialize, + D: fmt::Debug + Clone + Serialize + for<'d> Deserialize<'d>, { table_store: TableStore, name: String, @@ -41,9 +39,7 @@ pub struct SubkeyResult { impl RecordStore where - D: fmt::Debug + Clone + RkyvArchive + RkyvSerialize, - for<'t> ::Archived: CheckBytes>, - ::Archived: RkyvDeserialize, + D: fmt::Debug + Clone + Serialize + for<'d> Deserialize<'d>, { pub fn new(table_store: TableStore, name: &str, limits: RecordStoreLimits) -> Self { let subkey_cache_size = limits.subkey_cache_size as usize; @@ -93,7 +89,7 @@ where let mut record_index_saved: Vec<(RecordTableKey, Record)> = Vec::with_capacity(record_table_keys.len()); for rtk in record_table_keys { - if let Some(vr) = record_table.load_rkyv::>(0, &rtk).await? { + if let Some(vr) = record_table.load_json::>(0, &rtk).await? { let rik = RecordTableKey::try_from(rtk.as_ref())?; record_index_saved.push((rik, vr)); } @@ -265,7 +261,7 @@ where for rtk in changed_records { // Get the changed record and save it to the table if let Some(r) = self.record_index.peek(&rtk) { - if let Err(e) = rt_xact.store_rkyv(0, &rtk.bytes(), r) { + if let Err(e) = rt_xact.store_json(0, &rtk.bytes(), r) { log_stor!(error "failed to save record: {}", e); } } @@ -303,7 +299,7 @@ where // Save to record table record_table - .store_rkyv(0, &rtk.bytes(), &record) + .store_json(0, &rtk.bytes(), &record) .await .map_err(VeilidAPIError::internal)?; @@ -451,7 +447,7 @@ where } // If not in cache, try to pull from table store if it is in our stored subkey set let Some(record_data) = subkey_table - .load_rkyv::(0, &stk.bytes()) + .load_json::(0, &stk.bytes()) .await .map_err(VeilidAPIError::internal)? else { apibail_internal!("failed to get subkey that was stored"); @@ -517,7 +513,7 @@ where } // If not in cache, try to pull from table store if it is in our stored subkey set let Some(record_data) = subkey_table - .load_rkyv::(0, &stk.bytes()) + .load_json::(0, &stk.bytes()) .await .map_err(VeilidAPIError::internal)? else { apibail_internal!("failed to peek subkey that was stored"); @@ -575,7 +571,7 @@ where } else { // If not in cache, try to pull from table store if let Some(record_data) = subkey_table - .load_rkyv::(0, &stk_bytes) + .load_json::(0, &stk_bytes) .await .map_err(VeilidAPIError::internal)? { @@ -606,7 +602,7 @@ where // Write subkey subkey_table - .store_rkyv(0, &stk_bytes, &record_data) + .store_json(0, &stk_bytes, &record_data) .await .map_err(VeilidAPIError::internal)?; diff --git a/veilid-core/src/storage_manager/storage_manager_inner.rs b/veilid-core/src/storage_manager/storage_manager_inner.rs index bf06161e..2d74c2b5 100644 --- a/veilid-core/src/storage_manager/storage_manager_inner.rs +++ b/veilid-core/src/storage_manager/storage_manager_inner.rs @@ -1,5 +1,8 @@ use super::*; +const STORAGE_MANAGER_METADATA: &str = "storage_manager_metadata"; +const OFFLINE_SUBKEY_WRITES: &[u8] = b"offline_subkey_writes"; + /// Locked structure for storage manager pub(super) struct StorageManagerInner { unlocked_inner: Arc, @@ -68,7 +71,7 @@ impl StorageManagerInner { let metadata_db = self.unlocked_inner .table_store - .open(&format!("storage_manager_metadata"), 1) + .open(STORAGE_MANAGER_METADATA, 1) .await?; let local_limits = local_limits_from_config(self.unlocked_inner.config.clone()); @@ -146,7 +149,7 @@ impl StorageManagerInner { async fn save_metadata(&mut self) -> EyreResult<()>{ if let Some(metadata_db) = &self.metadata_db { let tx = metadata_db.transact(); - tx.store_rkyv(0, b"offline_subkey_writes", &self.offline_subkey_writes)?; + tx.store_json(0, OFFLINE_SUBKEY_WRITES, &self.offline_subkey_writes)?; tx.commit().await.wrap_err("failed to commit")? } Ok(()) @@ -154,10 +157,10 @@ impl StorageManagerInner { async fn load_metadata(&mut self) -> EyreResult<()> { if let Some(metadata_db) = &self.metadata_db { - self.offline_subkey_writes = match metadata_db.load_rkyv(0, b"offline_subkey_writes").await { + self.offline_subkey_writes = match metadata_db.load_json(0, OFFLINE_SUBKEY_WRITES).await { Ok(v) => v.unwrap_or_default(), Err(_) => { - if let Err(e) = metadata_db.delete(0,b"offline_subkey_writes").await { + if let Err(e) = metadata_db.delete(0, OFFLINE_SUBKEY_WRITES).await { debug!("offline_subkey_writes format changed, clearing: {}", e); } Default::default() @@ -483,9 +486,7 @@ impl StorageManagerInner { /// # DHT Key = Hash(ownerKeyKind) of: [ ownerKeyValue, schema ] fn get_key(vcrypto: CryptoSystemVersion, record: &Record) -> TypedKey where - D: fmt::Debug + Clone + RkyvArchive + RkyvSerialize, - for<'t> ::Archived: CheckBytes>, - ::Archived: RkyvDeserialize, + D: fmt::Debug + Clone + Serialize, { let compiled = record.descriptor().schema_data(); let mut hash_data = Vec::::with_capacity(PUBLIC_KEY_LENGTH + 4 + compiled.len()); diff --git a/veilid-core/src/storage_manager/types/local_record_detail.rs b/veilid-core/src/storage_manager/types/local_record_detail.rs index 9f16ba80..64e1f8d7 100644 --- a/veilid-core/src/storage_manager/types/local_record_detail.rs +++ b/veilid-core/src/storage_manager/types/local_record_detail.rs @@ -1,10 +1,7 @@ use super::*; /// Information required to handle locally opened records -#[derive( - Clone, Debug, PartialEq, Eq, Serialize, Deserialize, RkyvArchive, RkyvSerialize, RkyvDeserialize, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct LocalRecordDetail { /// The last 'safety selection' used when creating/opening this record. /// Even when closed, this safety selection applies to re-publication attempts by the system. diff --git a/veilid-core/src/storage_manager/types/record.rs b/veilid-core/src/storage_manager/types/record.rs index 86786c96..76f61bc0 100644 --- a/veilid-core/src/storage_manager/types/record.rs +++ b/veilid-core/src/storage_manager/types/record.rs @@ -1,14 +1,9 @@ use super::*; -#[derive( - Clone, Debug, PartialEq, Eq, Serialize, Deserialize, RkyvArchive, RkyvSerialize, RkyvDeserialize, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct Record where - D: fmt::Debug + Clone + RkyvArchive + RkyvSerialize, - for<'t> ::Archived: CheckBytes>, - ::Archived: RkyvDeserialize, + D: fmt::Debug + Clone + Serialize, { descriptor: SignedValueDescriptor, subkey_count: usize, @@ -20,9 +15,7 @@ where impl Record where - D: fmt::Debug + Clone + RkyvArchive + RkyvSerialize, - for<'t> ::Archived: CheckBytes>, - ::Archived: RkyvDeserialize, + D: fmt::Debug + Clone + Serialize, { pub fn new( cur_ts: Timestamp, @@ -84,9 +77,9 @@ where mem::size_of::>() + self.descriptor.total_size() + self.record_data_size } - pub fn detail(&self) -> &D { - &self.detail - } + // pub fn detail(&self) -> &D { + // &self.detail + // } pub fn detail_mut(&mut self) -> &mut D { &mut self.detail } diff --git a/veilid-core/src/storage_manager/types/record_data.rs b/veilid-core/src/storage_manager/types/record_data.rs index a9f8ed51..532f4e0b 100644 --- a/veilid-core/src/storage_manager/types/record_data.rs +++ b/veilid-core/src/storage_manager/types/record_data.rs @@ -1,19 +1,6 @@ use super::*; -#[derive( - Clone, - Debug, - PartialEq, - Eq, - PartialOrd, - Ord, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)] pub struct RecordData { signed_value_data: SignedValueData, } diff --git a/veilid-core/src/storage_manager/types/remote_record_detail.rs b/veilid-core/src/storage_manager/types/remote_record_detail.rs index e835faa6..f17a474d 100644 --- a/veilid-core/src/storage_manager/types/remote_record_detail.rs +++ b/veilid-core/src/storage_manager/types/remote_record_detail.rs @@ -1,7 +1,4 @@ use super::*; -#[derive( - Clone, Debug, PartialEq, Eq, Serialize, Deserialize, RkyvArchive, RkyvSerialize, RkyvDeserialize, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct RemoteRecordDetail {} diff --git a/veilid-core/src/storage_manager/types/signed_value_data.rs b/veilid-core/src/storage_manager/types/signed_value_data.rs index 466764c8..1a2a3cf8 100644 --- a/veilid-core/src/storage_manager/types/signed_value_data.rs +++ b/veilid-core/src/storage_manager/types/signed_value_data.rs @@ -3,20 +3,7 @@ use super::*; ///////////////////////////////////////////////////////////////////////////////////////////////////// /// -#[derive( - Clone, - Debug, - PartialOrd, - PartialEq, - Eq, - Ord, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Clone, Debug, PartialOrd, PartialEq, Eq, Ord, Serialize, Deserialize)] pub struct SignedValueData { value_data: ValueData, signature: Signature, diff --git a/veilid-core/src/storage_manager/types/signed_value_descriptor.rs b/veilid-core/src/storage_manager/types/signed_value_descriptor.rs index ec5a3f38..a1c07615 100644 --- a/veilid-core/src/storage_manager/types/signed_value_descriptor.rs +++ b/veilid-core/src/storage_manager/types/signed_value_descriptor.rs @@ -3,19 +3,7 @@ use super::*; ///////////////////////////////////////////////////////////////////////////////////////////////////// /// -#[derive( - Clone, - PartialOrd, - PartialEq, - Eq, - Ord, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Clone, PartialOrd, PartialEq, Eq, Ord, Serialize, Deserialize)] pub struct SignedValueDescriptor { owner: PublicKey, schema_data: Vec, diff --git a/veilid-core/src/table_store/table_db.rs b/veilid-core/src/table_store/table_db.rs index f8f5b69a..a95d3298 100644 --- a/veilid-core/src/table_store/table_db.rs +++ b/veilid-core/src/table_store/table_db.rs @@ -102,13 +102,14 @@ impl TableDB { /// but if the contents are guaranteed to be unique, then a nonce /// can be generated from the hash of the contents and the encryption key itself fn maybe_encrypt(&self, data: &[u8], keyed_nonce: bool) -> Vec { + let data = compress_prepend_size(data); if let Some(ei) = &self.unlocked_inner.encrypt_info { let mut out = unsafe { unaligned_u8_vec_uninit(NONCE_LENGTH + data.len()) }; if keyed_nonce { // Key content nonce let mut noncedata = Vec::with_capacity(data.len() + PUBLIC_KEY_LENGTH); - noncedata.extend_from_slice(data); + noncedata.extend_from_slice(&data); noncedata.extend_from_slice(&ei.key.bytes); let noncehash = ei.vcrypto.generate_hash(&noncedata); out[0..NONCE_LENGTH].copy_from_slice(&noncehash[0..NONCE_LENGTH]) @@ -119,23 +120,23 @@ impl TableDB { let (nonce, encout) = out.split_at_mut(NONCE_LENGTH); ei.vcrypto.crypt_b2b_no_auth( - data, + &data, encout, (nonce as &[u8]).try_into().unwrap(), &ei.key, ); out } else { - data.to_vec() + data } } /// Decrypt buffer using decrypt key with nonce prepended to input - fn maybe_decrypt(&self, data: &[u8]) -> Vec { + fn maybe_decrypt(&self, data: &[u8]) -> std::io::Result> { if let Some(di) = &self.unlocked_inner.decrypt_info { assert!(data.len() >= NONCE_LENGTH); if data.len() == NONCE_LENGTH { - return Vec::new(); + return Ok(Vec::new()); } let mut out = unsafe { unaligned_u8_vec_uninit(data.len() - NONCE_LENGTH) }; @@ -146,9 +147,11 @@ impl TableDB { (&data[0..NONCE_LENGTH]).try_into().unwrap(), &di.key, ); - out + decompress_size_prepended(&out) + .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string())) } else { - data.to_vec() + decompress_size_prepended(data) + .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string())) } } @@ -163,7 +166,8 @@ impl TableDB { let db = self.unlocked_inner.database.clone(); let mut out = Vec::new(); db.iter_keys(col, None, |k| { - out.push(self.maybe_decrypt(k)); + let key = self.maybe_decrypt(k)?; + out.push(key); Ok(Option::<()>::None) }) .await @@ -195,15 +199,6 @@ impl TableDB { db.write(dbt).await.map_err(VeilidAPIError::generic) } - /// Store a key in rkyv format with a value in a column in the TableDB. Performs a single transaction immediately. - pub async fn store_rkyv(&self, col: u32, key: &[u8], value: &T) -> VeilidAPIResult<()> - where - T: RkyvSerialize, - { - let value = to_rkyv(value)?; - self.store(col, key, &value).await - } - /// Store a key in json format with a value in a column in the TableDB. Performs a single transaction immediately. pub async fn store_json(&self, col: u32, key: &[u8], value: &T) -> VeilidAPIResult<()> where @@ -223,26 +218,10 @@ impl TableDB { } let db = self.unlocked_inner.database.clone(); let key = self.maybe_encrypt(key, true); - Ok(db - .get(col, &key) - .await - .map_err(VeilidAPIError::from)? - .map(|v| self.maybe_decrypt(&v))) - } - - /// Read an rkyv key from a column in the TableDB immediately - pub async fn load_rkyv(&self, col: u32, key: &[u8]) -> VeilidAPIResult> - where - T: RkyvArchive, - ::Archived: - for<'t> CheckBytes>, - ::Archived: RkyvDeserialize, - { - let out = match self.load(col, key).await? { - Some(v) => Some(from_rkyv(v)?), - None => None, - }; - Ok(out) + match db.get(col, &key).await.map_err(VeilidAPIError::from)? { + Some(v) => Ok(Some(self.maybe_decrypt(&v).map_err(VeilidAPIError::from)?)), + None => Ok(None), + } } /// Read an serde-json key from a column in the TableDB immediately @@ -268,27 +247,11 @@ impl TableDB { let key = self.maybe_encrypt(key, true); let db = self.unlocked_inner.database.clone(); - let old_value = db - .delete(col, &key) - .await - .map_err(VeilidAPIError::from)? - .map(|v| self.maybe_decrypt(&v)); - Ok(old_value) - } - /// Delete rkyv key with from a column in the TableDB - pub async fn delete_rkyv(&self, col: u32, key: &[u8]) -> VeilidAPIResult> - where - T: RkyvArchive, - ::Archived: - for<'t> CheckBytes>, - ::Archived: RkyvDeserialize, - { - let old_value = match self.delete(col, key).await? { - Some(v) => Some(from_rkyv(v)?), - None => None, - }; - Ok(old_value) + match db.delete(col, &key).await.map_err(VeilidAPIError::from)? { + Some(v) => Ok(Some(self.maybe_decrypt(&v).map_err(VeilidAPIError::from)?)), + None => Ok(None), + } } /// Delete serde-json key with from a column in the TableDB @@ -377,16 +340,7 @@ impl TableDBTransaction { Ok(()) } - /// Store a key in rkyv format with a value in a column in the TableDB - pub fn store_rkyv(&self, col: u32, key: &[u8], value: &T) -> VeilidAPIResult<()> - where - T: RkyvSerialize, - { - let value = to_rkyv(value)?; - self.store(col, key, &value) - } - - /// Store a key in rkyv format with a value in a column in the TableDB + /// Store a key in json format with a value in a column in the TableDB pub fn store_json(&self, col: u32, key: &[u8], value: &T) -> VeilidAPIResult<()> where T: serde::Serialize, diff --git a/veilid-core/src/table_store/table_store.rs b/veilid-core/src/table_store/table_store.rs index fb293c44..04a9206f 100644 --- a/veilid-core/src/table_store/table_store.rs +++ b/veilid-core/src/table_store/table_store.rs @@ -1,6 +1,8 @@ use super::*; use keyvaluedb::*; +const ALL_TABLE_NAMES: &[u8] = b"all_table_names"; + struct TableStoreInner { opened: BTreeMap>, encryption_key: Option, @@ -52,12 +54,11 @@ impl TableStore { async fn flush(&self) { let (all_table_names_value, all_tables_db) = { let inner = self.inner.lock(); - let all_table_names_value = - to_rkyv(&inner.all_table_names).expect("failed to archive all_table_names"); + let all_table_names_value = serialize_json_bytes(&inner.all_table_names); (all_table_names_value, inner.all_tables_db.clone().unwrap()) }; let mut dbt = DBTransaction::new(); - dbt.put(0, b"all_table_names", &all_table_names_value); + dbt.put(0, ALL_TABLE_NAMES, &all_table_names_value); if let Err(e) = all_tables_db.write(dbt).await { error!("failed to write all tables db: {}", e); } @@ -373,8 +374,8 @@ impl TableStore { .open("__veilid_all_tables", 1) .await .wrap_err("failed to create all tables table")?; - match all_tables_db.get(0, b"all_table_names").await { - Ok(Some(v)) => match from_rkyv::>(v) { + match all_tables_db.get(0, ALL_TABLE_NAMES).await { + Ok(Some(v)) => match deserialize_json_bytes::>(&v) { Ok(all_table_names) => { let mut inner = self.inner.lock(); inner.all_table_names = all_table_names; diff --git a/veilid-core/src/table_store/tests/test_table_store.rs b/veilid-core/src/table_store/tests/test_table_store.rs index 86383f39..9bb503b3 100644 --- a/veilid-core/src/table_store/tests/test_table_store.rs +++ b/veilid-core/src/table_store/tests/test_table_store.rs @@ -145,7 +145,6 @@ pub async fn test_transaction(ts: TableStore) { let tx = db.transact(); assert!(tx.store(0, b"aaa", b"a-value").is_ok()); assert!(tx.store_json(1, b"bbb", &"b-value".to_owned()).is_ok()); - assert!(tx.store_rkyv(2, b"ccc", &"c-value".to_owned()).is_ok()); assert!(tx.store(3, b"ddd", b"d-value").is_err()); assert!(tx.store(0, b"ddd", b"d-value").is_ok()); assert!(tx.delete(0, b"ddd").is_ok()); @@ -160,51 +159,9 @@ pub async fn test_transaction(ts: TableStore) { db.load_json::(1, b"bbb").await, Ok(Some("b-value".to_owned())) ); - assert_eq!( - db.load_rkyv::(2, b"ccc").await, - Ok(Some("c-value".to_owned())) - ); assert_eq!(db.load(0, b"ddd").await, Ok(None)); } -pub async fn test_rkyv(vcrypto: CryptoSystemVersion, ts: TableStore) { - trace!("test_rkyv"); - - let _ = ts.delete("test"); - let db = ts.open("test", 3).await.expect("should have opened"); - let keypair = vcrypto.generate_keypair(); - - assert!(db.store_rkyv(0, b"asdf", &keypair).await.is_ok()); - - assert_eq!(db.load_rkyv::(0, b"qwer").await.unwrap(), None); - - let d = match db.load_rkyv::(0, b"asdf").await { - Ok(x) => x, - Err(e) => { - panic!("couldn't decode: {}", e); - } - }; - assert_eq!(d, Some(keypair), "keys should be equal"); - - let d = match db.delete_rkyv::(0, b"asdf").await { - Ok(x) => x, - Err(e) => { - panic!("couldn't decode: {}", e); - } - }; - assert_eq!(d, Some(keypair), "keys should be equal"); - - assert!( - db.store(1, b"foo", b"1234567890").await.is_ok(), - "should store new key" - ); - - assert!( - db.load_rkyv::(1, b"foo").await.is_err(), - "should fail to unfreeze" - ); -} - pub async fn test_json(vcrypto: CryptoSystemVersion, ts: TableStore) { trace!("test_json"); @@ -304,7 +261,6 @@ pub async fn test_all() { test_delete_open_delete(ts.clone()).await; test_store_delete_load(ts.clone()).await; test_transaction(ts.clone()).await; - test_rkyv(vcrypto.clone(), ts.clone()).await; test_json(vcrypto, ts.clone()).await; let _ = ts.delete("test").await; } diff --git a/veilid-core/src/tests/native/mod.rs b/veilid-core/src/tests/native/mod.rs index e8b450a3..382d10eb 100644 --- a/veilid-core/src/tests/native/mod.rs +++ b/veilid-core/src/tests/native/mod.rs @@ -35,8 +35,6 @@ pub async fn run_all_tests() { test_envelope_receipt::test_all().await; info!("TEST: veilid_api::tests::test_serialize_json"); veilid_api::tests::test_serialize_json::test_all().await; - info!("TEST: veilid_api::tests::test_serialize_rkyv"); - veilid_api::tests::test_serialize_rkyv::test_all().await; info!("TEST: routing_table::test_serialize_routing_table"); routing_table::tests::test_serialize_routing_table::test_all().await; @@ -138,8 +136,6 @@ cfg_if! { run_test!(veilid_api, test_serialize_json); - run_test!(veilid_api, test_serialize_rkyv); - run_test!(routing_table, test_serialize_routing_table); } } diff --git a/veilid-core/src/veilid_api/debug.rs b/veilid-core/src/veilid_api/debug.rs index ebe633d5..3dfa1b5f 100644 --- a/veilid-core/src/veilid_api/debug.rs +++ b/veilid-core/src/veilid_api/debug.rs @@ -467,6 +467,23 @@ impl VeilidAPI { let routing_table = self.network_manager()?.routing_table(); Ok(routing_table.debug_info_dialinfo()) } + async fn debug_peerinfo(&self, args: String) -> VeilidAPIResult { + // Dump routing table peerinfo + let args: Vec = args.split_whitespace().map(|s| s.to_owned()).collect(); + let routing_table = self.network_manager()?.routing_table(); + + let routing_domain = get_debug_argument_at( + &args, + 0, + "debug_peerinfo", + "routing_domain", + get_routing_domain, + ) + .ok() + .unwrap_or(RoutingDomain::PublicInternet); + + Ok(routing_table.debug_info_peerinfo(routing_domain)) + } async fn debug_txtrecord(&self, _args: String) -> VeilidAPIResult { // Dump routing table txt record @@ -1068,22 +1085,24 @@ impl VeilidAPI { let routing_table = netman.routing_table(); let crypto = self.crypto()?; - let csv = get_debug_argument_at( - &args, - 1, - "debug_record_create", - "kind", - get_crypto_system_version(crypto.clone()), - ) - .unwrap_or_else(|_| crypto.best()); let schema = get_debug_argument_at( &args, - 2, + 1, "debug_record_create", "dht_schema", get_dht_schema, ) .unwrap_or_else(|_| DHTSchema::dflt(1)); + + let csv = get_debug_argument_at( + &args, + 2, + "debug_record_create", + "kind", + get_crypto_system_version(crypto.clone()), + ) + .unwrap_or_else(|_| crypto.best()); + let ss = get_debug_argument_at( &args, 3, @@ -1106,7 +1125,7 @@ impl VeilidAPI { }; // Do a record get - let record = match rc.create_dht_record(csv.kind(), schema).await { + let record = match rc.create_dht_record(schema, Some(csv.kind())).await { Err(e) => return Ok(format!("Can't open DHT record: {}", e)), Ok(v) => v, }; @@ -1325,6 +1344,7 @@ impl VeilidAPI { pub async fn debug_help(&self, _args: String) -> VeilidAPIResult { Ok(r#"buckets [dead|reliable] dialinfo +peerinfo [routingdomain] entries [dead|reliable] entry nodeinfo @@ -1348,7 +1368,7 @@ route allocate [ord|*ord] [rel] [] [in|out] test record list purge [bytes] - create + create [ []] set [+] get [+] [force] delete @@ -1398,6 +1418,8 @@ record list self.debug_buckets(rest).await } else if arg == "dialinfo" { self.debug_dialinfo(rest).await + } else if arg == "peerinfo" { + self.debug_peerinfo(rest).await } else if arg == "txtrecord" { self.debug_txtrecord(rest).await } else if arg == "keypair" { diff --git a/veilid-core/src/veilid_api/error.rs b/veilid-core/src/veilid_api/error.rs index 0eb7b791..6fcc4861 100644 --- a/veilid-core/src/veilid_api/error.rs +++ b/veilid-core/src/veilid_api/error.rs @@ -105,21 +105,8 @@ macro_rules! apibail_already_initialized { } #[derive( - ThisError, - Clone, - Debug, - PartialOrd, - PartialEq, - Eq, - Ord, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, + ThisError, Clone, Debug, PartialOrd, PartialEq, Eq, Ord, Serialize, Deserialize, JsonSchema, )] -#[archive_attr(repr(u8), derive(CheckBytes))] #[serde(tag = "kind")] pub enum VeilidAPIError { #[error("Not initialized")] @@ -137,9 +124,9 @@ pub enum VeilidAPIError { #[error("No connection: {message}")] NoConnection { message: String }, #[error("Key not found: {key}")] - KeyNotFound { - #[schemars(with="String")] - key: TypedKey + KeyNotFound { + #[schemars(with = "String")] + key: TypedKey, }, #[error("Internal: {message}")] Internal { message: String }, diff --git a/veilid-core/src/veilid_api/json_api/crypto_system.rs b/veilid-core/src/veilid_api/json_api/crypto_system.rs index 5fa499c8..d66bcaf4 100644 --- a/veilid-core/src/veilid_api/json_api/crypto_system.rs +++ b/veilid-core/src/veilid_api/json_api/crypto_system.rs @@ -35,24 +35,24 @@ pub enum CryptoSystemRequestOp { }, DefaultSaltLength, HashPassword { - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] password: Vec, - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] salt: Vec, }, VerifyPassword { - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] password: Vec, password_hash: String, }, DeriveSharedSecret { - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] password: Vec, - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] salt: Vec, }, @@ -60,7 +60,7 @@ pub enum CryptoSystemRequestOp { RandomSharedSecret, GenerateKeyPair, GenerateHash { - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] data: Vec, }, @@ -71,7 +71,7 @@ pub enum CryptoSystemRequestOp { secret: SecretKey, }, ValidateHash { - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] data: Vec, #[schemars(with = "String")] @@ -88,14 +88,14 @@ pub enum CryptoSystemRequestOp { key: PublicKey, #[schemars(with = "String")] secret: SecretKey, - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] data: Vec, }, Verify { #[schemars(with = "String")] key: PublicKey, - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] data: Vec, #[schemars(with = "String")] @@ -103,31 +103,31 @@ pub enum CryptoSystemRequestOp { }, AeadOverhead, DecryptAead { - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] body: Vec, #[schemars(with = "String")] nonce: Nonce, #[schemars(with = "String")] shared_secret: SharedSecret, - #[serde(with = "opt_json_as_base64")] + #[serde(with = "as_human_opt_base64")] #[schemars(with = "Option")] associated_data: Option>, }, EncryptAead { - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] body: Vec, #[schemars(with = "String")] nonce: Nonce, #[schemars(with = "String")] shared_secret: SharedSecret, - #[serde(with = "opt_json_as_base64")] + #[serde(with = "as_human_opt_base64")] #[schemars(with = "Option")] associated_data: Option>, }, CryptNoAuth { - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] body: Vec, #[schemars(with = "String")] @@ -152,7 +152,7 @@ pub enum CryptoSystemResponseOp { result: ApiResultWithString, }, RandomBytes { - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] value: Vec, }, @@ -221,7 +221,7 @@ pub enum CryptoSystemResponseOp { result: ApiResultWithVecU8, }, CryptNoAuth { - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] value: Vec, }, diff --git a/veilid-core/src/veilid_api/json_api/mod.rs b/veilid-core/src/veilid_api/json_api/mod.rs index 50596326..5b04a4bd 100644 --- a/veilid-core/src/veilid_api/json_api/mod.rs +++ b/veilid-core/src/veilid_api/json_api/mod.rs @@ -58,7 +58,7 @@ pub enum RequestOp { sequencing: Sequencing, }, ImportRemotePrivateRoute { - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] blob: Vec, }, @@ -69,7 +69,7 @@ pub enum RequestOp { AppCallReply { #[schemars(with = "String")] call_id: OperationId, - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] message: Vec, }, @@ -96,14 +96,14 @@ pub enum RequestOp { VerifySignatures { #[schemars(with = "Vec")] node_ids: Vec, - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] data: Vec, #[schemars(with = "Vec")] signatures: Vec, }, GenerateSignatures { - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] data: Vec, #[schemars(with = "Vec")] @@ -126,7 +126,7 @@ pub enum RequestOp { pub struct NewPrivateRouteResult { #[schemars(with = "String")] route_id: RouteId, - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] blob: Vec, } @@ -260,7 +260,7 @@ where #[serde(untagged)] pub enum ApiResultWithVecU8 { Ok { - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] value: Vec, }, @@ -271,7 +271,7 @@ pub enum ApiResultWithVecU8 { #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] #[serde(transparent)] pub struct VecU8 { - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] value: Vec, } diff --git a/veilid-core/src/veilid_api/json_api/process.rs b/veilid-core/src/veilid_api/json_api/process.rs index 018dc276..8e1264df 100644 --- a/veilid-core/src/veilid_api/json_api/process.rs +++ b/veilid-core/src/veilid_api/json_api/process.rs @@ -277,10 +277,10 @@ impl JsonRequestProcessor { ), } } - RoutingContextRequestOp::CreateDhtRecord { kind, schema } => { + RoutingContextRequestOp::CreateDhtRecord { schema, kind } => { RoutingContextResponseOp::CreateDhtRecord { result: to_json_api_result( - routing_context.create_dht_record(kind, schema).await, + routing_context.create_dht_record(schema, kind).await, ), } } diff --git a/veilid-core/src/veilid_api/json_api/routing_context.rs b/veilid-core/src/veilid_api/json_api/routing_context.rs index 8ecfff32..dc4ac323 100644 --- a/veilid-core/src/veilid_api/json_api/routing_context.rs +++ b/veilid-core/src/veilid_api/json_api/routing_context.rs @@ -27,20 +27,20 @@ pub enum RoutingContextRequestOp { }, AppCall { target: String, - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] message: Vec, }, AppMessage { target: String, - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] message: Vec, }, CreateDhtRecord { - #[schemars(with = "String")] - kind: CryptoKind, schema: DHTSchema, + #[schemars(with = "Option")] + kind: Option, }, OpenDhtRecord { #[schemars(with = "String")] @@ -66,7 +66,7 @@ pub enum RoutingContextRequestOp { #[schemars(with = "String")] key: TypedKey, subkey: ValueSubkey, - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] data: Vec, }, diff --git a/veilid-core/src/veilid_api/json_api/table_db.rs b/veilid-core/src/veilid_api/json_api/table_db.rs index 3a1d2008..54d35fcd 100644 --- a/veilid-core/src/veilid_api/json_api/table_db.rs +++ b/veilid-core/src/veilid_api/json_api/table_db.rs @@ -25,22 +25,22 @@ pub enum TableDbRequestOp { Transact, Store { col: u32, - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] key: Vec, - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] value: Vec, }, Load { col: u32, - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] key: Vec, }, Delete { col: u32, - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] key: Vec, }, @@ -101,16 +101,16 @@ pub enum TableDbTransactionRequestOp { Rollback, Store { col: u32, - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] key: Vec, - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] value: Vec, }, Delete { col: u32, - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] key: Vec, }, diff --git a/veilid-core/src/veilid_api/routing_context.rs b/veilid-core/src/veilid_api/routing_context.rs index 47b30271..16afc60a 100644 --- a/veilid-core/src/veilid_api/routing_context.rs +++ b/veilid-core/src/veilid_api/routing_context.rs @@ -195,9 +195,10 @@ impl RoutingContext { /// Returns the newly allocated DHT record's key if successful. The records is considered 'open' after the create operation succeeds. pub async fn create_dht_record( &self, - kind: CryptoKind, schema: DHTSchema, + kind: Option, ) -> VeilidAPIResult { + let kind = kind.unwrap_or(best_crypto_kind()); let storage_manager = self.api.storage_manager()?; storage_manager .create_record(kind, schema, self.unlocked_inner.safety_selection) diff --git a/veilid-core/src/veilid_api/serialize_helpers/mod.rs b/veilid-core/src/veilid_api/serialize_helpers/mod.rs index 5a3805fd..e18fb135 100644 --- a/veilid-core/src/veilid_api/serialize_helpers/mod.rs +++ b/veilid-core/src/veilid_api/serialize_helpers/mod.rs @@ -1,14 +1,7 @@ -mod rkyv_enum_set; -mod rkyv_range_set_blaze; -pub mod serialize_arc; -mod serialize_json; -pub mod serialize_range_set_blaze; -mod veilid_rkyv; - use super::*; use core::fmt::Debug; -pub use rkyv_enum_set::*; -pub use rkyv_range_set_blaze::*; +pub mod serialize_arc; +mod serialize_json; +pub mod serialize_range_set_blaze; pub use serialize_json::*; -pub use veilid_rkyv::*; diff --git a/veilid-core/src/veilid_api/serialize_helpers/rkyv_enum_set.rs b/veilid-core/src/veilid_api/serialize_helpers/rkyv_enum_set.rs deleted file mode 100644 index a3422b48..00000000 --- a/veilid-core/src/veilid_api/serialize_helpers/rkyv_enum_set.rs +++ /dev/null @@ -1,53 +0,0 @@ -use super::*; - -pub struct RkyvEnumSet; - -impl rkyv::with::ArchiveWith> for RkyvEnumSet -where - T: EnumSetType + EnumSetTypeWithRepr, - ::Repr: rkyv::Archive, -{ - type Archived = rkyv::Archived<::Repr>; - type Resolver = rkyv::Resolver<::Repr>; - - #[inline] - unsafe fn resolve_with( - field: &EnumSet, - pos: usize, - resolver: Self::Resolver, - out: *mut Self::Archived, - ) { - let r = field.as_repr(); - r.resolve(pos, resolver, out); - } -} - -impl rkyv::with::SerializeWith, S> for RkyvEnumSet -where - S: rkyv::Fallible + ?Sized, - T: EnumSetType + EnumSetTypeWithRepr, - ::Repr: rkyv::Serialize, -{ - fn serialize_with(field: &EnumSet, serializer: &mut S) -> Result { - let r = field.as_repr(); - r.serialize(serializer) - } -} - -impl - rkyv::with::DeserializeWith::Repr>, EnumSet, D> - for RkyvEnumSet -where - D: rkyv::Fallible + ?Sized, - T: EnumSetType + EnumSetTypeWithRepr, - ::Repr: rkyv::Archive, - rkyv::Archived<::Repr>: - rkyv::Deserialize<::Repr, D>, -{ - fn deserialize_with( - field: &rkyv::Archived<::Repr>, - deserializer: &mut D, - ) -> Result, D::Error> { - Ok(EnumSet::::from_repr(field.deserialize(deserializer)?)) - } -} diff --git a/veilid-core/src/veilid_api/serialize_helpers/rkyv_range_set_blaze.rs b/veilid-core/src/veilid_api/serialize_helpers/rkyv_range_set_blaze.rs deleted file mode 100644 index 67388e4a..00000000 --- a/veilid-core/src/veilid_api/serialize_helpers/rkyv_range_set_blaze.rs +++ /dev/null @@ -1,73 +0,0 @@ -use super::*; - -use range_set_blaze::*; - -pub struct RkyvRangeSetBlaze; - -impl rkyv::with::ArchiveWith> for RkyvRangeSetBlaze -where - T: rkyv::Archive + Integer, -{ - type Archived = rkyv::Archived>; - type Resolver = rkyv::Resolver>; - - #[inline] - unsafe fn resolve_with( - field: &RangeSetBlaze, - pos: usize, - resolver: Self::Resolver, - out: *mut Self::Archived, - ) { - let mut r = Vec::::with_capacity(field.ranges_len() * 2); - for range in field.ranges() { - r.push(*range.start()); - r.push(*range.end()); - } - r.resolve(pos, resolver, out); - } -} - -impl rkyv::with::SerializeWith, S> for RkyvRangeSetBlaze -where - S: rkyv::Fallible + ?Sized, - Vec: rkyv::Serialize, - T: rkyv::Archive + Integer, -{ - fn serialize_with( - field: &RangeSetBlaze, - serializer: &mut S, - ) -> Result { - let mut r = Vec::::with_capacity(field.ranges_len() * 2); - for range in field.ranges() { - r.push(*range.start()); - r.push(*range.end()); - } - r.serialize(serializer) - } -} - -impl rkyv::with::DeserializeWith>, RangeSetBlaze, D> - for RkyvRangeSetBlaze -where - D: rkyv::Fallible + ?Sized, - T: rkyv::Archive + Integer, - rkyv::Archived: rkyv::Deserialize, - D::Error: From, -{ - fn deserialize_with( - field: &rkyv::Archived>, - deserializer: &mut D, - ) -> Result, D::Error> { - let mut out = RangeSetBlaze::::new(); - if field.len() % 2 == 1 { - return Err("invalid range set length".to_owned().into()); - } - let f = field.as_slice(); - for i in 0..field.len() / 2 { - let l: T = f[i * 2].deserialize(deserializer)?; - let u: T = f[i * 2 + 1].deserialize(deserializer)?; - out.ranges_insert(l..=u); - } - Ok(out) - } -} diff --git a/veilid-core/src/veilid_api/serialize_helpers/serialize_json.rs b/veilid-core/src/veilid_api/serialize_helpers/serialize_json.rs index afdab167..1f41ebf4 100644 --- a/veilid-core/src/veilid_api/serialize_helpers/serialize_json.rs +++ b/veilid-core/src/veilid_api/serialize_helpers/serialize_json.rs @@ -13,6 +13,18 @@ pub fn deserialize_json<'a, T: de::Deserialize<'a> + Debug>(arg: &'a str) -> Vei ), }) } +pub fn deserialize_json_bytes<'a, T: de::Deserialize<'a> + Debug>( + arg: &'a [u8], +) -> VeilidAPIResult { + serde_json::from_slice(arg).map_err(|e| VeilidAPIError::ParseError { + message: e.to_string(), + value: format!( + "deserialize_json_bytes:\n---\n{:?}\n---\n to type {}", + arg, + std::any::type_name::() + ), + }) +} // #[instrument(level = "trace", ret, err)] pub fn deserialize_opt_json( @@ -28,6 +40,20 @@ pub fn deserialize_opt_json( deserialize_json(arg) } +// #[instrument(level = "trace", ret, err)] +pub fn deserialize_opt_json_bytes( + arg: Option>, +) -> VeilidAPIResult { + let arg = arg.as_ref().ok_or_else(|| VeilidAPIError::ParseError { + message: "invalid null string".to_owned(), + value: format!( + "deserialize_json_opt: null to type {}", + std::any::type_name::() + ), + })?; + deserialize_json_bytes(arg.as_slice()) +} + // #[instrument(level = "trace", ret)] pub fn serialize_json(val: T) -> String { match serde_json::to_string(&val) { @@ -37,97 +63,138 @@ pub fn serialize_json(val: T) -> String { } } } +pub fn serialize_json_bytes(val: T) -> Vec { + match serde_json::to_vec(&val) { + Ok(v) => v, + Err(e) => { + panic!( + "failed to serialize json value to bytes: {}\nval={:?}", + e, val + ); + } + } +} -pub mod json_as_base64 { +pub mod as_human_base64 { use data_encoding::BASE64URL_NOPAD; use serde::{Deserialize, Deserializer, Serialize, Serializer}; pub fn serialize(v: &Vec, s: S) -> Result { - let base64 = BASE64URL_NOPAD.encode(v); - String::serialize(&base64, s) + if s.is_human_readable() { + let base64 = BASE64URL_NOPAD.encode(v); + String::serialize(&base64, s) + } else { + Vec::::serialize(v, s) + } } pub fn deserialize<'de, D: Deserializer<'de>>(d: D) -> Result, D::Error> { - let base64 = String::deserialize(d)?; - BASE64URL_NOPAD - .decode(base64.as_bytes()) - .map_err(|e| serde::de::Error::custom(e)) + if d.is_human_readable() { + let base64 = String::deserialize(d)?; + BASE64URL_NOPAD + .decode(base64.as_bytes()) + .map_err(|e| serde::de::Error::custom(e)) + } else { + Vec::::deserialize(d) + } } } -pub mod opt_json_as_base64 { +pub mod as_human_opt_base64 { use data_encoding::BASE64URL_NOPAD; use serde::{Deserialize, Deserializer, Serialize, Serializer}; pub fn serialize(v: &Option>, s: S) -> Result { - let base64 = v.as_ref().map(|x| BASE64URL_NOPAD.encode(&x)); - Option::::serialize(&base64, s) + if s.is_human_readable() { + let base64 = v.as_ref().map(|x| BASE64URL_NOPAD.encode(&x)); + Option::::serialize(&base64, s) + } else { + Option::>::serialize(v, s) + } } pub fn deserialize<'de, D: Deserializer<'de>>(d: D) -> Result>, D::Error> { - let base64 = Option::::deserialize(d)?; - base64 - .map(|x| { - BASE64URL_NOPAD - .decode(x.as_bytes()) - .map_err(|e| serde::de::Error::custom(e)) - }) - .transpose() - } -} - -pub mod json_as_string { - use std::fmt::Display; - use std::str::FromStr; - - use serde::{de, Deserialize, Deserializer, Serializer}; - - pub fn serialize(value: &T, serializer: S) -> Result - where - T: Display, - S: Serializer, - { - serializer.collect_str(value) - } - - pub fn deserialize<'de, T, D>(deserializer: D) -> Result - where - T: FromStr, - T::Err: Display, - D: Deserializer<'de>, - { - String::deserialize(deserializer)? - .parse() - .map_err(de::Error::custom) - } -} - -pub mod opt_json_as_string { - use std::fmt::Display; - use std::str::FromStr; - - use serde::{de, Deserialize, Deserializer, Serializer}; - - pub fn serialize(value: &Option, serializer: S) -> Result - where - T: Display, - S: Serializer, - { - match value { - Some(v) => serializer.collect_str(v), - None => serializer.serialize_none(), - } - } - - pub fn deserialize<'de, T, D>(deserializer: D) -> Result, D::Error> - where - T: FromStr, - T::Err: Display, - D: Deserializer<'de>, - { - match Option::::deserialize(deserializer)? { - None => Ok(None), - Some(v) => Ok(Some(v.parse::().map_err(de::Error::custom)?)), + if d.is_human_readable() { + let base64 = Option::::deserialize(d)?; + base64 + .map(|x| { + BASE64URL_NOPAD + .decode(x.as_bytes()) + .map_err(|e| serde::de::Error::custom(e)) + }) + .transpose() + } else { + Option::>::deserialize(d) + } + } +} + +pub mod as_human_string { + use std::fmt::Display; + use std::str::FromStr; + + use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; + + pub fn serialize(value: &T, s: S) -> Result + where + T: Display + Serialize, + S: Serializer, + { + if s.is_human_readable() { + s.collect_str(value) + } else { + T::serialize(value, s) + } + } + + pub fn deserialize<'de, T, D>(d: D) -> Result + where + T: FromStr + Deserialize<'de>, + T::Err: Display, + D: Deserializer<'de>, + { + if d.is_human_readable() { + String::deserialize(d)?.parse().map_err(de::Error::custom) + } else { + T::deserialize(d) + } + } +} + +pub mod as_human_opt_string { + use std::fmt::Display; + use std::str::FromStr; + + use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; + + pub fn serialize(value: &Option, s: S) -> Result + where + T: Display + Serialize, + S: Serializer, + { + if s.is_human_readable() { + match value { + Some(v) => s.collect_str(v), + None => s.serialize_none(), + } + } else { + Option::::serialize(value, s) + } + } + + pub fn deserialize<'de, T, D>(d: D) -> Result, D::Error> + where + T: FromStr + Deserialize<'de>, + T::Err: Display, + D: Deserializer<'de>, + { + if d.is_human_readable() { + match Option::::deserialize(d)? { + None => Ok(None), + Some(v) => Ok(Some(v.parse::().map_err(de::Error::custom)?)), + } + } else { + Option::::deserialize(d) } } } diff --git a/veilid-core/src/veilid_api/serialize_helpers/veilid_rkyv.rs b/veilid-core/src/veilid_api/serialize_helpers/veilid_rkyv.rs deleted file mode 100644 index cff3c7f8..00000000 --- a/veilid-core/src/veilid_api/serialize_helpers/veilid_rkyv.rs +++ /dev/null @@ -1,151 +0,0 @@ -use super::*; -use rkyv::ser::Serializer; - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -pub struct VeilidRkyvSerializer { - inner: S, -} - -impl VeilidRkyvSerializer { - pub fn into_inner(self) -> S { - self.inner - } -} - -impl rkyv::Fallible for VeilidRkyvSerializer { - type Error = VeilidRkyvError; -} - -impl rkyv::ser::ScratchSpace for VeilidRkyvSerializer { - unsafe fn push_scratch( - &mut self, - layout: core::alloc::Layout, - ) -> Result, Self::Error> { - self.inner - .push_scratch(layout) - .map_err(VeilidRkyvError::Inner) - } - unsafe fn pop_scratch( - &mut self, - ptr: core::ptr::NonNull, - layout: core::alloc::Layout, - ) -> Result<(), Self::Error> { - self.inner - .pop_scratch(ptr, layout) - .map_err(VeilidRkyvError::Inner) - } -} - -impl rkyv::ser::Serializer for VeilidRkyvSerializer { - #[inline] - fn pos(&self) -> usize { - self.inner.pos() - } - - #[inline] - fn write(&mut self, bytes: &[u8]) -> Result<(), Self::Error> { - self.inner.write(bytes).map_err(VeilidRkyvError::Inner) - } -} - -impl Default for VeilidRkyvSerializer { - fn default() -> Self { - Self { - inner: S::default(), - } - } -} - -pub type DefaultVeilidRkyvSerializer = - VeilidRkyvSerializer>; - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -#[derive(Debug, Default)] -pub struct VeilidSharedDeserializeMap { - inner: SharedDeserializeMap, -} - -impl VeilidSharedDeserializeMap { - #[inline] - pub fn new() -> Self { - Self { - inner: SharedDeserializeMap::new(), - } - } -} -impl rkyv::Fallible for VeilidSharedDeserializeMap { - type Error = VeilidRkyvError; -} - -impl rkyv::de::SharedDeserializeRegistry for VeilidSharedDeserializeMap { - fn get_shared_ptr(&mut self, ptr: *const u8) -> Option<&dyn rkyv::de::SharedPointer> { - self.inner.get_shared_ptr(ptr) - } - - fn add_shared_ptr( - &mut self, - ptr: *const u8, - shared: Box, - ) -> Result<(), Self::Error> { - self.inner - .add_shared_ptr(ptr, shared) - .map_err(VeilidRkyvError::Inner) - } -} - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -#[derive(Debug)] -pub enum VeilidRkyvError { - Inner(E), - StringError(String), -} - -impl From for VeilidRkyvError { - fn from(s: String) -> Self { - Self::StringError(s) - } -} - -impl fmt::Display for VeilidRkyvError { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - VeilidRkyvError::Inner(e) => write!(f, "Inner: {}", e), - VeilidRkyvError::StringError(s) => write!(f, "StringError: {}", s), - } - } -} - -impl std::error::Error for VeilidRkyvError {} - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -pub fn to_rkyv(value: &T) -> VeilidAPIResult> -where - T: RkyvSerialize, -{ - let mut serializer = DefaultVeilidRkyvSerializer::default(); - serializer - .serialize_value(value) - .map_err(|e| VeilidAPIError::generic(format!("failed to serialize object: {}", e)))?; - Ok(serializer - .into_inner() - .into_serializer() - .into_inner() - .to_vec()) -} - -pub fn from_rkyv(bytes: Vec) -> VeilidAPIResult -where - T: RkyvArchive, - ::Archived: - for<'t> CheckBytes>, - ::Archived: RkyvDeserialize, -{ - rkyv::check_archived_root::(&bytes) - .map_err(|e| VeilidAPIError::generic(format!("checkbytes failed: {}", e)))? - .deserialize(&mut VeilidSharedDeserializeMap::default()) - .map_err(|e| VeilidAPIError::generic(format!("failed to deserialize: {}", e))) -} diff --git a/veilid-core/src/veilid_api/tests/mod.rs b/veilid-core/src/veilid_api/tests/mod.rs index a5fe97b7..9a4b8807 100644 --- a/veilid-core/src/veilid_api/tests/mod.rs +++ b/veilid-core/src/veilid_api/tests/mod.rs @@ -1,6 +1,5 @@ mod fixtures; pub mod test_serialize_json; -pub mod test_serialize_rkyv; mod test_types; mod test_types_dht; mod test_types_dht_schema; diff --git a/veilid-core/src/veilid_api/tests/test_serialize_rkyv.rs b/veilid-core/src/veilid_api/tests/test_serialize_rkyv.rs deleted file mode 100644 index 0566f7b7..00000000 --- a/veilid-core/src/veilid_api/tests/test_serialize_rkyv.rs +++ /dev/null @@ -1,16 +0,0 @@ -use crate::*; - -pub async fn test_simple_string() { - let plain = "basic string".to_string(); - let serialized = b"basic string\x0c\x00\x00\x00\xf4\xff\xff\xff".to_vec(); - - let a = to_rkyv(&plain); - assert_eq!(a.unwrap(), serialized); - - let b = from_rkyv::(serialized); - assert_eq!(b.unwrap(), plain); -} - -pub async fn test_all() { - test_simple_string().await; -} diff --git a/veilid-core/src/veilid_api/types/aligned_u64.rs b/veilid-core/src/veilid_api/types/aligned_u64.rs index 566bac84..fbad5696 100644 --- a/veilid-core/src/veilid_api/types/aligned_u64.rs +++ b/veilid-core/src/veilid_api/types/aligned_u64.rs @@ -2,29 +2,16 @@ use super::*; /// Aligned u64 /// Required on 32-bit platforms for serialization because Rust aligns u64 on 4 byte boundaries -/// And zero-copy serialization with Rkyv requires 8-byte alignment +/// Some zero-copy serialization frameworks also want 8-byte alignment +/// Supports serializing to string for JSON as well, since JSON can't handle 64-bit numbers to Javascript #[derive( - Clone, - Default, - PartialEq, - Eq, - PartialOrd, - Ord, - Copy, - Hash, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, + Clone, Default, PartialEq, Eq, PartialOrd, Ord, Copy, Hash, Serialize, Deserialize, JsonSchema, )] #[repr(C, align(8))] -#[archive_attr(repr(C, align(8)), derive(CheckBytes))] #[serde(transparent)] pub struct AlignedU64( - #[serde(with = "json_as_string")] + #[serde(with = "as_human_string")] #[schemars(with = "String")] u64, ); diff --git a/veilid-core/src/veilid_api/types/app_message_call.rs b/veilid-core/src/veilid_api/types/app_message_call.rs index 36fa47e1..f47be2af 100644 --- a/veilid-core/src/veilid_api/types/app_message_call.rs +++ b/veilid-core/src/veilid_api/types/app_message_call.rs @@ -1,27 +1,15 @@ use super::*; /// Direct statement blob passed to hosting application for processing -#[derive( - Debug, - Clone, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct VeilidAppMessage { /// Some(sender) if the message was sent directly, None if received via a private/safety route - #[serde(with = "opt_json_as_string")] + #[serde(with = "as_human_opt_string")] #[schemars(with = "Option")] pub sender: Option, /// The content of the message to deliver to the application - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] pub message: Vec, } @@ -40,32 +28,20 @@ impl VeilidAppMessage { } /// Direct question blob passed to hosting application for processing to send an eventual AppReply -#[derive( - Debug, - Clone, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct VeilidAppCall { /// Some(sender) if the request was sent directly, None if received via a private/safety route - #[serde(with = "opt_json_as_string")] + #[serde(with = "as_human_opt_string")] #[schemars(with = "Option")] sender: Option, /// The content of the request to deliver to the application - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] message: Vec, /// The id to reply to - #[serde(with = "json_as_string")] + #[serde(with = "as_human_string")] #[schemars(with = "String")] call_id: OperationId, } diff --git a/veilid-core/src/veilid_api/types/dht/dht_record_descriptor.rs b/veilid-core/src/veilid_api/types/dht/dht_record_descriptor.rs index 6bbbe597..251d1e28 100644 --- a/veilid-core/src/veilid_api/types/dht/dht_record_descriptor.rs +++ b/veilid-core/src/veilid_api/types/dht/dht_record_descriptor.rs @@ -1,21 +1,7 @@ use super::*; /// DHT Record Descriptor -#[derive( - Debug, - Clone, - PartialOrd, - Ord, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Debug, Clone, PartialOrd, Ord, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct DHTRecordDescriptor { /// DHT Key = Hash(ownerKeyKind) of: [ ownerKeyValue, schema ] #[schemars(with = "String")] diff --git a/veilid-core/src/veilid_api/types/dht/schema/dflt.rs b/veilid-core/src/veilid_api/types/dht/schema/dflt.rs index a742bdec..b2c6b2b7 100644 --- a/veilid-core/src/veilid_api/types/dht/schema/dflt.rs +++ b/veilid-core/src/veilid_api/types/dht/schema/dflt.rs @@ -1,21 +1,7 @@ use super::*; /// Default DHT Schema (DFLT) -#[derive( - Debug, - Clone, - PartialEq, - Eq, - Ord, - PartialOrd, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Debug, Clone, PartialEq, Eq, Ord, PartialOrd, Serialize, Deserialize, JsonSchema)] pub struct DHTSchemaDFLT { /// Owner subkey count pub o_cnt: u16, diff --git a/veilid-core/src/veilid_api/types/dht/schema/mod.rs b/veilid-core/src/veilid_api/types/dht/schema/mod.rs index 2361e32c..ec54ae30 100644 --- a/veilid-core/src/veilid_api/types/dht/schema/mod.rs +++ b/veilid-core/src/veilid_api/types/dht/schema/mod.rs @@ -7,21 +7,7 @@ pub use dflt::*; pub use smpl::*; /// Enum over all the supported DHT Schemas -#[derive( - Debug, - Clone, - PartialEq, - Eq, - Ord, - PartialOrd, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] -#[archive_attr(repr(u8), derive(CheckBytes))] +#[derive(Debug, Clone, PartialEq, Eq, Ord, PartialOrd, Serialize, Deserialize, JsonSchema)] #[serde(tag = "kind")] pub enum DHTSchema { DFLT(DHTSchemaDFLT), diff --git a/veilid-core/src/veilid_api/types/dht/schema/smpl.rs b/veilid-core/src/veilid_api/types/dht/schema/smpl.rs index 9b2c7df1..942652fe 100644 --- a/veilid-core/src/veilid_api/types/dht/schema/smpl.rs +++ b/veilid-core/src/veilid_api/types/dht/schema/smpl.rs @@ -1,21 +1,7 @@ use super::*; /// Simple DHT Schema (SMPL) Member -#[derive( - Debug, - Clone, - PartialEq, - Eq, - PartialOrd, - Ord, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize, JsonSchema)] pub struct DHTSchemaSMPLMember { /// Member key #[schemars(with = "String")] @@ -25,21 +11,7 @@ pub struct DHTSchemaSMPLMember { } /// Simple DHT Schema (SMPL) -#[derive( - Debug, - Clone, - PartialEq, - Eq, - Ord, - PartialOrd, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Debug, Clone, PartialEq, Eq, Ord, PartialOrd, Serialize, Deserialize, JsonSchema)] pub struct DHTSchemaSMPL { /// Owner subkey count pub o_cnt: u16, diff --git a/veilid-core/src/veilid_api/types/dht/value_data.rs b/veilid-core/src/veilid_api/types/dht/value_data.rs index b71ba9fc..f15c4a4c 100644 --- a/veilid-core/src/veilid_api/types/dht/value_data.rs +++ b/veilid-core/src/veilid_api/types/dht/value_data.rs @@ -1,26 +1,12 @@ use super::*; -#[derive( - Clone, - Default, - PartialOrd, - PartialEq, - Eq, - Ord, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Clone, Default, PartialOrd, PartialEq, Eq, Ord, Serialize, Deserialize, JsonSchema)] pub struct ValueData { /// An increasing sequence number to time-order the DHT record changes seq: ValueSeqNum, /// The contents of a DHT Record - #[serde(with = "json_as_base64")] + #[serde(with = "as_human_base64")] #[schemars(with = "String")] data: Vec, diff --git a/veilid-core/src/veilid_api/types/dht/value_subkey_range_set.rs b/veilid-core/src/veilid_api/types/dht/value_subkey_range_set.rs index 241223c1..9e7eb970 100644 --- a/veilid-core/src/veilid_api/types/dht/value_subkey_range_set.rs +++ b/veilid-core/src/veilid_api/types/dht/value_subkey_range_set.rs @@ -2,24 +2,9 @@ use super::*; use core::ops::{Deref, DerefMut}; use range_set_blaze::*; -#[derive( - Clone, - Default, - PartialOrd, - PartialEq, - Eq, - Ord, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Clone, Default, PartialOrd, PartialEq, Eq, Ord, Serialize, Deserialize, JsonSchema)] #[serde(transparent)] pub struct ValueSubkeyRangeSet { - #[with(RkyvRangeSetBlaze)] #[serde(with = "serialize_range_set_blaze")] #[schemars(with = "Vec<(u32,u32)>")] data: RangeSetBlaze, diff --git a/veilid-core/src/veilid_api/types/fourcc.rs b/veilid-core/src/veilid_api/types/fourcc.rs index 1d56da33..5995c1b5 100644 --- a/veilid-core/src/veilid_api/types/fourcc.rs +++ b/veilid-core/src/veilid_api/types/fourcc.rs @@ -2,22 +2,8 @@ use super::*; /// FOURCC code #[derive( - Copy, - Default, - Clone, - Hash, - PartialOrd, - Ord, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, + Copy, Default, Clone, Hash, PartialOrd, Ord, PartialEq, Eq, Serialize, Deserialize, JsonSchema, )] -#[archive_attr(repr(C), derive(CheckBytes, PartialOrd, Ord, PartialEq, Eq, Hash))] #[serde(try_from = "String")] #[serde(into = "String")] pub struct FourCC(pub [u8; 4]); diff --git a/veilid-core/src/veilid_api/types/safety.rs b/veilid-core/src/veilid_api/types/safety.rs index 970619c2..8e49cf5f 100644 --- a/veilid-core/src/veilid_api/types/safety.rs +++ b/veilid-core/src/veilid_api/types/safety.rs @@ -2,26 +2,12 @@ use super::*; // Ordering here matters, >= is used to check strength of sequencing requirement #[derive( - Copy, - Clone, - Debug, - PartialEq, - Eq, - PartialOrd, - Ord, - Hash, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, + Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, JsonSchema, )] -#[archive_attr(repr(u8), derive(CheckBytes))] pub enum Sequencing { - NoPreference, - PreferOrdered, - EnsureOrdered, + NoPreference = 0, + PreferOrdered = 1, + EnsureOrdered = 2, } impl Default for Sequencing { @@ -32,25 +18,11 @@ impl Default for Sequencing { // Ordering here matters, >= is used to check strength of stability requirement #[derive( - Copy, - Clone, - Debug, - PartialEq, - Eq, - PartialOrd, - Ord, - Hash, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, + Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, JsonSchema, )] -#[archive_attr(repr(u8), derive(CheckBytes))] pub enum Stability { - LowLatency, - Reliable, + LowLatency = 0, + Reliable = 1, } impl Default for Stability { @@ -61,22 +33,8 @@ impl Default for Stability { /// The choice of safety route to include in compiled routes #[derive( - Copy, - Clone, - Debug, - PartialEq, - Eq, - PartialOrd, - Ord, - Hash, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, + Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, JsonSchema, )] -#[archive_attr(repr(u8), derive(CheckBytes))] pub enum SafetySelection { /// Don't use a safety route, only specify the sequencing preference Unsafe(Sequencing), @@ -101,22 +59,8 @@ impl Default for SafetySelection { /// Options for safety routes (sender privacy) #[derive( - Copy, - Clone, - Debug, - PartialEq, - Eq, - PartialOrd, - Ord, - Hash, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, + Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, JsonSchema, )] -#[archive_attr(repr(C), derive(CheckBytes))] pub struct SafetySpec { /// preferred safety route set id if it still exists #[schemars(with = "Option")] diff --git a/veilid-core/src/veilid_api/types/stats.rs b/veilid-core/src/veilid_api/types/stats.rs index a7bbce14..836cb728 100644 --- a/veilid-core/src/veilid_api/types/stats.rs +++ b/veilid-core/src/veilid_api/types/stats.rs @@ -1,39 +1,13 @@ use super::*; -#[derive( - Clone, - Debug, - Default, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct LatencyStats { pub fastest: TimestampDuration, // fastest latency in the ROLLING_LATENCIES_SIZE last latencies pub average: TimestampDuration, // average latency over the ROLLING_LATENCIES_SIZE last latencies pub slowest: TimestampDuration, // slowest latency in the ROLLING_LATENCIES_SIZE last latencies } -#[derive( - Clone, - Debug, - Default, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct TransferStats { pub total: ByteCount, // total amount transferred ever pub maximum: ByteCount, // maximum rate over the ROLLING_TRANSFERS_SIZE last amounts @@ -41,39 +15,13 @@ pub struct TransferStats { pub minimum: ByteCount, // minimum rate over the ROLLING_TRANSFERS_SIZE last amounts } -#[derive( - Clone, - Debug, - Default, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct TransferStatsDownUp { pub down: TransferStats, pub up: TransferStats, } -#[derive( - Clone, - Debug, - Default, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct RPCStats { pub messages_sent: u32, // number of rpcs that have been sent in the total_time range pub messages_rcvd: u32, // number of rpcs that have been received in the total_time range @@ -85,20 +33,7 @@ pub struct RPCStats { pub failed_to_send: u32, // number of messages that have failed to send since we last successfully sent one } -#[derive( - Clone, - Debug, - Default, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct PeerStats { pub time_added: Timestamp, // when the peer was added to the routing table pub rpc_stats: RPCStats, // information about RPCs diff --git a/veilid-core/src/veilid_api/types/tunnel.rs b/veilid-core/src/veilid_api/types/tunnel.rs index 370b45ee..6b5220cf 100644 --- a/veilid-core/src/veilid_api/types/tunnel.rs +++ b/veilid-core/src/veilid_api/types/tunnel.rs @@ -7,64 +7,26 @@ pub type TunnelId = AlignedU64; #[cfg(feature = "unstable-tunnels")] #[derive( - Copy, - Clone, - Debug, - PartialOrd, - PartialEq, - Eq, - Ord, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, + Copy, Clone, Debug, PartialOrd, PartialEq, Eq, Ord, Serialize, Deserialize, JsonSchema, )] -#[archive_attr(repr(u8), derive(CheckBytes))] pub enum TunnelMode { - Raw, - Turn, + Raw = 0, + Turn = 1, } #[cfg(feature = "unstable-tunnels")] #[derive( - Copy, - Clone, - Debug, - PartialOrd, - PartialEq, - Eq, - Ord, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, + Copy, Clone, Debug, PartialOrd, PartialEq, Eq, Ord, Serialize, Deserialize, JsonSchema, )] -#[archive_attr(repr(u8), derive(CheckBytes))] pub enum TunnelError { - BadId, // Tunnel ID was rejected - NoEndpoint, // Endpoint was unreachable - RejectedMode, // Endpoint couldn't provide mode - NoCapacity, // Endpoint is full + BadId = 0, // Tunnel ID was rejected + NoEndpoint = 1, // Endpoint was unreachable + RejectedMode = 2, // Endpoint couldn't provide mode + NoCapacity = 3, // Endpoint is full } #[cfg(feature = "unstable-tunnels")] -#[derive( - Clone, - Debug, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct TunnelEndpoint { pub mode: TunnelMode, pub description: String, // XXX: TODO @@ -81,20 +43,7 @@ impl Default for TunnelEndpoint { } #[cfg(feature = "unstable-tunnels")] -#[derive( - Clone, - Debug, - Default, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct FullTunnel { pub id: TunnelId, pub timeout: TimestampDuration, @@ -103,20 +52,7 @@ pub struct FullTunnel { } #[cfg(feature = "unstable-tunnels")] -#[derive( - Clone, - Debug, - Default, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct PartialTunnel { pub id: TunnelId, pub timeout: TimestampDuration, diff --git a/veilid-core/src/veilid_api/types/veilid_log.rs b/veilid-core/src/veilid_api/types/veilid_log.rs index f377115c..bf9c5963 100644 --- a/veilid-core/src/veilid_api/types/veilid_log.rs +++ b/veilid-core/src/veilid_api/types/veilid_log.rs @@ -2,27 +2,14 @@ use super::*; /// Log level for VeilidCore #[derive( - Debug, - Clone, - PartialEq, - Eq, - PartialOrd, - Ord, - Copy, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, + Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Copy, Serialize, Deserialize, JsonSchema, )] -#[archive_attr(repr(u8), derive(CheckBytes))] pub enum VeilidLogLevel { Error = 1, - Warn, - Info, - Debug, - Trace, + Warn = 2, + Info = 3, + Debug = 4, + Trace = 5, } impl VeilidLogLevel { @@ -92,19 +79,7 @@ impl fmt::Display for VeilidLogLevel { } } /// A VeilidCore log message with optional backtrace -#[derive( - Debug, - Clone, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct VeilidLog { pub log_level: VeilidLogLevel, pub message: String, diff --git a/veilid-core/src/veilid_api/types/veilid_state.rs b/veilid-core/src/veilid_api/types/veilid_state.rs index c86dac03..88ee35b9 100644 --- a/veilid-core/src/veilid_api/types/veilid_state.rs +++ b/veilid-core/src/veilid_api/types/veilid_state.rs @@ -1,29 +1,16 @@ use super::*; /// Attachment abstraction for network 'signal strength' -#[derive( - Debug, - PartialEq, - Eq, - Clone, - Copy, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] -#[archive_attr(repr(u8), derive(CheckBytes))] +#[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Deserialize, JsonSchema)] pub enum AttachmentState { - Detached, - Attaching, - AttachedWeak, - AttachedGood, - AttachedStrong, - FullyAttached, - OverAttached, - Detaching, + Detached = 0, + Attaching = 1, + AttachedWeak = 2, + AttachedGood = 3, + AttachedStrong = 4, + FullyAttached = 5, + OverAttached = 6, + Detaching = 7, } impl fmt::Display for AttachmentState { @@ -60,38 +47,14 @@ impl TryFrom for AttachmentState { } } -#[derive( - Debug, - Clone, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct VeilidStateAttachment { pub state: AttachmentState, pub public_internet_ready: bool, pub local_network_ready: bool, } -#[derive( - Debug, - Clone, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct PeerTableData { #[schemars(with = "Vec")] pub node_ids: Vec, @@ -99,19 +62,7 @@ pub struct PeerTableData { pub peer_stats: PeerStats, } -#[derive( - Debug, - Clone, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct VeilidStateNetwork { pub started: bool, pub bps_down: ByteCount, @@ -119,19 +70,7 @@ pub struct VeilidStateNetwork { pub peers: Vec, } -#[derive( - Debug, - Clone, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct VeilidRouteChange { #[schemars(with = "Vec")] pub dead_routes: Vec, @@ -139,36 +78,12 @@ pub struct VeilidRouteChange { pub dead_remote_routes: Vec, } -#[derive( - Debug, - Clone, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct VeilidStateConfig { pub config: VeilidConfigInner, } -#[derive( - Debug, - Clone, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct VeilidValueChange { #[schemars(with = "String")] pub key: TypedKey, @@ -177,19 +92,7 @@ pub struct VeilidValueChange { pub value: ValueData, } -#[derive( - Debug, - Clone, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] -#[archive_attr(repr(u8), derive(CheckBytes))] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] #[serde(tag = "kind")] pub enum VeilidUpdate { Log(VeilidLog), @@ -203,19 +106,7 @@ pub enum VeilidUpdate { Shutdown, } -#[derive( - Debug, - Clone, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] -#[archive_attr(repr(C), derive(CheckBytes))] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct VeilidState { pub attachment: VeilidStateAttachment, pub network: VeilidStateNetwork, diff --git a/veilid-core/src/veilid_config.rs b/veilid-core/src/veilid_config.rs index 3d51a0bd..91027978 100644 --- a/veilid-core/src/veilid_config.rs +++ b/veilid-core/src/veilid_config.rs @@ -14,19 +14,7 @@ pub type ConfigCallback = Arc ConfigCallbackReturn + Send + Sy /// url: 'https://localhost:5150' /// ``` /// -#[derive( - Default, - Debug, - Clone, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] +#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct VeilidConfigHTTPS { pub enabled: bool, pub listen_address: String, @@ -44,19 +32,7 @@ pub struct VeilidConfigHTTPS { /// url: 'https://localhost:5150' /// ``` /// -#[derive( - Default, - Debug, - Clone, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] +#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct VeilidConfigHTTP { pub enabled: bool, pub listen_address: String, @@ -70,19 +46,7 @@ pub struct VeilidConfigHTTP { /// /// To be implemented... /// -#[derive( - Default, - Debug, - Clone, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] +#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct VeilidConfigApplication { pub https: VeilidConfigHTTPS, pub http: VeilidConfigHTTP, @@ -98,19 +62,7 @@ pub struct VeilidConfigApplication { /// public_address: '' /// ``` /// -#[derive( - Default, - Debug, - Clone, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] +#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct VeilidConfigUDP { pub enabled: bool, pub socket_pool_size: u32, @@ -128,19 +80,7 @@ pub struct VeilidConfigUDP { /// listen_address: ':5150' /// public_address: '' /// -#[derive( - Default, - Debug, - Clone, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] +#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct VeilidConfigTCP { pub connect: bool, pub listen: bool, @@ -160,19 +100,8 @@ pub struct VeilidConfigTCP { /// path: 'ws' /// url: 'ws://localhost:5150/ws' /// -#[derive( - Default, - Debug, - Clone, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] +#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] + pub struct VeilidConfigWS { pub connect: bool, pub listen: bool, @@ -193,19 +122,8 @@ pub struct VeilidConfigWS { /// path: 'ws' /// url: '' /// -#[derive( - Default, - Debug, - Clone, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] +#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] + pub struct VeilidConfigWSS { pub connect: bool, pub listen: bool, @@ -222,19 +140,8 @@ pub struct VeilidConfigWSS { /// All protocols are available by default, and the Veilid node will /// sort out which protocol is used for each peer connection. /// -#[derive( - Default, - Debug, - Clone, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] +#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] + pub struct VeilidConfigProtocol { pub udp: VeilidConfigUDP, pub tcp: VeilidConfigTCP, @@ -250,19 +157,7 @@ pub struct VeilidConfigProtocol { /// private_key_path: /path/to/private/key /// connection_initial_timeout_ms: 2000 /// -#[derive( - Default, - Debug, - Clone, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] +#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct VeilidConfigTLS { pub certificate_path: String, pub private_key_path: String, @@ -271,19 +166,7 @@ pub struct VeilidConfigTLS { /// Configure the Distributed Hash Table (DHT) /// -#[derive( - Default, - Debug, - Clone, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] +#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct VeilidConfigDHT { pub max_find_node_count: u32, pub resolve_node_timeout_ms: u32, @@ -308,19 +191,7 @@ pub struct VeilidConfigDHT { /// Configure RPC /// -#[derive( - Default, - Debug, - Clone, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] +#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct VeilidConfigRPC { pub concurrency: u32, pub queue_size: u32, @@ -333,19 +204,7 @@ pub struct VeilidConfigRPC { /// Configure the network routing table /// -#[derive( - Default, - Debug, - Clone, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] +#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct VeilidConfigRoutingTable { #[schemars(with = "Vec")] pub node_id: TypedKeyGroup, @@ -361,19 +220,7 @@ pub struct VeilidConfigRoutingTable { // xxx pub enable_local_network: bool, } -#[derive( - Default, - Debug, - Clone, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] +#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct VeilidConfigNetwork { pub connection_initial_timeout_ms: u32, pub connection_inactivity_timeout_ms: u32, @@ -396,55 +243,19 @@ pub struct VeilidConfigNetwork { pub protocol: VeilidConfigProtocol, } -#[derive( - Default, - Debug, - Clone, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] +#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct VeilidConfigTableStore { pub directory: String, pub delete: bool, } -#[derive( - Default, - Debug, - Clone, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] +#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct VeilidConfigBlockStore { pub directory: String, pub delete: bool, } -#[derive( - Default, - Debug, - Clone, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] +#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct VeilidConfigProtectedStore { pub allow_insecure_fallback: bool, pub always_use_insecure_storage: bool, @@ -454,36 +265,12 @@ pub struct VeilidConfigProtectedStore { pub new_device_encryption_key_password: Option, } -#[derive( - Default, - Debug, - Clone, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] +#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct VeilidConfigCapabilities { pub disable: Vec, } -#[derive( - Clone, - Copy, - PartialEq, - Eq, - Debug, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] +#[derive(Clone, Copy, PartialEq, Eq, Debug, Serialize, Deserialize, JsonSchema)] pub enum VeilidConfigLogLevel { Off, Error, @@ -570,19 +357,7 @@ impl fmt::Display for VeilidConfigLogLevel { } } -#[derive( - Default, - Debug, - Clone, - PartialEq, - Eq, - Serialize, - Deserialize, - RkyvArchive, - RkyvSerialize, - RkyvDeserialize, - JsonSchema, -)] +#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct VeilidConfigInner { pub program_name: String, pub namespace: String, diff --git a/veilid-core/tests/web.rs b/veilid-core/tests/web.rs index caba3621..a15aae86 100644 --- a/veilid-core/tests/web.rs +++ b/veilid-core/tests/web.rs @@ -97,12 +97,6 @@ async fn wasm_test_serialize_json() { test_serialize_json::test_all().await; } -#[wasm_bindgen_test] -async fn wasm_test_serialize_rkyv() { - setup(); - test_serialize_rkyv::test_all().await; -} - #[wasm_bindgen_test] async fn wasm_test_serialize_routing_table() { setup(); diff --git a/veilid-flutter/analysis_options.yaml b/veilid-flutter/analysis_options.yaml index a5744c1c..e07e9e94 100644 --- a/veilid-flutter/analysis_options.yaml +++ b/veilid-flutter/analysis_options.yaml @@ -1,4 +1,5 @@ include: package:flutter_lints/flutter.yaml -# Additional information about this file can be found at -# https://dart.dev/guides/language/analysis-options +analyzer: + errors: + invalid_annotation_target: ignore diff --git a/veilid-flutter/build.sh b/veilid-flutter/build.sh new file mode 100755 index 00000000..1f08284e --- /dev/null +++ b/veilid-flutter/build.sh @@ -0,0 +1,3 @@ +#!/bin/bash +set -e +dart run build_runner build diff --git a/veilid-flutter/build.yaml b/veilid-flutter/build.yaml new file mode 100644 index 00000000..84fde8c8 --- /dev/null +++ b/veilid-flutter/build.yaml @@ -0,0 +1,10 @@ +targets: + $default: + sources: + exclude: + - example/** + builders: + json_serializable: + options: + explicit_to_json: true + field_rename: snake diff --git a/veilid-flutter/example/analysis_options.yaml b/veilid-flutter/example/analysis_options.yaml index 61b6c4de..e07e9e94 100644 --- a/veilid-flutter/example/analysis_options.yaml +++ b/veilid-flutter/example/analysis_options.yaml @@ -1,29 +1,5 @@ -# This file configures the analyzer, which statically analyzes Dart code to -# check for errors, warnings, and lints. -# -# The issues identified by the analyzer are surfaced in the UI of Dart-enabled -# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be -# invoked from the command line by running `flutter analyze`. - -# The following line activates a set of recommended lints for Flutter apps, -# packages, and plugins designed to encourage good coding practices. include: package:flutter_lints/flutter.yaml -linter: - # The lint rules applied to this project can be customized in the - # section below to disable rules from the `package:flutter_lints/flutter.yaml` - # included above or to enable additional rules. A list of all available lints - # and their documentation is published at - # https://dart-lang.github.io/linter/lints/index.html. - # - # Instead of disabling a lint rule for the entire project in the - # section below, it can also be suppressed for a single line of code - # or a specific dart file by using the `// ignore: name_of_lint` and - # `// ignore_for_file: name_of_lint` syntax on the line or in the file - # producing the lint. - rules: - # avoid_print: false # Uncomment to disable the `avoid_print` rule - # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule - -# Additional information about this file can be found at -# https://dart.dev/guides/language/analysis-options +analyzer: + errors: + invalid_annotation_target: ignore diff --git a/veilid-flutter/example/ios/Runner.xcodeproj/project.pbxproj b/veilid-flutter/example/ios/Runner.xcodeproj/project.pbxproj index 5a156bd7..31f0cdaf 100644 --- a/veilid-flutter/example/ios/Runner.xcodeproj/project.pbxproj +++ b/veilid-flutter/example/ios/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 51; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -201,10 +201,12 @@ /* Begin PBXShellScriptBuildPhase section */ 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", ); name = "Thin Binary"; outputPaths = ( @@ -215,6 +217,7 @@ }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); diff --git a/veilid-flutter/example/ios/Runner/Info.plist b/veilid-flutter/example/ios/Runner/Info.plist index 85116a21..47b69432 100644 --- a/veilid-flutter/example/ios/Runner/Info.plist +++ b/veilid-flutter/example/ios/Runner/Info.plist @@ -45,5 +45,7 @@ CADisableMinimumFrameDurationOnPhone + UIApplicationSupportsIndirectInputEvents + diff --git a/veilid-flutter/example/lib/app.dart b/veilid-flutter/example/lib/app.dart index 4907f682..550deba7 100644 --- a/veilid-flutter/example/lib/app.dart +++ b/veilid-flutter/example/lib/app.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'dart:convert'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:veilid/veilid.dart'; import 'package:loggy/loggy.dart'; import 'package:veilid_example/veilid_theme.dart'; @@ -112,13 +111,16 @@ class _MyAppState extends State with UiLoggy { if (startup && !_startedUp) { var config = await getDefaultVeilidConfig("Veilid Plugin Example"); if (const String.fromEnvironment("DELETE_TABLE_STORE") == "1") { - config.tableStore.delete = true; + config = config.copyWith( + tableStore: config.tableStore.copyWith(delete: true)); } if (const String.fromEnvironment("DELETE_PROTECTED_STORE") == "1") { - config.protectedStore.delete = true; + config = config.copyWith( + protectedStore: config.protectedStore.copyWith(delete: true)); } if (const String.fromEnvironment("DELETE_BLOCK_STORE") == "1") { - config.blockStore.delete = true; + config = config.copyWith( + blockStore: config.blockStore.copyWith(delete: true)); } var updateStream = await Veilid.instance.startupVeilidCore(config); diff --git a/veilid-flutter/example/lib/veilid_init.dart b/veilid-flutter/example/lib/veilid_init.dart index a7d6b5b7..316b77aa 100644 --- a/veilid-flutter/example/lib/veilid_init.dart +++ b/veilid-flutter/example/lib/veilid_init.dart @@ -5,7 +5,7 @@ import 'package:veilid/veilid.dart'; // Call only once. void veilidInit() { if (kIsWeb) { - var platformConfig = VeilidWASMConfig( + var platformConfig = const VeilidWASMConfig( logging: VeilidWASMConfigLogging( performance: VeilidWASMConfigLoggingPerformance( enabled: true, @@ -16,7 +16,7 @@ void veilidInit() { enabled: true, level: VeilidConfigLogLevel.info))); Veilid.instance.initializeVeilidCore(platformConfig.toJson()); } else { - var platformConfig = VeilidFFIConfig( + var platformConfig = const VeilidFFIConfig( logging: VeilidFFIConfigLogging( terminal: VeilidFFIConfigLoggingTerminal( enabled: false, diff --git a/veilid-flutter/example/pubspec.lock b/veilid-flutter/example/pubspec.lock index 1daa306a..534a380c 100644 --- a/veilid-flutter/example/pubspec.lock +++ b/veilid-flutter/example/pubspec.lock @@ -105,14 +105,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.2" - file: - dependency: transitive - description: - name: file - sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" - url: "https://pub.dev" - source: hosted - version: "6.1.4" file_utils: dependency: transitive description: @@ -130,18 +122,18 @@ packages: dependency: "direct main" description: name: flutter_acrylic - sha256: "5aea2c850c560c07717a62434ea9cb1565c2282dc78dd2e60f98a78c05f13d7b" + sha256: a9a1fdf91ff1fb47858fd82507f57e255a132a5d355056694fdb9fd303633b18 url: "https://pub.dev" source: hosted - version: "1.1.2" + version: "1.1.3" flutter_lints: dependency: "direct dev" description: name: flutter_lints - sha256: aeb0b80a8b3709709c9cc496cdc027c5b3216796bc0af0ce1007eaf24464fd4c + sha256: "2118df84ef0c3ca93f96123a616ae8540879991b8b57af2f81b76a7ada49b2a4" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "2.0.2" flutter_test: dependency: "direct dev" description: flutter @@ -152,6 +144,14 @@ packages: description: flutter source: sdk version: "0.0.0" + freezed_annotation: + dependency: transitive + description: + name: freezed_annotation + sha256: c3fd9336eb55a38cc1bbd79ab17573113a8deccd0ecbbf926cca3c62803b5c2d + url: "https://pub.dev" + source: hosted + version: "2.4.1" globbing: dependency: transitive description: @@ -168,14 +168,22 @@ packages: url: "https://pub.dev" source: hosted version: "0.6.7" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467 + url: "https://pub.dev" + source: hosted + version: "4.8.1" lints: dependency: transitive description: name: lints - sha256: "6b0206b0bf4f04961fc5438198ccb3a885685cd67d4d4a32cc20ad7f8adbe015" + sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" loggy: dependency: "direct main" description: @@ -188,10 +196,10 @@ packages: dependency: transitive description: name: macos_window_utils - sha256: "510de576b5432dd9ef9e4c258abcc021c6dfbb17a78a344688848a6784b352b8" + sha256: b78a210aa70ca7ccad6e7b7b810fb4689c507f4a46e299214900b2a1eb70ea23 url: "https://pub.dev" source: hosted - version: "1.1.2" + version: "1.1.3" matcher: dependency: transitive description: @@ -244,18 +252,18 @@ packages: dependency: transitive description: name: path_provider_foundation - sha256: "1995d88ec2948dac43edf8fe58eb434d35d22a2940ecee1a9fefcd62beee6eb3" + sha256: "916731ccbdce44d545414dd9961f26ba5fbaa74bcbb55237d8e65a623a8c7297" url: "https://pub.dev" source: hosted - version: "2.2.3" + version: "2.2.4" path_provider_linux: dependency: transitive description: name: path_provider_linux - sha256: "2ae08f2216225427e64ad224a24354221c2c7907e448e6e0e8b57b1eb9f10ad1" + sha256: ffbb8cc9ed2c9ec0e4b7a541e56fd79b138e8f47d2fb86815f15358a349b3b57 url: "https://pub.dev" source: hosted - version: "2.1.10" + version: "2.1.11" path_provider_platform_interface: dependency: transitive description: @@ -268,10 +276,10 @@ packages: dependency: transitive description: name: path_provider_windows - sha256: d3f80b32e83ec208ac95253e0cd4d298e104fbc63cb29c5c69edaed43b0c69d6 + sha256: "1cb68ba4cd3a795033de62ba1b7b4564dace301f952de6bfb3cd91b202b6ee96" url: "https://pub.dev" source: hosted - version: "2.1.6" + version: "2.1.7" platform: dependency: transitive description: @@ -296,14 +304,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" - process: - dependency: transitive - description: - name: process - sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" - url: "https://pub.dev" - source: hosted - version: "4.2.4" quiver: dependency: transitive description: @@ -400,18 +400,18 @@ packages: dependency: transitive description: name: win32 - sha256: "5a751eddf9db89b3e5f9d50c20ab8612296e4e8db69009788d6c8b060a84191c" + sha256: dfdf0136e0aa7a1b474ea133e67cb0154a0acd2599c4f3ada3b49d38d38793ee url: "https://pub.dev" source: hosted - version: "4.1.4" + version: "5.0.5" xdg_directories: dependency: transitive description: name: xdg_directories - sha256: ee1505df1426458f7f60aac270645098d318a8b4766d85fde75f76f2e21807d1 + sha256: e0b1147eec179d3911f1f19b59206448f78195ca1d20514134e10641b7d7fbff url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "1.0.1" xterm: dependency: "direct main" description: diff --git a/veilid-flutter/example/run_with_reset.bat b/veilid-flutter/example/reset_run.bat similarity index 100% rename from veilid-flutter/example/run_with_reset.bat rename to veilid-flutter/example/reset_run.bat diff --git a/veilid-flutter/example/run_with_reset.sh b/veilid-flutter/example/reset_run.sh similarity index 100% rename from veilid-flutter/example/run_with_reset.sh rename to veilid-flutter/example/reset_run.sh diff --git a/veilid-flutter/lib/default_config.dart b/veilid-flutter/lib/default_config.dart index b0ae51f2..a7f15074 100644 --- a/veilid-flutter/lib/default_config.dart +++ b/veilid-flutter/lib/default_config.dart @@ -52,8 +52,8 @@ Future getDefaultVeilidConfig(String programName) async { return VeilidConfig( programName: programName, namespace: "", - capabilities: VeilidConfigCapabilities(disable: []), - protectedStore: VeilidConfigProtectedStore( + capabilities: const VeilidConfigCapabilities(disable: []), + protectedStore: const VeilidConfigProtectedStore( allowInsecureFallback: false, alwaysUseInsecureStorage: false, directory: "", @@ -85,7 +85,7 @@ Future getDefaultVeilidConfig(String programName) async { clientWhitelistTimeoutMs: 300000, reverseConnectionReceiptTimeMs: 5000, holePunchReceiptTimeMs: 5000, - routingTable: VeilidConfigRoutingTable( + routingTable: const VeilidConfigRoutingTable( nodeId: [], nodeIdSecret: [], bootstrap: kIsWeb @@ -97,7 +97,7 @@ Future getDefaultVeilidConfig(String programName) async { limitAttachedGood: 8, limitAttachedWeak: 4, ), - rpc: VeilidConfigRPC( + rpc: const VeilidConfigRPC( concurrency: 0, queueSize: 1024, maxTimestampBehindMs: 10000, @@ -129,12 +129,12 @@ Future getDefaultVeilidConfig(String programName) async { upnp: true, detectAddressChanges: true, restrictedNatRetries: 0, - tls: VeilidConfigTLS( + tls: const VeilidConfigTLS( certificatePath: "", privateKeyPath: "", connectionInitialTimeoutMs: 2000, ), - application: VeilidConfigApplication( + application: const VeilidConfigApplication( https: VeilidConfigHTTPS( enabled: false, listenAddress: "", @@ -147,7 +147,7 @@ Future getDefaultVeilidConfig(String programName) async { path: "", url: null, )), - protocol: VeilidConfigProtocol( + protocol: const VeilidConfigProtocol( udp: VeilidConfigUDP( enabled: !kIsWeb, socketPoolSize: 0, diff --git a/veilid-flutter/lib/routing_context.dart b/veilid-flutter/lib/routing_context.dart index 42f5125c..84dd7eaa 100644 --- a/veilid-flutter/lib/routing_context.dart +++ b/veilid-flutter/lib/routing_context.dart @@ -2,198 +2,118 @@ import 'dart:async'; import 'dart:typed_data'; import 'package:change_case/change_case.dart'; +import 'package:equatable/equatable.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; import 'veilid_encoding.dart'; import 'veilid.dart'; +part 'routing_context.freezed.dart'; +part 'routing_context.g.dart'; + ////////////////////////////////////// +extension ValidateDFLT on DHTSchemaDFLT { + bool validate() { + if (oCnt > 65535) { + return false; + } + if (oCnt <= 0) { + return false; + } + return true; + } +} + +extension ValidateSMPL on DHTSchemaSMPL { + bool validate() { + final totalsv = members.fold(0, (acc, v) => (acc + v.mCnt)) + oCnt; + if (totalsv > 65535) { + return false; + } + if (totalsv <= 0) { + return false; + } + return true; + } +} + ////////////////////////////////////// /// DHT Schema -abstract class DHTSchema { - factory DHTSchema.fromJson(dynamic json) { - switch (json["kind"]) { - case "DFLT": - { - return DHTSchemaDFLT(oCnt: json["o_cnt"]); - } - case "SMPL": - { - return DHTSchemaSMPL( - oCnt: json["o_cnt"], - members: List.from( - json['members'].map((j) => DHTSchemaMember.fromJson(j)))); - } - default: - { - throw VeilidAPIExceptionInternal( - "Invalid DHTSchema type: ${json['kind']}"); - } - } - } - Map toJson(); +@Freezed(unionKey: 'kind', unionValueCase: FreezedUnionCase.pascal) +sealed class DHTSchema with _$DHTSchema { + @FreezedUnionValue('DFLT') + const factory DHTSchema.dflt({required int oCnt}) = DHTSchemaDFLT; + + @FreezedUnionValue('SMPL') + const factory DHTSchema.smpl( + {required int oCnt, + required List members}) = DHTSchemaSMPL; + + factory DHTSchema.fromJson(Map json) => + _$DHTSchemaFromJson(json); } -class DHTSchemaDFLT implements DHTSchema { - final int oCnt; - // - DHTSchemaDFLT({ - required this.oCnt, - }) { - if (oCnt < 0 || oCnt > 65535) { - throw VeilidAPIExceptionInvalidArgument( - "value out of range", "oCnt", oCnt.toString()); - } - } +const DHTSchema defaultDHTSchema = DHTSchema.dflt(oCnt: 1); - @override - Map toJson() { - return { - 'kind': "DFLT", - 'o_cnt': oCnt, - }; - } -} +@freezed +class DHTSchemaMember with _$DHTSchemaMember { + @Assert('mCnt > 0 && mCnt <= 65535', 'value out of range') + const factory DHTSchemaMember({ + required PublicKey mKey, + required int mCnt, + }) = _DHTSchemaMember; -class DHTSchemaMember { - PublicKey mKey; - int mCnt; - - DHTSchemaMember({ - required this.mKey, - required this.mCnt, - }) { - if (mCnt < 0 || mCnt > 65535) { - throw VeilidAPIExceptionInvalidArgument( - "value out of range", "mCnt", mCnt.toString()); - } - } - - Map toJson() { - return { - 'm_key': mKey, - 'm_cnt': mCnt, - }; - } - - DHTSchemaMember.fromJson(dynamic json) - : mKey = json['m_key'], - mCnt = json['m_cnt']; -} - -class DHTSchemaSMPL implements DHTSchema { - final int oCnt; - final List members; - // - DHTSchemaSMPL({ - required this.oCnt, - required this.members, - }) { - if (oCnt < 0 || oCnt > 65535) { - throw VeilidAPIExceptionInvalidArgument( - "value out of range", "oCnt", oCnt.toString()); - } - } - @override - Map toJson() { - return { - 'kind': "SMPL", - 'o_cnt': oCnt, - 'members': members.map((p) => p.toJson()).toList(), - }; - } + factory DHTSchemaMember.fromJson(Map json) => + _$DHTSchemaMemberFromJson(json); } ////////////////////////////////////// /// DHTRecordDescriptor -class DHTRecordDescriptor { - TypedKey key; - PublicKey owner; - PublicKey? ownerSecret; - DHTSchema schema; - - DHTRecordDescriptor({ - required this.key, - required this.owner, - this.ownerSecret, - required this.schema, - }); - - Map toJson() { - return { - 'key': key.toString(), - 'owner': owner, - 'owner_secret': ownerSecret, - 'schema': schema.toJson(), - }; - } - - DHTRecordDescriptor.fromJson(dynamic json) - : key = TypedKey.fromString(json['key']), - owner = json['owner'], - ownerSecret = json['owner_secret'], - schema = DHTSchema.fromJson(json['schema']); +@freezed +class DHTRecordDescriptor with _$DHTRecordDescriptor { + const factory DHTRecordDescriptor({ + required TypedKey key, + required PublicKey owner, + PublicKey? ownerSecret, + required DHTSchema schema, + }) = _DHTRecordDescriptor; + factory DHTRecordDescriptor.fromJson(Map json) => + _$DHTRecordDescriptorFromJson(json); } ////////////////////////////////////// /// ValueSubkeyRange -class ValueSubkeyRange { - final int low; - final int high; +@freezed +class ValueSubkeyRange with _$ValueSubkeyRange { + @Assert('low < 0 || low > high', 'low out of range') + @Assert('high < 0', 'high out of range') + const factory ValueSubkeyRange({ + required int low, + required int high, + }) = _ValueSubkeyRange; - ValueSubkeyRange({ - required this.low, - required this.high, - }) { - if (low < 0 || low > high) { - throw VeilidAPIExceptionInvalidArgument( - "invalid range", "low", low.toString()); - } - if (high < 0) { - throw VeilidAPIExceptionInvalidArgument( - "invalid range", "high", high.toString()); - } - } - - ValueSubkeyRange.fromJson(dynamic json) - : low = json[0], - high = json[1] { - if ((json as List).length != 2) { - throw VeilidAPIExceptionInvalidArgument( - "not a pair of integers", "json", json.toString()); - } - } - - List toJson() { - return [low, high]; - } + factory ValueSubkeyRange.fromJson(Map json) => + _$ValueSubkeyRangeFromJson(json); } ////////////////////////////////////// /// ValueData -class ValueData { - final int seq; - final Uint8List data; - final PublicKey writer; +@freezed +class ValueData with _$ValueData { + @Assert('seq >= 0', 'seq out of range') + const factory ValueData({ + required int seq, + @Uint8ListJsonConverter() required Uint8List data, + required PublicKey writer, + }) = _ValueData; - ValueData({ - required this.seq, - required this.data, - required this.writer, - }); - - ValueData.fromJson(dynamic json) - : seq = json['seq'], - data = base64UrlNoPadDecode(json['data']), - writer = json['writer']; - - Map toJson() { - return {'seq': seq, 'data': base64UrlNoPadEncode(data), 'writer': writer}; - } + factory ValueData.fromJson(Map json) => + _$ValueDataFromJson(json); } ////////////////////////////////////// @@ -203,13 +123,9 @@ enum Stability { lowLatency, reliable; - String toJson() { - return name.toPascalCase(); - } - - factory Stability.fromJson(String j) { - return Stability.values.byName(j.toCamelCase()); - } + String toJson() => name.toPascalCase(); + factory Stability.fromJson(String j) => + Stability.values.byName(j.toCamelCase()); } ////////////////////////////////////// @@ -220,37 +136,39 @@ enum Sequencing { preferOrdered, ensureOrdered; - String toJson() { - return name.toPascalCase(); - } - - factory Sequencing.fromJson(String j) { - return Sequencing.values.byName(j.toCamelCase()); - } + String toJson() => name.toPascalCase(); + factory Sequencing.fromJson(String j) => + Sequencing.values.byName(j.toCamelCase()); } ////////////////////////////////////// /// SafetySelection -abstract class SafetySelection { - factory SafetySelection.fromJson(dynamic json) { - var m = json as Map; - if (m.containsKey("Unsafe")) { +@immutable +abstract class SafetySelection extends Equatable { + factory SafetySelection.fromJson(Map json) { + if (json.containsKey("Unsafe")) { return SafetySelectionUnsafe( - sequencing: Sequencing.fromJson(m["Unsafe"])); - } else if (m.containsKey("Safe")) { - return SafetySelectionSafe(safetySpec: SafetySpec.fromJson(m["Safe"])); + sequencing: Sequencing.fromJson(json["Unsafe"])); + } else if (json.containsKey("Safe")) { + return SafetySelectionSafe(safetySpec: SafetySpec.fromJson(json["Safe"])); } else { - throw VeilidAPIExceptionInternal("Invalid SafetySelection"); + throw const VeilidAPIExceptionInternal("Invalid SafetySelection"); } } Map toJson(); } +@immutable class SafetySelectionUnsafe implements SafetySelection { final Sequencing sequencing; + @override + List get props => [sequencing]; + @override + bool? get stringify => null; + // - SafetySelectionUnsafe({ + const SafetySelectionUnsafe({ required this.sequencing, }); @@ -260,10 +178,16 @@ class SafetySelectionUnsafe implements SafetySelection { } } +@immutable class SafetySelectionSafe implements SafetySelection { final SafetySpec safetySpec; + @override + List get props => [safetySpec]; + @override + bool? get stringify => null; + // - SafetySelectionSafe({ + const SafetySelectionSafe({ required this.safetySpec, }); @@ -274,50 +198,28 @@ class SafetySelectionSafe implements SafetySelection { } /// Options for safety routes (sender privacy) -class SafetySpec { - final String? preferredRoute; - final int hopCount; - final Stability stability; - final Sequencing sequencing; - // - SafetySpec({ - this.preferredRoute, - required this.hopCount, - required this.stability, - required this.sequencing, - }); +@freezed +class SafetySpec with _$SafetySpec { + const factory SafetySpec({ + String? preferredRoute, + required int hopCount, + required Stability stability, + required Sequencing sequencing, + }) = _SafetySpec; - SafetySpec.fromJson(dynamic json) - : preferredRoute = json['preferred_route'], - hopCount = json['hop_count'], - stability = Stability.fromJson(json['stability']), - sequencing = Sequencing.fromJson(json['sequencing']); - - Map toJson() { - return { - 'preferred_route': preferredRoute, - 'hop_count': hopCount, - 'stability': stability.toJson(), - 'sequencing': sequencing.toJson() - }; - } + factory SafetySpec.fromJson(Map json) => + _$SafetySpecFromJson(json); } ////////////////////////////////////// /// RouteBlob -class RouteBlob { - final String routeId; - final Uint8List blob; - - RouteBlob(this.routeId, this.blob); - - RouteBlob.fromJson(dynamic json) - : routeId = json['route_id'], - blob = base64UrlNoPadDecode(json['blob']); - - Map toJson() { - return {'route_id': routeId, 'blob': base64UrlNoPadEncode(blob)}; - } +@freezed +class RouteBlob with _$RouteBlob { + const factory RouteBlob( + {required String routeId, + @Uint8ListJsonConverter() required Uint8List blob}) = _RouteBlob; + factory RouteBlob.fromJson(Map json) => + _$RouteBlobFromJson(json); } ////////////////////////////////////// @@ -334,8 +236,8 @@ abstract class VeilidRoutingContext { Future appMessage(String target, Uint8List message); // DHT Operations - Future createDHTRecord( - CryptoKind kind, DHTSchema schema); + Future createDHTRecord(DHTSchema schema, + {CryptoKind kind = 0}); Future openDHTRecord(TypedKey key, KeyPair? writer); Future closeDHTRecord(TypedKey key); Future deleteDHTRecord(TypedKey key); diff --git a/veilid-flutter/lib/routing_context.freezed.dart b/veilid-flutter/lib/routing_context.freezed.dart new file mode 100644 index 00000000..4bfc27c5 --- /dev/null +++ b/veilid-flutter/lib/routing_context.freezed.dart @@ -0,0 +1,1508 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'routing_context.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +DHTSchema _$DHTSchemaFromJson(Map json) { + switch (json['kind']) { + case 'DFLT': + return DHTSchemaDFLT.fromJson(json); + case 'SMPL': + return DHTSchemaSMPL.fromJson(json); + + default: + throw CheckedFromJsonException( + json, 'kind', 'DHTSchema', 'Invalid union type "${json['kind']}"!'); + } +} + +/// @nodoc +mixin _$DHTSchema { + int get oCnt => throw _privateConstructorUsedError; + @optionalTypeArgs + TResult when({ + required TResult Function(int oCnt) dflt, + required TResult Function(int oCnt, List members) smpl, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(int oCnt)? dflt, + TResult? Function(int oCnt, List members)? smpl, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(int oCnt)? dflt, + TResult Function(int oCnt, List members)? smpl, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(DHTSchemaDFLT value) dflt, + required TResult Function(DHTSchemaSMPL value) smpl, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(DHTSchemaDFLT value)? dflt, + TResult? Function(DHTSchemaSMPL value)? smpl, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(DHTSchemaDFLT value)? dflt, + TResult Function(DHTSchemaSMPL value)? smpl, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $DHTSchemaCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $DHTSchemaCopyWith<$Res> { + factory $DHTSchemaCopyWith(DHTSchema value, $Res Function(DHTSchema) then) = + _$DHTSchemaCopyWithImpl<$Res, DHTSchema>; + @useResult + $Res call({int oCnt}); +} + +/// @nodoc +class _$DHTSchemaCopyWithImpl<$Res, $Val extends DHTSchema> + implements $DHTSchemaCopyWith<$Res> { + _$DHTSchemaCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? oCnt = null, + }) { + return _then(_value.copyWith( + oCnt: null == oCnt + ? _value.oCnt + : oCnt // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$DHTSchemaDFLTCopyWith<$Res> + implements $DHTSchemaCopyWith<$Res> { + factory _$$DHTSchemaDFLTCopyWith( + _$DHTSchemaDFLT value, $Res Function(_$DHTSchemaDFLT) then) = + __$$DHTSchemaDFLTCopyWithImpl<$Res>; + @override + @useResult + $Res call({int oCnt}); +} + +/// @nodoc +class __$$DHTSchemaDFLTCopyWithImpl<$Res> + extends _$DHTSchemaCopyWithImpl<$Res, _$DHTSchemaDFLT> + implements _$$DHTSchemaDFLTCopyWith<$Res> { + __$$DHTSchemaDFLTCopyWithImpl( + _$DHTSchemaDFLT _value, $Res Function(_$DHTSchemaDFLT) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? oCnt = null, + }) { + return _then(_$DHTSchemaDFLT( + oCnt: null == oCnt + ? _value.oCnt + : oCnt // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$DHTSchemaDFLT implements DHTSchemaDFLT { + const _$DHTSchemaDFLT({required this.oCnt, final String? $type}) + : $type = $type ?? 'DFLT'; + + factory _$DHTSchemaDFLT.fromJson(Map json) => + _$$DHTSchemaDFLTFromJson(json); + + @override + final int oCnt; + + @JsonKey(name: 'kind') + final String $type; + + @override + String toString() { + return 'DHTSchema.dflt(oCnt: $oCnt)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$DHTSchemaDFLT && + (identical(other.oCnt, oCnt) || other.oCnt == oCnt)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, oCnt); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$DHTSchemaDFLTCopyWith<_$DHTSchemaDFLT> get copyWith => + __$$DHTSchemaDFLTCopyWithImpl<_$DHTSchemaDFLT>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(int oCnt) dflt, + required TResult Function(int oCnt, List members) smpl, + }) { + return dflt(oCnt); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(int oCnt)? dflt, + TResult? Function(int oCnt, List members)? smpl, + }) { + return dflt?.call(oCnt); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(int oCnt)? dflt, + TResult Function(int oCnt, List members)? smpl, + required TResult orElse(), + }) { + if (dflt != null) { + return dflt(oCnt); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(DHTSchemaDFLT value) dflt, + required TResult Function(DHTSchemaSMPL value) smpl, + }) { + return dflt(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(DHTSchemaDFLT value)? dflt, + TResult? Function(DHTSchemaSMPL value)? smpl, + }) { + return dflt?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(DHTSchemaDFLT value)? dflt, + TResult Function(DHTSchemaSMPL value)? smpl, + required TResult orElse(), + }) { + if (dflt != null) { + return dflt(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$DHTSchemaDFLTToJson( + this, + ); + } +} + +abstract class DHTSchemaDFLT implements DHTSchema { + const factory DHTSchemaDFLT({required final int oCnt}) = _$DHTSchemaDFLT; + + factory DHTSchemaDFLT.fromJson(Map json) = + _$DHTSchemaDFLT.fromJson; + + @override + int get oCnt; + @override + @JsonKey(ignore: true) + _$$DHTSchemaDFLTCopyWith<_$DHTSchemaDFLT> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$DHTSchemaSMPLCopyWith<$Res> + implements $DHTSchemaCopyWith<$Res> { + factory _$$DHTSchemaSMPLCopyWith( + _$DHTSchemaSMPL value, $Res Function(_$DHTSchemaSMPL) then) = + __$$DHTSchemaSMPLCopyWithImpl<$Res>; + @override + @useResult + $Res call({int oCnt, List members}); +} + +/// @nodoc +class __$$DHTSchemaSMPLCopyWithImpl<$Res> + extends _$DHTSchemaCopyWithImpl<$Res, _$DHTSchemaSMPL> + implements _$$DHTSchemaSMPLCopyWith<$Res> { + __$$DHTSchemaSMPLCopyWithImpl( + _$DHTSchemaSMPL _value, $Res Function(_$DHTSchemaSMPL) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? oCnt = null, + Object? members = null, + }) { + return _then(_$DHTSchemaSMPL( + oCnt: null == oCnt + ? _value.oCnt + : oCnt // ignore: cast_nullable_to_non_nullable + as int, + members: null == members + ? _value._members + : members // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$DHTSchemaSMPL implements DHTSchemaSMPL { + const _$DHTSchemaSMPL( + {required this.oCnt, + required final List members, + final String? $type}) + : _members = members, + $type = $type ?? 'SMPL'; + + factory _$DHTSchemaSMPL.fromJson(Map json) => + _$$DHTSchemaSMPLFromJson(json); + + @override + final int oCnt; + final List _members; + @override + List get members { + if (_members is EqualUnmodifiableListView) return _members; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_members); + } + + @JsonKey(name: 'kind') + final String $type; + + @override + String toString() { + return 'DHTSchema.smpl(oCnt: $oCnt, members: $members)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$DHTSchemaSMPL && + (identical(other.oCnt, oCnt) || other.oCnt == oCnt) && + const DeepCollectionEquality().equals(other._members, _members)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, oCnt, const DeepCollectionEquality().hash(_members)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$DHTSchemaSMPLCopyWith<_$DHTSchemaSMPL> get copyWith => + __$$DHTSchemaSMPLCopyWithImpl<_$DHTSchemaSMPL>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(int oCnt) dflt, + required TResult Function(int oCnt, List members) smpl, + }) { + return smpl(oCnt, members); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(int oCnt)? dflt, + TResult? Function(int oCnt, List members)? smpl, + }) { + return smpl?.call(oCnt, members); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(int oCnt)? dflt, + TResult Function(int oCnt, List members)? smpl, + required TResult orElse(), + }) { + if (smpl != null) { + return smpl(oCnt, members); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(DHTSchemaDFLT value) dflt, + required TResult Function(DHTSchemaSMPL value) smpl, + }) { + return smpl(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(DHTSchemaDFLT value)? dflt, + TResult? Function(DHTSchemaSMPL value)? smpl, + }) { + return smpl?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(DHTSchemaDFLT value)? dflt, + TResult Function(DHTSchemaSMPL value)? smpl, + required TResult orElse(), + }) { + if (smpl != null) { + return smpl(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$DHTSchemaSMPLToJson( + this, + ); + } +} + +abstract class DHTSchemaSMPL implements DHTSchema { + const factory DHTSchemaSMPL( + {required final int oCnt, + required final List members}) = _$DHTSchemaSMPL; + + factory DHTSchemaSMPL.fromJson(Map json) = + _$DHTSchemaSMPL.fromJson; + + @override + int get oCnt; + List get members; + @override + @JsonKey(ignore: true) + _$$DHTSchemaSMPLCopyWith<_$DHTSchemaSMPL> get copyWith => + throw _privateConstructorUsedError; +} + +DHTSchemaMember _$DHTSchemaMemberFromJson(Map json) { + return _DHTSchemaMember.fromJson(json); +} + +/// @nodoc +mixin _$DHTSchemaMember { + FixedEncodedString43 get mKey => throw _privateConstructorUsedError; + int get mCnt => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $DHTSchemaMemberCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $DHTSchemaMemberCopyWith<$Res> { + factory $DHTSchemaMemberCopyWith( + DHTSchemaMember value, $Res Function(DHTSchemaMember) then) = + _$DHTSchemaMemberCopyWithImpl<$Res, DHTSchemaMember>; + @useResult + $Res call({FixedEncodedString43 mKey, int mCnt}); +} + +/// @nodoc +class _$DHTSchemaMemberCopyWithImpl<$Res, $Val extends DHTSchemaMember> + implements $DHTSchemaMemberCopyWith<$Res> { + _$DHTSchemaMemberCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? mKey = null, + Object? mCnt = null, + }) { + return _then(_value.copyWith( + mKey: null == mKey + ? _value.mKey + : mKey // ignore: cast_nullable_to_non_nullable + as FixedEncodedString43, + mCnt: null == mCnt + ? _value.mCnt + : mCnt // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_DHTSchemaMemberCopyWith<$Res> + implements $DHTSchemaMemberCopyWith<$Res> { + factory _$$_DHTSchemaMemberCopyWith( + _$_DHTSchemaMember value, $Res Function(_$_DHTSchemaMember) then) = + __$$_DHTSchemaMemberCopyWithImpl<$Res>; + @override + @useResult + $Res call({FixedEncodedString43 mKey, int mCnt}); +} + +/// @nodoc +class __$$_DHTSchemaMemberCopyWithImpl<$Res> + extends _$DHTSchemaMemberCopyWithImpl<$Res, _$_DHTSchemaMember> + implements _$$_DHTSchemaMemberCopyWith<$Res> { + __$$_DHTSchemaMemberCopyWithImpl( + _$_DHTSchemaMember _value, $Res Function(_$_DHTSchemaMember) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? mKey = null, + Object? mCnt = null, + }) { + return _then(_$_DHTSchemaMember( + mKey: null == mKey + ? _value.mKey + : mKey // ignore: cast_nullable_to_non_nullable + as FixedEncodedString43, + mCnt: null == mCnt + ? _value.mCnt + : mCnt // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_DHTSchemaMember implements _DHTSchemaMember { + const _$_DHTSchemaMember({required this.mKey, required this.mCnt}) + : assert(mCnt > 0 && mCnt <= 65535, 'value out of range'); + + factory _$_DHTSchemaMember.fromJson(Map json) => + _$$_DHTSchemaMemberFromJson(json); + + @override + final FixedEncodedString43 mKey; + @override + final int mCnt; + + @override + String toString() { + return 'DHTSchemaMember(mKey: $mKey, mCnt: $mCnt)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_DHTSchemaMember && + (identical(other.mKey, mKey) || other.mKey == mKey) && + (identical(other.mCnt, mCnt) || other.mCnt == mCnt)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, mKey, mCnt); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_DHTSchemaMemberCopyWith<_$_DHTSchemaMember> get copyWith => + __$$_DHTSchemaMemberCopyWithImpl<_$_DHTSchemaMember>(this, _$identity); + + @override + Map toJson() { + return _$$_DHTSchemaMemberToJson( + this, + ); + } +} + +abstract class _DHTSchemaMember implements DHTSchemaMember { + const factory _DHTSchemaMember( + {required final FixedEncodedString43 mKey, + required final int mCnt}) = _$_DHTSchemaMember; + + factory _DHTSchemaMember.fromJson(Map json) = + _$_DHTSchemaMember.fromJson; + + @override + FixedEncodedString43 get mKey; + @override + int get mCnt; + @override + @JsonKey(ignore: true) + _$$_DHTSchemaMemberCopyWith<_$_DHTSchemaMember> get copyWith => + throw _privateConstructorUsedError; +} + +DHTRecordDescriptor _$DHTRecordDescriptorFromJson(Map json) { + return _DHTRecordDescriptor.fromJson(json); +} + +/// @nodoc +mixin _$DHTRecordDescriptor { + Typed get key => throw _privateConstructorUsedError; + FixedEncodedString43 get owner => throw _privateConstructorUsedError; + FixedEncodedString43? get ownerSecret => throw _privateConstructorUsedError; + DHTSchema get schema => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $DHTRecordDescriptorCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $DHTRecordDescriptorCopyWith<$Res> { + factory $DHTRecordDescriptorCopyWith( + DHTRecordDescriptor value, $Res Function(DHTRecordDescriptor) then) = + _$DHTRecordDescriptorCopyWithImpl<$Res, DHTRecordDescriptor>; + @useResult + $Res call( + {Typed key, + FixedEncodedString43 owner, + FixedEncodedString43? ownerSecret, + DHTSchema schema}); + + $DHTSchemaCopyWith<$Res> get schema; +} + +/// @nodoc +class _$DHTRecordDescriptorCopyWithImpl<$Res, $Val extends DHTRecordDescriptor> + implements $DHTRecordDescriptorCopyWith<$Res> { + _$DHTRecordDescriptorCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? key = null, + Object? owner = null, + Object? ownerSecret = freezed, + Object? schema = null, + }) { + return _then(_value.copyWith( + key: null == key + ? _value.key + : key // ignore: cast_nullable_to_non_nullable + as Typed, + owner: null == owner + ? _value.owner + : owner // ignore: cast_nullable_to_non_nullable + as FixedEncodedString43, + ownerSecret: freezed == ownerSecret + ? _value.ownerSecret + : ownerSecret // ignore: cast_nullable_to_non_nullable + as FixedEncodedString43?, + schema: null == schema + ? _value.schema + : schema // ignore: cast_nullable_to_non_nullable + as DHTSchema, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $DHTSchemaCopyWith<$Res> get schema { + return $DHTSchemaCopyWith<$Res>(_value.schema, (value) { + return _then(_value.copyWith(schema: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$_DHTRecordDescriptorCopyWith<$Res> + implements $DHTRecordDescriptorCopyWith<$Res> { + factory _$$_DHTRecordDescriptorCopyWith(_$_DHTRecordDescriptor value, + $Res Function(_$_DHTRecordDescriptor) then) = + __$$_DHTRecordDescriptorCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {Typed key, + FixedEncodedString43 owner, + FixedEncodedString43? ownerSecret, + DHTSchema schema}); + + @override + $DHTSchemaCopyWith<$Res> get schema; +} + +/// @nodoc +class __$$_DHTRecordDescriptorCopyWithImpl<$Res> + extends _$DHTRecordDescriptorCopyWithImpl<$Res, _$_DHTRecordDescriptor> + implements _$$_DHTRecordDescriptorCopyWith<$Res> { + __$$_DHTRecordDescriptorCopyWithImpl(_$_DHTRecordDescriptor _value, + $Res Function(_$_DHTRecordDescriptor) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? key = null, + Object? owner = null, + Object? ownerSecret = freezed, + Object? schema = null, + }) { + return _then(_$_DHTRecordDescriptor( + key: null == key + ? _value.key + : key // ignore: cast_nullable_to_non_nullable + as Typed, + owner: null == owner + ? _value.owner + : owner // ignore: cast_nullable_to_non_nullable + as FixedEncodedString43, + ownerSecret: freezed == ownerSecret + ? _value.ownerSecret + : ownerSecret // ignore: cast_nullable_to_non_nullable + as FixedEncodedString43?, + schema: null == schema + ? _value.schema + : schema // ignore: cast_nullable_to_non_nullable + as DHTSchema, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_DHTRecordDescriptor implements _DHTRecordDescriptor { + const _$_DHTRecordDescriptor( + {required this.key, + required this.owner, + this.ownerSecret, + required this.schema}); + + factory _$_DHTRecordDescriptor.fromJson(Map json) => + _$$_DHTRecordDescriptorFromJson(json); + + @override + final Typed key; + @override + final FixedEncodedString43 owner; + @override + final FixedEncodedString43? ownerSecret; + @override + final DHTSchema schema; + + @override + String toString() { + return 'DHTRecordDescriptor(key: $key, owner: $owner, ownerSecret: $ownerSecret, schema: $schema)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_DHTRecordDescriptor && + (identical(other.key, key) || other.key == key) && + (identical(other.owner, owner) || other.owner == owner) && + (identical(other.ownerSecret, ownerSecret) || + other.ownerSecret == ownerSecret) && + (identical(other.schema, schema) || other.schema == schema)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, key, owner, ownerSecret, schema); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_DHTRecordDescriptorCopyWith<_$_DHTRecordDescriptor> get copyWith => + __$$_DHTRecordDescriptorCopyWithImpl<_$_DHTRecordDescriptor>( + this, _$identity); + + @override + Map toJson() { + return _$$_DHTRecordDescriptorToJson( + this, + ); + } +} + +abstract class _DHTRecordDescriptor implements DHTRecordDescriptor { + const factory _DHTRecordDescriptor( + {required final Typed key, + required final FixedEncodedString43 owner, + final FixedEncodedString43? ownerSecret, + required final DHTSchema schema}) = _$_DHTRecordDescriptor; + + factory _DHTRecordDescriptor.fromJson(Map json) = + _$_DHTRecordDescriptor.fromJson; + + @override + Typed get key; + @override + FixedEncodedString43 get owner; + @override + FixedEncodedString43? get ownerSecret; + @override + DHTSchema get schema; + @override + @JsonKey(ignore: true) + _$$_DHTRecordDescriptorCopyWith<_$_DHTRecordDescriptor> get copyWith => + throw _privateConstructorUsedError; +} + +ValueSubkeyRange _$ValueSubkeyRangeFromJson(Map json) { + return _ValueSubkeyRange.fromJson(json); +} + +/// @nodoc +mixin _$ValueSubkeyRange { + int get low => throw _privateConstructorUsedError; + int get high => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $ValueSubkeyRangeCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ValueSubkeyRangeCopyWith<$Res> { + factory $ValueSubkeyRangeCopyWith( + ValueSubkeyRange value, $Res Function(ValueSubkeyRange) then) = + _$ValueSubkeyRangeCopyWithImpl<$Res, ValueSubkeyRange>; + @useResult + $Res call({int low, int high}); +} + +/// @nodoc +class _$ValueSubkeyRangeCopyWithImpl<$Res, $Val extends ValueSubkeyRange> + implements $ValueSubkeyRangeCopyWith<$Res> { + _$ValueSubkeyRangeCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? low = null, + Object? high = null, + }) { + return _then(_value.copyWith( + low: null == low + ? _value.low + : low // ignore: cast_nullable_to_non_nullable + as int, + high: null == high + ? _value.high + : high // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_ValueSubkeyRangeCopyWith<$Res> + implements $ValueSubkeyRangeCopyWith<$Res> { + factory _$$_ValueSubkeyRangeCopyWith( + _$_ValueSubkeyRange value, $Res Function(_$_ValueSubkeyRange) then) = + __$$_ValueSubkeyRangeCopyWithImpl<$Res>; + @override + @useResult + $Res call({int low, int high}); +} + +/// @nodoc +class __$$_ValueSubkeyRangeCopyWithImpl<$Res> + extends _$ValueSubkeyRangeCopyWithImpl<$Res, _$_ValueSubkeyRange> + implements _$$_ValueSubkeyRangeCopyWith<$Res> { + __$$_ValueSubkeyRangeCopyWithImpl( + _$_ValueSubkeyRange _value, $Res Function(_$_ValueSubkeyRange) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? low = null, + Object? high = null, + }) { + return _then(_$_ValueSubkeyRange( + low: null == low + ? _value.low + : low // ignore: cast_nullable_to_non_nullable + as int, + high: null == high + ? _value.high + : high // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_ValueSubkeyRange implements _ValueSubkeyRange { + const _$_ValueSubkeyRange({required this.low, required this.high}) + : assert(low < 0 || low > high, 'low out of range'), + assert(high < 0, 'high out of range'); + + factory _$_ValueSubkeyRange.fromJson(Map json) => + _$$_ValueSubkeyRangeFromJson(json); + + @override + final int low; + @override + final int high; + + @override + String toString() { + return 'ValueSubkeyRange(low: $low, high: $high)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_ValueSubkeyRange && + (identical(other.low, low) || other.low == low) && + (identical(other.high, high) || other.high == high)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, low, high); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_ValueSubkeyRangeCopyWith<_$_ValueSubkeyRange> get copyWith => + __$$_ValueSubkeyRangeCopyWithImpl<_$_ValueSubkeyRange>(this, _$identity); + + @override + Map toJson() { + return _$$_ValueSubkeyRangeToJson( + this, + ); + } +} + +abstract class _ValueSubkeyRange implements ValueSubkeyRange { + const factory _ValueSubkeyRange( + {required final int low, required final int high}) = _$_ValueSubkeyRange; + + factory _ValueSubkeyRange.fromJson(Map json) = + _$_ValueSubkeyRange.fromJson; + + @override + int get low; + @override + int get high; + @override + @JsonKey(ignore: true) + _$$_ValueSubkeyRangeCopyWith<_$_ValueSubkeyRange> get copyWith => + throw _privateConstructorUsedError; +} + +ValueData _$ValueDataFromJson(Map json) { + return _ValueData.fromJson(json); +} + +/// @nodoc +mixin _$ValueData { + int get seq => throw _privateConstructorUsedError; + @Uint8ListJsonConverter() + Uint8List get data => throw _privateConstructorUsedError; + FixedEncodedString43 get writer => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $ValueDataCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ValueDataCopyWith<$Res> { + factory $ValueDataCopyWith(ValueData value, $Res Function(ValueData) then) = + _$ValueDataCopyWithImpl<$Res, ValueData>; + @useResult + $Res call( + {int seq, + @Uint8ListJsonConverter() Uint8List data, + FixedEncodedString43 writer}); +} + +/// @nodoc +class _$ValueDataCopyWithImpl<$Res, $Val extends ValueData> + implements $ValueDataCopyWith<$Res> { + _$ValueDataCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? seq = null, + Object? data = null, + Object? writer = null, + }) { + return _then(_value.copyWith( + seq: null == seq + ? _value.seq + : seq // ignore: cast_nullable_to_non_nullable + as int, + data: null == data + ? _value.data + : data // ignore: cast_nullable_to_non_nullable + as Uint8List, + writer: null == writer + ? _value.writer + : writer // ignore: cast_nullable_to_non_nullable + as FixedEncodedString43, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_ValueDataCopyWith<$Res> implements $ValueDataCopyWith<$Res> { + factory _$$_ValueDataCopyWith( + _$_ValueData value, $Res Function(_$_ValueData) then) = + __$$_ValueDataCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {int seq, + @Uint8ListJsonConverter() Uint8List data, + FixedEncodedString43 writer}); +} + +/// @nodoc +class __$$_ValueDataCopyWithImpl<$Res> + extends _$ValueDataCopyWithImpl<$Res, _$_ValueData> + implements _$$_ValueDataCopyWith<$Res> { + __$$_ValueDataCopyWithImpl( + _$_ValueData _value, $Res Function(_$_ValueData) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? seq = null, + Object? data = null, + Object? writer = null, + }) { + return _then(_$_ValueData( + seq: null == seq + ? _value.seq + : seq // ignore: cast_nullable_to_non_nullable + as int, + data: null == data + ? _value.data + : data // ignore: cast_nullable_to_non_nullable + as Uint8List, + writer: null == writer + ? _value.writer + : writer // ignore: cast_nullable_to_non_nullable + as FixedEncodedString43, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_ValueData implements _ValueData { + const _$_ValueData( + {required this.seq, + @Uint8ListJsonConverter() required this.data, + required this.writer}) + : assert(seq >= 0, 'seq out of range'); + + factory _$_ValueData.fromJson(Map json) => + _$$_ValueDataFromJson(json); + + @override + final int seq; + @override + @Uint8ListJsonConverter() + final Uint8List data; + @override + final FixedEncodedString43 writer; + + @override + String toString() { + return 'ValueData(seq: $seq, data: $data, writer: $writer)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_ValueData && + (identical(other.seq, seq) || other.seq == seq) && + const DeepCollectionEquality().equals(other.data, data) && + (identical(other.writer, writer) || other.writer == writer)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, seq, const DeepCollectionEquality().hash(data), writer); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_ValueDataCopyWith<_$_ValueData> get copyWith => + __$$_ValueDataCopyWithImpl<_$_ValueData>(this, _$identity); + + @override + Map toJson() { + return _$$_ValueDataToJson( + this, + ); + } +} + +abstract class _ValueData implements ValueData { + const factory _ValueData( + {required final int seq, + @Uint8ListJsonConverter() required final Uint8List data, + required final FixedEncodedString43 writer}) = _$_ValueData; + + factory _ValueData.fromJson(Map json) = + _$_ValueData.fromJson; + + @override + int get seq; + @override + @Uint8ListJsonConverter() + Uint8List get data; + @override + FixedEncodedString43 get writer; + @override + @JsonKey(ignore: true) + _$$_ValueDataCopyWith<_$_ValueData> get copyWith => + throw _privateConstructorUsedError; +} + +SafetySpec _$SafetySpecFromJson(Map json) { + return _SafetySpec.fromJson(json); +} + +/// @nodoc +mixin _$SafetySpec { + String? get preferredRoute => throw _privateConstructorUsedError; + int get hopCount => throw _privateConstructorUsedError; + Stability get stability => throw _privateConstructorUsedError; + Sequencing get sequencing => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $SafetySpecCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $SafetySpecCopyWith<$Res> { + factory $SafetySpecCopyWith( + SafetySpec value, $Res Function(SafetySpec) then) = + _$SafetySpecCopyWithImpl<$Res, SafetySpec>; + @useResult + $Res call( + {String? preferredRoute, + int hopCount, + Stability stability, + Sequencing sequencing}); +} + +/// @nodoc +class _$SafetySpecCopyWithImpl<$Res, $Val extends SafetySpec> + implements $SafetySpecCopyWith<$Res> { + _$SafetySpecCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? preferredRoute = freezed, + Object? hopCount = null, + Object? stability = null, + Object? sequencing = null, + }) { + return _then(_value.copyWith( + preferredRoute: freezed == preferredRoute + ? _value.preferredRoute + : preferredRoute // ignore: cast_nullable_to_non_nullable + as String?, + hopCount: null == hopCount + ? _value.hopCount + : hopCount // ignore: cast_nullable_to_non_nullable + as int, + stability: null == stability + ? _value.stability + : stability // ignore: cast_nullable_to_non_nullable + as Stability, + sequencing: null == sequencing + ? _value.sequencing + : sequencing // ignore: cast_nullable_to_non_nullable + as Sequencing, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_SafetySpecCopyWith<$Res> + implements $SafetySpecCopyWith<$Res> { + factory _$$_SafetySpecCopyWith( + _$_SafetySpec value, $Res Function(_$_SafetySpec) then) = + __$$_SafetySpecCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String? preferredRoute, + int hopCount, + Stability stability, + Sequencing sequencing}); +} + +/// @nodoc +class __$$_SafetySpecCopyWithImpl<$Res> + extends _$SafetySpecCopyWithImpl<$Res, _$_SafetySpec> + implements _$$_SafetySpecCopyWith<$Res> { + __$$_SafetySpecCopyWithImpl( + _$_SafetySpec _value, $Res Function(_$_SafetySpec) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? preferredRoute = freezed, + Object? hopCount = null, + Object? stability = null, + Object? sequencing = null, + }) { + return _then(_$_SafetySpec( + preferredRoute: freezed == preferredRoute + ? _value.preferredRoute + : preferredRoute // ignore: cast_nullable_to_non_nullable + as String?, + hopCount: null == hopCount + ? _value.hopCount + : hopCount // ignore: cast_nullable_to_non_nullable + as int, + stability: null == stability + ? _value.stability + : stability // ignore: cast_nullable_to_non_nullable + as Stability, + sequencing: null == sequencing + ? _value.sequencing + : sequencing // ignore: cast_nullable_to_non_nullable + as Sequencing, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_SafetySpec implements _SafetySpec { + const _$_SafetySpec( + {this.preferredRoute, + required this.hopCount, + required this.stability, + required this.sequencing}); + + factory _$_SafetySpec.fromJson(Map json) => + _$$_SafetySpecFromJson(json); + + @override + final String? preferredRoute; + @override + final int hopCount; + @override + final Stability stability; + @override + final Sequencing sequencing; + + @override + String toString() { + return 'SafetySpec(preferredRoute: $preferredRoute, hopCount: $hopCount, stability: $stability, sequencing: $sequencing)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_SafetySpec && + (identical(other.preferredRoute, preferredRoute) || + other.preferredRoute == preferredRoute) && + (identical(other.hopCount, hopCount) || + other.hopCount == hopCount) && + (identical(other.stability, stability) || + other.stability == stability) && + (identical(other.sequencing, sequencing) || + other.sequencing == sequencing)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => + Object.hash(runtimeType, preferredRoute, hopCount, stability, sequencing); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_SafetySpecCopyWith<_$_SafetySpec> get copyWith => + __$$_SafetySpecCopyWithImpl<_$_SafetySpec>(this, _$identity); + + @override + Map toJson() { + return _$$_SafetySpecToJson( + this, + ); + } +} + +abstract class _SafetySpec implements SafetySpec { + const factory _SafetySpec( + {final String? preferredRoute, + required final int hopCount, + required final Stability stability, + required final Sequencing sequencing}) = _$_SafetySpec; + + factory _SafetySpec.fromJson(Map json) = + _$_SafetySpec.fromJson; + + @override + String? get preferredRoute; + @override + int get hopCount; + @override + Stability get stability; + @override + Sequencing get sequencing; + @override + @JsonKey(ignore: true) + _$$_SafetySpecCopyWith<_$_SafetySpec> get copyWith => + throw _privateConstructorUsedError; +} + +RouteBlob _$RouteBlobFromJson(Map json) { + return _RouteBlob.fromJson(json); +} + +/// @nodoc +mixin _$RouteBlob { + String get routeId => throw _privateConstructorUsedError; + @Uint8ListJsonConverter() + Uint8List get blob => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $RouteBlobCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $RouteBlobCopyWith<$Res> { + factory $RouteBlobCopyWith(RouteBlob value, $Res Function(RouteBlob) then) = + _$RouteBlobCopyWithImpl<$Res, RouteBlob>; + @useResult + $Res call({String routeId, @Uint8ListJsonConverter() Uint8List blob}); +} + +/// @nodoc +class _$RouteBlobCopyWithImpl<$Res, $Val extends RouteBlob> + implements $RouteBlobCopyWith<$Res> { + _$RouteBlobCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? routeId = null, + Object? blob = null, + }) { + return _then(_value.copyWith( + routeId: null == routeId + ? _value.routeId + : routeId // ignore: cast_nullable_to_non_nullable + as String, + blob: null == blob + ? _value.blob + : blob // ignore: cast_nullable_to_non_nullable + as Uint8List, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_RouteBlobCopyWith<$Res> implements $RouteBlobCopyWith<$Res> { + factory _$$_RouteBlobCopyWith( + _$_RouteBlob value, $Res Function(_$_RouteBlob) then) = + __$$_RouteBlobCopyWithImpl<$Res>; + @override + @useResult + $Res call({String routeId, @Uint8ListJsonConverter() Uint8List blob}); +} + +/// @nodoc +class __$$_RouteBlobCopyWithImpl<$Res> + extends _$RouteBlobCopyWithImpl<$Res, _$_RouteBlob> + implements _$$_RouteBlobCopyWith<$Res> { + __$$_RouteBlobCopyWithImpl( + _$_RouteBlob _value, $Res Function(_$_RouteBlob) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? routeId = null, + Object? blob = null, + }) { + return _then(_$_RouteBlob( + routeId: null == routeId + ? _value.routeId + : routeId // ignore: cast_nullable_to_non_nullable + as String, + blob: null == blob + ? _value.blob + : blob // ignore: cast_nullable_to_non_nullable + as Uint8List, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_RouteBlob implements _RouteBlob { + const _$_RouteBlob( + {required this.routeId, @Uint8ListJsonConverter() required this.blob}); + + factory _$_RouteBlob.fromJson(Map json) => + _$$_RouteBlobFromJson(json); + + @override + final String routeId; + @override + @Uint8ListJsonConverter() + final Uint8List blob; + + @override + String toString() { + return 'RouteBlob(routeId: $routeId, blob: $blob)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_RouteBlob && + (identical(other.routeId, routeId) || other.routeId == routeId) && + const DeepCollectionEquality().equals(other.blob, blob)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, routeId, const DeepCollectionEquality().hash(blob)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_RouteBlobCopyWith<_$_RouteBlob> get copyWith => + __$$_RouteBlobCopyWithImpl<_$_RouteBlob>(this, _$identity); + + @override + Map toJson() { + return _$$_RouteBlobToJson( + this, + ); + } +} + +abstract class _RouteBlob implements RouteBlob { + const factory _RouteBlob( + {required final String routeId, + @Uint8ListJsonConverter() required final Uint8List blob}) = _$_RouteBlob; + + factory _RouteBlob.fromJson(Map json) = + _$_RouteBlob.fromJson; + + @override + String get routeId; + @override + @Uint8ListJsonConverter() + Uint8List get blob; + @override + @JsonKey(ignore: true) + _$$_RouteBlobCopyWith<_$_RouteBlob> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/veilid-flutter/lib/routing_context.g.dart b/veilid-flutter/lib/routing_context.g.dart new file mode 100644 index 00000000..7cb46bac --- /dev/null +++ b/veilid-flutter/lib/routing_context.g.dart @@ -0,0 +1,119 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'routing_context.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$DHTSchemaDFLT _$$DHTSchemaDFLTFromJson(Map json) => + _$DHTSchemaDFLT( + oCnt: json['o_cnt'] as int, + $type: json['kind'] as String?, + ); + +Map _$$DHTSchemaDFLTToJson(_$DHTSchemaDFLT instance) => + { + 'o_cnt': instance.oCnt, + 'kind': instance.$type, + }; + +_$DHTSchemaSMPL _$$DHTSchemaSMPLFromJson(Map json) => + _$DHTSchemaSMPL( + oCnt: json['o_cnt'] as int, + members: (json['members'] as List) + .map((e) => DHTSchemaMember.fromJson(e as Map)) + .toList(), + $type: json['kind'] as String?, + ); + +Map _$$DHTSchemaSMPLToJson(_$DHTSchemaSMPL instance) => + { + 'o_cnt': instance.oCnt, + 'members': instance.members.map((e) => e.toJson()).toList(), + 'kind': instance.$type, + }; + +_$_DHTSchemaMember _$$_DHTSchemaMemberFromJson(Map json) => + _$_DHTSchemaMember( + mKey: FixedEncodedString43.fromJson(json['m_key']), + mCnt: json['m_cnt'] as int, + ); + +Map _$$_DHTSchemaMemberToJson(_$_DHTSchemaMember instance) => + { + 'm_key': instance.mKey.toJson(), + 'm_cnt': instance.mCnt, + }; + +_$_DHTRecordDescriptor _$$_DHTRecordDescriptorFromJson( + Map json) => + _$_DHTRecordDescriptor( + key: Typed.fromJson(json['key']), + owner: FixedEncodedString43.fromJson(json['owner']), + ownerSecret: json['owner_secret'] == null + ? null + : FixedEncodedString43.fromJson(json['owner_secret']), + schema: DHTSchema.fromJson(json['schema'] as Map), + ); + +Map _$$_DHTRecordDescriptorToJson( + _$_DHTRecordDescriptor instance) => + { + 'key': instance.key.toJson(), + 'owner': instance.owner.toJson(), + 'owner_secret': instance.ownerSecret?.toJson(), + 'schema': instance.schema.toJson(), + }; + +_$_ValueSubkeyRange _$$_ValueSubkeyRangeFromJson(Map json) => + _$_ValueSubkeyRange( + low: json['low'] as int, + high: json['high'] as int, + ); + +Map _$$_ValueSubkeyRangeToJson(_$_ValueSubkeyRange instance) => + { + 'low': instance.low, + 'high': instance.high, + }; + +_$_ValueData _$$_ValueDataFromJson(Map json) => _$_ValueData( + seq: json['seq'] as int, + data: const Uint8ListJsonConverter().fromJson(json['data'] as String), + writer: FixedEncodedString43.fromJson(json['writer']), + ); + +Map _$$_ValueDataToJson(_$_ValueData instance) => + { + 'seq': instance.seq, + 'data': const Uint8ListJsonConverter().toJson(instance.data), + 'writer': instance.writer.toJson(), + }; + +_$_SafetySpec _$$_SafetySpecFromJson(Map json) => + _$_SafetySpec( + preferredRoute: json['preferred_route'] as String?, + hopCount: json['hop_count'] as int, + stability: Stability.fromJson(json['stability'] as String), + sequencing: Sequencing.fromJson(json['sequencing'] as String), + ); + +Map _$$_SafetySpecToJson(_$_SafetySpec instance) => + { + 'preferred_route': instance.preferredRoute, + 'hop_count': instance.hopCount, + 'stability': instance.stability.toJson(), + 'sequencing': instance.sequencing.toJson(), + }; + +_$_RouteBlob _$$_RouteBlobFromJson(Map json) => _$_RouteBlob( + routeId: json['route_id'] as String, + blob: const Uint8ListJsonConverter().fromJson(json['blob'] as String), + ); + +Map _$$_RouteBlobToJson(_$_RouteBlob instance) => + { + 'route_id': instance.routeId, + 'blob': const Uint8ListJsonConverter().toJson(instance.blob), + }; diff --git a/veilid-flutter/lib/veilid.dart b/veilid-flutter/lib/veilid.dart index 650513a7..4c774228 100644 --- a/veilid-flutter/lib/veilid.dart +++ b/veilid-flutter/lib/veilid.dart @@ -1,6 +1,9 @@ import 'dart:async'; import 'dart:typed_data'; +import 'package:equatable/equatable.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; + import 'veilid_stub.dart' if (dart.library.io) 'veilid_ffi.dart' if (dart.library.js) 'veilid_js.dart'; @@ -15,6 +18,8 @@ import 'veilid_state.dart'; export 'default_config.dart'; export 'routing_context.dart'; + +export 'veilid_encoding.dart'; export 'veilid_config.dart'; export 'veilid_crypto.dart'; export 'veilid_table_db.dart'; @@ -36,7 +41,8 @@ Object? veilidApiToEncodable(Object? value) { throw UnsupportedError('Cannot convert to JSON: $value'); } -T? Function(dynamic) optFromJson(T Function(dynamic) jsonConstructor) { +T? Function(dynamic) optFromJson( + T Function(Map) jsonConstructor) { return (dynamic j) { if (j == null) { return null; @@ -47,73 +53,72 @@ T? Function(dynamic) optFromJson(T Function(dynamic) jsonConstructor) { } List Function(dynamic) jsonListConstructor( - T Function(dynamic) jsonConstructor) { + T Function(Map) jsonConstructor) { return (dynamic j) { - return (j as List).map((e) => jsonConstructor(e)).toList(); + return (j as List>) + .map((e) => jsonConstructor(e)) + .toList(); }; } ////////////////////////////////////// /// VeilidVersion -class VeilidVersion { +@immutable +class VeilidVersion extends Equatable { final int major; final int minor; final int patch; + @override + List get props => [major, minor, patch]; - VeilidVersion(this.major, this.minor, this.patch); + const VeilidVersion(this.major, this.minor, this.patch); } ////////////////////////////////////// /// Timestamp -class Timestamp { +@immutable +class Timestamp extends Equatable { final BigInt value; - Timestamp({required this.value}); + @override + List get props => [value]; + + const Timestamp({required this.value}); @override - String toString() { - return value.toString(); - } + String toString() => value.toString(); + factory Timestamp.fromString(String s) => Timestamp(value: BigInt.parse(s)); - Timestamp.fromString(String s) : value = BigInt.parse(s); + String toJson() => toString(); + factory Timestamp.fromJson(dynamic json) => + Timestamp.fromString(json as String); - Timestamp.fromJson(dynamic json) : this.fromString(json as String); - String toJson() { - return toString(); - } + TimestampDuration diff(Timestamp other) => + TimestampDuration(value: value - other.value); - TimestampDuration diff(Timestamp other) { - return TimestampDuration(value: value - other.value); - } - - Timestamp offset(TimestampDuration dur) { - return Timestamp(value: value + dur.value); - } + Timestamp offset(TimestampDuration dur) => + Timestamp(value: value + dur.value); } -class TimestampDuration { +@immutable +class TimestampDuration extends Equatable { final BigInt value; - TimestampDuration({required this.value}); + @override + List get props => [value]; + + const TimestampDuration({required this.value}); @override - String toString() { - return value.toString(); - } + String toString() => value.toString(); + factory TimestampDuration.fromString(String s) => + TimestampDuration(value: BigInt.parse(s)); - TimestampDuration.fromString(String s) : value = BigInt.parse(s); + String toJson() => toString(); + factory TimestampDuration.fromJson(dynamic json) => + TimestampDuration.fromString(json as String); - TimestampDuration.fromJson(dynamic json) : this.fromString(json as String); - String toJson() { - return toString(); - } - - int toMillis() { - return (value ~/ BigInt.from(1000)).toInt(); - } - - BigInt toMicros(Timestamp other) { - return value; - } + int toMillis() => (value ~/ BigInt.from(1000)).toInt(); + BigInt toMicros() => value; } ////////////////////////////////////// diff --git a/veilid-flutter/lib/veilid_api_exception.dart b/veilid-flutter/lib/veilid_api_exception.dart index 40a9db66..e08525bb 100644 --- a/veilid-flutter/lib/veilid_api_exception.dart +++ b/veilid-flutter/lib/veilid_api_exception.dart @@ -1,6 +1,9 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + ////////////////////////////////////// /// VeilidAPIException +@immutable abstract class VeilidAPIException implements Exception { factory VeilidAPIException.fromJson(dynamic json) { switch (json["kind"]) { @@ -73,6 +76,7 @@ abstract class VeilidAPIException implements Exception { String toDisplayError(); } +@immutable class VeilidAPIExceptionNotInitialized implements VeilidAPIException { @override String toString() { @@ -85,6 +89,7 @@ class VeilidAPIExceptionNotInitialized implements VeilidAPIException { } } +@immutable class VeilidAPIExceptionAlreadyInitialized implements VeilidAPIException { @override String toString() { @@ -97,6 +102,7 @@ class VeilidAPIExceptionAlreadyInitialized implements VeilidAPIException { } } +@immutable class VeilidAPIExceptionTimeout implements VeilidAPIException { @override String toString() { @@ -109,6 +115,7 @@ class VeilidAPIExceptionTimeout implements VeilidAPIException { } } +@immutable class VeilidAPIExceptionTryAgain implements VeilidAPIException { @override String toString() { @@ -121,6 +128,7 @@ class VeilidAPIExceptionTryAgain implements VeilidAPIException { } } +@immutable class VeilidAPIExceptionShutdown implements VeilidAPIException { @override String toString() { @@ -133,6 +141,7 @@ class VeilidAPIExceptionShutdown implements VeilidAPIException { } } +@immutable class VeilidAPIExceptionInvalidTarget implements VeilidAPIException { @override String toString() { @@ -145,9 +154,9 @@ class VeilidAPIExceptionInvalidTarget implements VeilidAPIException { } } +@immutable class VeilidAPIExceptionNoConnection implements VeilidAPIException { final String message; - @override String toString() { return "VeilidAPIException: NoConnection (message: $message)"; @@ -159,12 +168,12 @@ class VeilidAPIExceptionNoConnection implements VeilidAPIException { } // - VeilidAPIExceptionNoConnection(this.message); + const VeilidAPIExceptionNoConnection(this.message); } +@immutable class VeilidAPIExceptionKeyNotFound implements VeilidAPIException { final String key; - @override String toString() { return "VeilidAPIException: KeyNotFound (key: $key)"; @@ -176,9 +185,10 @@ class VeilidAPIExceptionKeyNotFound implements VeilidAPIException { } // - VeilidAPIExceptionKeyNotFound(this.key); + const VeilidAPIExceptionKeyNotFound(this.key); } +@immutable class VeilidAPIExceptionInternal implements VeilidAPIException { final String message; @@ -193,9 +203,10 @@ class VeilidAPIExceptionInternal implements VeilidAPIException { } // - VeilidAPIExceptionInternal(this.message); + const VeilidAPIExceptionInternal(this.message); } +@immutable class VeilidAPIExceptionUnimplemented implements VeilidAPIException { final String message; @@ -210,9 +221,10 @@ class VeilidAPIExceptionUnimplemented implements VeilidAPIException { } // - VeilidAPIExceptionUnimplemented(this.message); + const VeilidAPIExceptionUnimplemented(this.message); } +@immutable class VeilidAPIExceptionParseError implements VeilidAPIException { final String message; final String value; @@ -228,9 +240,10 @@ class VeilidAPIExceptionParseError implements VeilidAPIException { } // - VeilidAPIExceptionParseError(this.message, this.value); + const VeilidAPIExceptionParseError(this.message, this.value); } +@immutable class VeilidAPIExceptionInvalidArgument implements VeilidAPIException { final String context; final String argument; @@ -247,9 +260,11 @@ class VeilidAPIExceptionInvalidArgument implements VeilidAPIException { } // - VeilidAPIExceptionInvalidArgument(this.context, this.argument, this.value); + const VeilidAPIExceptionInvalidArgument( + this.context, this.argument, this.value); } +@immutable class VeilidAPIExceptionMissingArgument implements VeilidAPIException { final String context; final String argument; @@ -265,9 +280,10 @@ class VeilidAPIExceptionMissingArgument implements VeilidAPIException { } // - VeilidAPIExceptionMissingArgument(this.context, this.argument); + const VeilidAPIExceptionMissingArgument(this.context, this.argument); } +@immutable class VeilidAPIExceptionGeneric implements VeilidAPIException { final String message; @@ -282,5 +298,5 @@ class VeilidAPIExceptionGeneric implements VeilidAPIException { } // - VeilidAPIExceptionGeneric(this.message); + const VeilidAPIExceptionGeneric(this.message); } diff --git a/veilid-flutter/lib/veilid_config.dart b/veilid-flutter/lib/veilid_config.dart index 3f98649e..3f6f2224 100644 --- a/veilid-flutter/lib/veilid_config.dart +++ b/veilid-flutter/lib/veilid_config.dart @@ -1,118 +1,118 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:flutter/foundation.dart'; import 'package:change_case/change_case.dart'; - import 'veilid.dart'; +import 'veilid_encoding.dart'; +import 'veilid_crypto.dart'; + +part 'veilid_config.freezed.dart'; +part 'veilid_config.g.dart'; ////////////////////////////////////////////////////////// // FFI Platform-specific config +@freezed +class VeilidFFIConfigLoggingTerminal with _$VeilidFFIConfigLoggingTerminal { + const factory VeilidFFIConfigLoggingTerminal({ + required bool enabled, + required VeilidConfigLogLevel level, + }) = _VeilidFFIConfigLoggingTerminal; -class VeilidFFIConfigLoggingTerminal { - bool enabled; - VeilidConfigLogLevel level; - - VeilidFFIConfigLoggingTerminal({ - required this.enabled, - required this.level, - }); - - Map toJson() { - return { - 'enabled': enabled, - 'level': level.toJson(), - }; - } - - VeilidFFIConfigLoggingTerminal.fromJson(dynamic json) - : enabled = json['enabled'], - level = VeilidConfigLogLevel.fromJson(json['level']); + factory VeilidFFIConfigLoggingTerminal.fromJson(Map json) => + _$VeilidFFIConfigLoggingTerminalFromJson(json); } -class VeilidFFIConfigLoggingOtlp { - bool enabled; - VeilidConfigLogLevel level; - String grpcEndpoint; - String serviceName; +@freezed +class VeilidFFIConfigLoggingOtlp with _$VeilidFFIConfigLoggingOtlp { + const factory VeilidFFIConfigLoggingOtlp({ + required bool enabled, + required VeilidConfigLogLevel level, + required String grpcEndpoint, + required String serviceName, + }) = _VeilidFFIConfigLoggingOtlp; - VeilidFFIConfigLoggingOtlp({ - required this.enabled, - required this.level, - required this.grpcEndpoint, - required this.serviceName, - }); - - Map toJson() { - return { - 'enabled': enabled, - 'level': level.toJson(), - 'grpc_endpoint': grpcEndpoint, - 'service_name': serviceName, - }; - } - - VeilidFFIConfigLoggingOtlp.fromJson(dynamic json) - : enabled = json['enabled'], - level = VeilidConfigLogLevel.fromJson(json['level']), - grpcEndpoint = json['grpc_endpoint'], - serviceName = json['service_name']; + factory VeilidFFIConfigLoggingOtlp.fromJson(Map json) => + _$VeilidFFIConfigLoggingOtlpFromJson(json); } -class VeilidFFIConfigLoggingApi { - bool enabled; - VeilidConfigLogLevel level; +@freezed +class VeilidFFIConfigLoggingApi with _$VeilidFFIConfigLoggingApi { + const factory VeilidFFIConfigLoggingApi({ + required bool enabled, + required VeilidConfigLogLevel level, + }) = _VeilidFFIConfigLoggingApi; - VeilidFFIConfigLoggingApi({ - required this.enabled, - required this.level, - }); - - Map toJson() { - return { - 'enabled': enabled, - 'level': level.toJson(), - }; - } - - VeilidFFIConfigLoggingApi.fromJson(dynamic json) - : enabled = json['enabled'], - level = VeilidConfigLogLevel.fromJson(json['level']); + factory VeilidFFIConfigLoggingApi.fromJson(Map json) => + _$VeilidFFIConfigLoggingApiFromJson(json); } -class VeilidFFIConfigLogging { - VeilidFFIConfigLoggingTerminal terminal; - VeilidFFIConfigLoggingOtlp otlp; - VeilidFFIConfigLoggingApi api; +@freezed +class VeilidFFIConfigLogging with _$VeilidFFIConfigLogging { + const factory VeilidFFIConfigLogging( + {required VeilidFFIConfigLoggingTerminal terminal, + required VeilidFFIConfigLoggingOtlp otlp, + required VeilidFFIConfigLoggingApi api}) = _VeilidFFIConfigLogging; - VeilidFFIConfigLogging( - {required this.terminal, required this.otlp, required this.api}); - - Map toJson() { - return { - 'terminal': terminal.toJson(), - 'otlp': otlp.toJson(), - 'api': api.toJson(), - }; - } - - VeilidFFIConfigLogging.fromJson(dynamic json) - : terminal = VeilidFFIConfigLoggingTerminal.fromJson(json['terminal']), - otlp = VeilidFFIConfigLoggingOtlp.fromJson(json['otlp']), - api = VeilidFFIConfigLoggingApi.fromJson(json['api']); + factory VeilidFFIConfigLogging.fromJson(Map json) => + _$VeilidFFIConfigLoggingFromJson(json); } -class VeilidFFIConfig { - VeilidFFIConfigLogging logging; +@freezed +class VeilidFFIConfig with _$VeilidFFIConfig { + const factory VeilidFFIConfig({ + required VeilidFFIConfigLogging logging, + }) = _VeilidFFIConfig; - VeilidFFIConfig({ - required this.logging, - }); + factory VeilidFFIConfig.fromJson(Map json) => + _$VeilidFFIConfigFromJson(json); +} - Map toJson() { - return { - 'logging': logging.toJson(), - }; - } +////////////////////////////////////////////////////////// +// WASM Platform-specific config - VeilidFFIConfig.fromJson(Map json) - : logging = VeilidFFIConfigLogging.fromJson(json['logging']); +@freezed +class VeilidWASMConfigLoggingPerformance + with _$VeilidWASMConfigLoggingPerformance { + const factory VeilidWASMConfigLoggingPerformance({ + required bool enabled, + required VeilidConfigLogLevel level, + required bool logsInTimings, + required bool logsInConsole, + }) = _VeilidWASMConfigLoggingPerformance; + + factory VeilidWASMConfigLoggingPerformance.fromJson( + Map json) => + _$VeilidWASMConfigLoggingPerformanceFromJson(json); +} + +@freezed +class VeilidWASMConfigLoggingApi with _$VeilidWASMConfigLoggingApi { + const factory VeilidWASMConfigLoggingApi({ + required bool enabled, + required VeilidConfigLogLevel level, + }) = _VeilidWASMConfigLoggingApi; + + factory VeilidWASMConfigLoggingApi.fromJson(Map json) => + _$VeilidWASMConfigLoggingApiFromJson(json); +} + +@freezed +class VeilidWASMConfigLogging with _$VeilidWASMConfigLogging { + const factory VeilidWASMConfigLogging( + {required VeilidWASMConfigLoggingPerformance performance, + required VeilidWASMConfigLoggingApi api}) = _VeilidWASMConfigLogging; + + factory VeilidWASMConfigLogging.fromJson(Map json) => + _$VeilidWASMConfigLoggingFromJson(json); +} + +@freezed +class VeilidWASMConfig with _$VeilidWASMConfig { + const factory VeilidWASMConfig({ + required VeilidWASMConfigLogging logging, + }) = _VeilidWASMConfig; + + factory VeilidWASMConfig.fromJson(Map json) => + _$VeilidWASMConfigFromJson(json); } ////////////////////////////////////// @@ -135,794 +135,298 @@ enum VeilidConfigLogLevel { } } -////////////////////////////////////////////////////////// -// WASM Platform-specific config - -class VeilidWASMConfigLoggingPerformance { - bool enabled; - VeilidConfigLogLevel level; - bool logsInTimings; - bool logsInConsole; - - VeilidWASMConfigLoggingPerformance({ - required this.enabled, - required this.level, - required this.logsInTimings, - required this.logsInConsole, - }); - - Map toJson() { - return { - 'enabled': enabled, - 'level': level.toJson(), - 'logs_in_timings': logsInTimings, - 'logs_in_console': logsInConsole, - }; - } - - VeilidWASMConfigLoggingPerformance.fromJson(dynamic json) - : enabled = json['enabled'], - level = VeilidConfigLogLevel.fromJson(json['level']), - logsInTimings = json['logs_in_timings'], - logsInConsole = json['logs_in_console']; -} - -class VeilidWASMConfigLoggingApi { - bool enabled; - VeilidConfigLogLevel level; - - VeilidWASMConfigLoggingApi({ - required this.enabled, - required this.level, - }); - - Map toJson() { - return { - 'enabled': enabled, - 'level': level.toJson(), - }; - } - - VeilidWASMConfigLoggingApi.fromJson(dynamic json) - : enabled = json['enabled'], - level = VeilidConfigLogLevel.fromJson(json['level']); -} - -class VeilidWASMConfigLogging { - VeilidWASMConfigLoggingPerformance performance; - VeilidWASMConfigLoggingApi api; - - VeilidWASMConfigLogging({required this.performance, required this.api}); - - Map toJson() { - return { - 'performance': performance.toJson(), - 'api': api.toJson(), - }; - } - - VeilidWASMConfigLogging.fromJson(dynamic json) - : performance = - VeilidWASMConfigLoggingPerformance.fromJson(json['performance']), - api = VeilidWASMConfigLoggingApi.fromJson(json['api']); -} - -class VeilidWASMConfig { - VeilidWASMConfigLogging logging; - - VeilidWASMConfig({ - required this.logging, - }); - - Map toJson() { - return { - 'logging': logging.toJson(), - }; - } - - VeilidWASMConfig.fromJson(dynamic json) - : logging = VeilidWASMConfigLogging.fromJson(json['logging']); -} - ////////////////////////////////////// /// VeilidConfig -class VeilidConfigHTTPS { - bool enabled; - String listenAddress; - String path; - String? url; +@freezed +class VeilidConfigHTTPS with _$VeilidConfigHTTPS { + const factory VeilidConfigHTTPS({ + required bool enabled, + required String listenAddress, + required String path, + String? url, + }) = _VeilidConfigHTTPS; - VeilidConfigHTTPS({ - required this.enabled, - required this.listenAddress, - required this.path, - this.url, - }); - - Map toJson() { - return { - 'enabled': enabled, - 'listen_address': listenAddress, - 'path': path, - 'url': url - }; - } - - VeilidConfigHTTPS.fromJson(dynamic json) - : enabled = json['enabled'], - listenAddress = json['listen_address'], - path = json['path'], - url = json['url']; + factory VeilidConfigHTTPS.fromJson(Map json) => + _$VeilidConfigHTTPSFromJson(json); } //////////// -class VeilidConfigHTTP { - bool enabled; - String listenAddress; - String path; - String? url; +@freezed +class VeilidConfigHTTP with _$VeilidConfigHTTP { + const factory VeilidConfigHTTP({ + required bool enabled, + required String listenAddress, + required String path, + String? url, + }) = _VeilidConfigHTTP; - VeilidConfigHTTP({ - required this.enabled, - required this.listenAddress, - required this.path, - this.url, - }); - - Map toJson() { - return { - 'enabled': enabled, - 'listen_address': listenAddress, - 'path': path, - 'url': url - }; - } - - VeilidConfigHTTP.fromJson(dynamic json) - : enabled = json['enabled'], - listenAddress = json['listen_address'], - path = json['path'], - url = json['url']; + factory VeilidConfigHTTP.fromJson(Map json) => + _$VeilidConfigHTTPFromJson(json); } //////////// -class VeilidConfigApplication { - VeilidConfigHTTPS https; - VeilidConfigHTTP http; +@freezed +class VeilidConfigApplication with _$VeilidConfigApplication { + const factory VeilidConfigApplication({ + required VeilidConfigHTTPS https, + required VeilidConfigHTTP http, + }) = _VeilidConfigApplication; - VeilidConfigApplication({ - required this.https, - required this.http, - }); + factory VeilidConfigApplication.fromJson(Map json) => + _$VeilidConfigApplicationFromJson(json); +} - Map toJson() { - return { - 'https': https.toJson(), - 'http': http.toJson(), - }; - } +//////////// +@freezed +class VeilidConfigUDP with _$VeilidConfigUDP { + const factory VeilidConfigUDP( + {required bool enabled, + required int socketPoolSize, + required String listenAddress, + String? publicAddress}) = _VeilidConfigUDP; - VeilidConfigApplication.fromJson(dynamic json) - : https = VeilidConfigHTTPS.fromJson(json['https']), - http = VeilidConfigHTTP.fromJson(json['http']); + factory VeilidConfigUDP.fromJson(Map json) => + _$VeilidConfigUDPFromJson(json); +} + +//////////// +@freezed +class VeilidConfigTCP with _$VeilidConfigTCP { + const factory VeilidConfigTCP( + {required bool connect, + required bool listen, + required int maxConnections, + required String listenAddress, + String? publicAddress}) = _VeilidConfigTCP; + + factory VeilidConfigTCP.fromJson(Map json) => + _$VeilidConfigTCPFromJson(json); +} + +//////////// +@freezed +class VeilidConfigWS with _$VeilidConfigWS { + const factory VeilidConfigWS( + {required bool connect, + required bool listen, + required int maxConnections, + required String listenAddress, + required String path, + String? url}) = _VeilidConfigWS; + + factory VeilidConfigWS.fromJson(Map json) => + _$VeilidConfigWSFromJson(json); +} + +//////////// +@freezed +class VeilidConfigWSS with _$VeilidConfigWSS { + const factory VeilidConfigWSS( + {required bool connect, + required bool listen, + required int maxConnections, + required String listenAddress, + required String path, + String? url}) = _VeilidConfigWSS; + + factory VeilidConfigWSS.fromJson(Map json) => + _$VeilidConfigWSSFromJson(json); } //////////// -class VeilidConfigUDP { - bool enabled; - int socketPoolSize; - String listenAddress; - String? publicAddress; +@freezed +class VeilidConfigProtocol with _$VeilidConfigProtocol { + const factory VeilidConfigProtocol({ + required VeilidConfigUDP udp, + required VeilidConfigTCP tcp, + required VeilidConfigWS ws, + required VeilidConfigWSS wss, + }) = _VeilidConfigProtocol; - VeilidConfigUDP( - {required this.enabled, - required this.socketPoolSize, - required this.listenAddress, - this.publicAddress}); - - Map toJson() { - return { - 'enabled': enabled, - 'socket_pool_size': socketPoolSize, - 'listen_address': listenAddress, - 'public_address': publicAddress, - }; - } - - VeilidConfigUDP.fromJson(dynamic json) - : enabled = json['enabled'], - socketPoolSize = json['socket_pool_size'], - listenAddress = json['listen_address'], - publicAddress = json['publicAddress']; + factory VeilidConfigProtocol.fromJson(Map json) => + _$VeilidConfigProtocolFromJson(json); } //////////// -class VeilidConfigTCP { - bool connect; - bool listen; - int maxConnections; - String listenAddress; - String? publicAddress; +@freezed +class VeilidConfigTLS with _$VeilidConfigTLS { + const factory VeilidConfigTLS({ + required String certificatePath, + required String privateKeyPath, + required int connectionInitialTimeoutMs, + }) = _VeilidConfigTLS; - VeilidConfigTCP( - {required this.connect, - required this.listen, - required this.maxConnections, - required this.listenAddress, - this.publicAddress}); + factory VeilidConfigTLS.fromJson(Map json) => + _$VeilidConfigTLSFromJson(json); +} - Map toJson() { - return { - 'connect': connect, - 'listen': listen, - 'max_connections': maxConnections, - 'listen_address': listenAddress, - 'public_address': publicAddress, - }; - } +//////////// +@freezed +class VeilidConfigDHT with _$VeilidConfigDHT { + const factory VeilidConfigDHT( + {required int resolveNodeTimeoutMs, + required int resolveNodeCount, + required int resolveNodeFanout, + required int maxFindNodeCount, + required int getValueTimeoutMs, + required int getValueCount, + required int getValueFanout, + required int setValueTimeoutMs, + required int setValueCount, + required int setValueFanout, + required int minPeerCount, + required int minPeerRefreshTimeMs, + required int validateDialInfoReceiptTimeMs, + required int localSubkeyCacheSize, + required int localMaxSubkeyCacheMemoryMb, + required int remoteSubkeyCacheSize, + required int remoteMaxRecords, + required int remoteMaxSubkeyCacheMemoryMb, + required int remoteMaxStorageSpaceMb}) = _VeilidConfigDHT; - VeilidConfigTCP.fromJson(dynamic json) - : connect = json['connect'], - listen = json['listen'], - maxConnections = json['max_connections'], - listenAddress = json['listen_address'], - publicAddress = json['publicAddress']; + factory VeilidConfigDHT.fromJson(Map json) => + _$VeilidConfigDHTFromJson(json); } //////////// -class VeilidConfigWS { - bool connect; - bool listen; - int maxConnections; - String listenAddress; - String path; - String? url; +@freezed +class VeilidConfigRPC with _$VeilidConfigRPC { + const factory VeilidConfigRPC( + {required int concurrency, + required int queueSize, + int? maxTimestampBehindMs, + int? maxTimestampAheadMs, + required int timeoutMs, + required int maxRouteHopCount, + required int defaultRouteHopCount}) = _VeilidConfigRPC; - VeilidConfigWS( - {required this.connect, - required this.listen, - required this.maxConnections, - required this.listenAddress, - required this.path, - this.url}); - - Map toJson() { - return { - 'connect': connect, - 'listen': listen, - 'max_connections': maxConnections, - 'listen_address': listenAddress, - 'path': path, - 'url': url, - }; - } - - VeilidConfigWS.fromJson(dynamic json) - : connect = json['connect'], - listen = json['listen'], - maxConnections = json['max_connections'], - listenAddress = json['listen_address'], - path = json['path'], - url = json['url']; + factory VeilidConfigRPC.fromJson(Map json) => + _$VeilidConfigRPCFromJson(json); } //////////// -class VeilidConfigWSS { - bool connect; - bool listen; - int maxConnections; - String listenAddress; - String path; - String? url; +@freezed +class VeilidConfigRoutingTable with _$VeilidConfigRoutingTable { + const factory VeilidConfigRoutingTable({ + required List nodeId, + required List nodeIdSecret, + required List bootstrap, + required int limitOverAttached, + required int limitFullyAttached, + required int limitAttachedStrong, + required int limitAttachedGood, + required int limitAttachedWeak, + }) = _VeilidConfigRoutingTable; - VeilidConfigWSS( - {required this.connect, - required this.listen, - required this.maxConnections, - required this.listenAddress, - required this.path, - this.url}); - - Map toJson() { - return { - 'connect': connect, - 'listen': listen, - 'max_connections': maxConnections, - 'listen_address': listenAddress, - 'path': path, - 'url': url, - }; - } - - VeilidConfigWSS.fromJson(dynamic json) - : connect = json['connect'], - listen = json['listen'], - maxConnections = json['max_connections'], - listenAddress = json['listen_address'], - path = json['path'], - url = json['url']; + factory VeilidConfigRoutingTable.fromJson(Map json) => + _$VeilidConfigRoutingTableFromJson(json); } //////////// -class VeilidConfigProtocol { - VeilidConfigUDP udp; - VeilidConfigTCP tcp; - VeilidConfigWS ws; - VeilidConfigWSS wss; +@freezed +class VeilidConfigNetwork with _$VeilidConfigNetwork { + const factory VeilidConfigNetwork({ + required int connectionInitialTimeoutMs, + required int connectionInactivityTimeoutMs, + required int maxConnectionsPerIp4, + required int maxConnectionsPerIp6Prefix, + required int maxConnectionsPerIp6PrefixSize, + required int maxConnectionFrequencyPerMin, + required int clientWhitelistTimeoutMs, + required int reverseConnectionReceiptTimeMs, + required int holePunchReceiptTimeMs, + String? networkKeyPassword, + required VeilidConfigRoutingTable routingTable, + required VeilidConfigRPC rpc, + required VeilidConfigDHT dht, + required bool upnp, + required bool detectAddressChanges, + required int restrictedNatRetries, + required VeilidConfigTLS tls, + required VeilidConfigApplication application, + required VeilidConfigProtocol protocol, + }) = _VeilidConfigNetwork; - VeilidConfigProtocol({ - required this.udp, - required this.tcp, - required this.ws, - required this.wss, - }); - - Map toJson() { - return { - 'udp': udp.toJson(), - 'tcp': tcp.toJson(), - 'ws': ws.toJson(), - 'wss': wss.toJson(), - }; - } - - VeilidConfigProtocol.fromJson(dynamic json) - : udp = VeilidConfigUDP.fromJson(json['udp']), - tcp = VeilidConfigTCP.fromJson(json['tcp']), - ws = VeilidConfigWS.fromJson(json['ws']), - wss = VeilidConfigWSS.fromJson(json['wss']); + factory VeilidConfigNetwork.fromJson(Map json) => + _$VeilidConfigNetworkFromJson(json); } //////////// -class VeilidConfigTLS { - String certificatePath; - String privateKeyPath; - int connectionInitialTimeoutMs; +@freezed +class VeilidConfigTableStore with _$VeilidConfigTableStore { + const factory VeilidConfigTableStore({ + required String directory, + required bool delete, + }) = _VeilidConfigTableStore; - VeilidConfigTLS({ - required this.certificatePath, - required this.privateKeyPath, - required this.connectionInitialTimeoutMs, - }); - - Map toJson() { - return { - 'certificate_path': certificatePath, - 'private_key_path': privateKeyPath, - 'connection_initial_timeout_ms': connectionInitialTimeoutMs, - }; - } - - VeilidConfigTLS.fromJson(dynamic json) - : certificatePath = json['certificate_path'], - privateKeyPath = json['private_key_path'], - connectionInitialTimeoutMs = json['connection_initial_timeout_ms']; + factory VeilidConfigTableStore.fromJson(Map json) => + _$VeilidConfigTableStoreFromJson(json); } //////////// -class VeilidConfigDHT { - int resolveNodeTimeoutMs; - int resolveNodeCount; - int resolveNodeFanout; - int maxFindNodeCount; - int getValueTimeoutMs; - int getValueCount; - int getValueFanout; - int setValueTimeoutMs; - int setValueCount; - int setValueFanout; - int minPeerCount; - int minPeerRefreshTimeMs; - int validateDialInfoReceiptTimeMs; - int localSubkeyCacheSize; - int localMaxSubkeyCacheMemoryMb; - int remoteSubkeyCacheSize; - int remoteMaxRecords; - int remoteMaxSubkeyCacheMemoryMb; - int remoteMaxStorageSpaceMb; +@freezed +class VeilidConfigBlockStore with _$VeilidConfigBlockStore { + const factory VeilidConfigBlockStore({ + required String directory, + required bool delete, + }) = _VeilidConfigBlockStore; - VeilidConfigDHT( - {required this.resolveNodeTimeoutMs, - required this.resolveNodeCount, - required this.resolveNodeFanout, - required this.maxFindNodeCount, - required this.getValueTimeoutMs, - required this.getValueCount, - required this.getValueFanout, - required this.setValueTimeoutMs, - required this.setValueCount, - required this.setValueFanout, - required this.minPeerCount, - required this.minPeerRefreshTimeMs, - required this.validateDialInfoReceiptTimeMs, - required this.localSubkeyCacheSize, - required this.localMaxSubkeyCacheMemoryMb, - required this.remoteSubkeyCacheSize, - required this.remoteMaxRecords, - required this.remoteMaxSubkeyCacheMemoryMb, - required this.remoteMaxStorageSpaceMb}); - - Map toJson() { - return { - 'max_find_node_count': maxFindNodeCount, - 'resolve_node_timeout_ms': resolveNodeTimeoutMs, - 'resolve_node_count': resolveNodeCount, - 'resolve_node_fanout': resolveNodeFanout, - 'get_value_timeout_ms': getValueTimeoutMs, - 'get_value_count': getValueCount, - 'get_value_fanout': getValueFanout, - 'set_value_timeout_ms': setValueTimeoutMs, - 'set_value_count': setValueCount, - 'set_value_fanout': setValueFanout, - 'min_peer_count': minPeerCount, - 'min_peer_refresh_time_ms': minPeerRefreshTimeMs, - 'validate_dial_info_receipt_time_ms': validateDialInfoReceiptTimeMs, - 'local_subkey_cache_size': localSubkeyCacheSize, - 'local_max_subkey_cache_memory_mb': localMaxSubkeyCacheMemoryMb, - 'remote_subkey_cache_size': remoteSubkeyCacheSize, - 'remote_max_records': remoteMaxRecords, - 'remote_max_subkey_cache_memory_mb': remoteMaxSubkeyCacheMemoryMb, - 'remote_max_storage_space_mb': remoteMaxStorageSpaceMb, - }; - } - - VeilidConfigDHT.fromJson(dynamic json) - : resolveNodeTimeoutMs = json['resolve_node_timeout_ms'], - resolveNodeCount = json['resolve_node_count'], - resolveNodeFanout = json['resolve_node_fanout'], - maxFindNodeCount = json['max_find_node_count'], - getValueTimeoutMs = json['get_value_timeout_ms'], - getValueCount = json['get_value_count'], - getValueFanout = json['get_value_fanout'], - setValueTimeoutMs = json['set_value_timeout_ms'], - setValueCount = json['set_value_count'], - setValueFanout = json['set_value_fanout'], - minPeerCount = json['min_peer_count'], - minPeerRefreshTimeMs = json['min_peer_refresh_time_ms'], - validateDialInfoReceiptTimeMs = - json['validate_dial_info_receipt_time_ms'], - localSubkeyCacheSize = json['local_subkey_cache_size'], - localMaxSubkeyCacheMemoryMb = json['local_max_subkey_cache_memory_mb'], - remoteSubkeyCacheSize = json['remote_subkey_cache_size'], - remoteMaxRecords = json['remote_max_records'], - remoteMaxSubkeyCacheMemoryMb = - json['remote_max_subkey_cache_memory_mb'], - remoteMaxStorageSpaceMb = json['remote_max_storage_space_mb']; + factory VeilidConfigBlockStore.fromJson(Map json) => + _$VeilidConfigBlockStoreFromJson(json); } //////////// -class VeilidConfigRPC { - int concurrency; - int queueSize; - int? maxTimestampBehindMs; - int? maxTimestampAheadMs; - int timeoutMs; - int maxRouteHopCount; - int defaultRouteHopCount; +@freezed +class VeilidConfigProtectedStore with _$VeilidConfigProtectedStore { + const factory VeilidConfigProtectedStore( + {required bool allowInsecureFallback, + required bool alwaysUseInsecureStorage, + required String directory, + required bool delete, + required String deviceEncryptionKeyPassword, + String? newDeviceEncryptionKeyPassword}) = _VeilidConfigProtectedStore; - VeilidConfigRPC( - {required this.concurrency, - required this.queueSize, - this.maxTimestampBehindMs, - this.maxTimestampAheadMs, - required this.timeoutMs, - required this.maxRouteHopCount, - required this.defaultRouteHopCount}); - - Map toJson() { - return { - 'concurrency': concurrency, - 'queue_size': queueSize, - 'max_timestamp_behind_ms': maxTimestampBehindMs, - 'max_timestamp_ahead_ms': maxTimestampAheadMs, - 'timeout_ms': timeoutMs, - 'max_route_hop_count': maxRouteHopCount, - 'default_route_hop_count': defaultRouteHopCount, - }; - } - - VeilidConfigRPC.fromJson(dynamic json) - : concurrency = json['concurrency'], - queueSize = json['queue_size'], - maxTimestampBehindMs = json['max_timestamp_behind_ms'], - maxTimestampAheadMs = json['max_timestamp_ahead_ms'], - timeoutMs = json['timeout_ms'], - maxRouteHopCount = json['max_route_hop_count'], - defaultRouteHopCount = json['default_route_hop_count']; + factory VeilidConfigProtectedStore.fromJson(Map json) => + _$VeilidConfigProtectedStoreFromJson(json); } //////////// -class VeilidConfigRoutingTable { - List nodeId; - List nodeIdSecret; - List bootstrap; - int limitOverAttached; - int limitFullyAttached; - int limitAttachedStrong; - int limitAttachedGood; - int limitAttachedWeak; +@freezed +class VeilidConfigCapabilities with _$VeilidConfigCapabilities { + const factory VeilidConfigCapabilities({ + required List disable, + }) = _VeilidConfigCapabilities; - VeilidConfigRoutingTable({ - required this.nodeId, - required this.nodeIdSecret, - required this.bootstrap, - required this.limitOverAttached, - required this.limitFullyAttached, - required this.limitAttachedStrong, - required this.limitAttachedGood, - required this.limitAttachedWeak, - }); - - Map toJson() { - return { - 'node_id': nodeId.map((p) => p.toJson()).toList(), - 'node_id_secret': nodeIdSecret.map((p) => p.toJson()).toList(), - 'bootstrap': bootstrap.map((p) => p).toList(), - 'limit_over_attached': limitOverAttached, - 'limit_fully_attached': limitFullyAttached, - 'limit_attached_strong': limitAttachedStrong, - 'limit_attached_good': limitAttachedGood, - 'limit_attached_weak': limitAttachedWeak, - }; - } - - VeilidConfigRoutingTable.fromJson(dynamic json) - : nodeId = List.from( - json['node_id'].map((j) => TypedKey.fromJson(j))), - nodeIdSecret = List.from( - json['node_id_secret'].map((j) => TypedSecret.fromJson(j))), - bootstrap = List.from(json['bootstrap'].map((j) => j)), - limitOverAttached = json['limit_over_attached'], - limitFullyAttached = json['limit_fully_attached'], - limitAttachedStrong = json['limit_attached_strong'], - limitAttachedGood = json['limit_attached_good'], - limitAttachedWeak = json['limit_attached_weak']; + factory VeilidConfigCapabilities.fromJson(Map json) => + _$VeilidConfigCapabilitiesFromJson(json); } //////////// -class VeilidConfigNetwork { - int connectionInitialTimeoutMs; - int connectionInactivityTimeoutMs; - int maxConnectionsPerIp4; - int maxConnectionsPerIp6Prefix; - int maxConnectionsPerIp6PrefixSize; - int maxConnectionFrequencyPerMin; - int clientWhitelistTimeoutMs; - int reverseConnectionReceiptTimeMs; - int holePunchReceiptTimeMs; - String? networkKeyPassword; - VeilidConfigRoutingTable routingTable; - VeilidConfigRPC rpc; - VeilidConfigDHT dht; - bool upnp; - bool detectAddressChanges; - int restrictedNatRetries; - VeilidConfigTLS tls; - VeilidConfigApplication application; - VeilidConfigProtocol protocol; +@freezed +class VeilidConfig with _$VeilidConfig { + const factory VeilidConfig({ + required String programName, + required String namespace, + required VeilidConfigCapabilities capabilities, + required VeilidConfigProtectedStore protectedStore, + required VeilidConfigTableStore tableStore, + required VeilidConfigBlockStore blockStore, + required VeilidConfigNetwork network, + }) = _VeilidConfig; - VeilidConfigNetwork({ - required this.connectionInitialTimeoutMs, - required this.connectionInactivityTimeoutMs, - required this.maxConnectionsPerIp4, - required this.maxConnectionsPerIp6Prefix, - required this.maxConnectionsPerIp6PrefixSize, - required this.maxConnectionFrequencyPerMin, - required this.clientWhitelistTimeoutMs, - required this.reverseConnectionReceiptTimeMs, - required this.holePunchReceiptTimeMs, - this.networkKeyPassword, - required this.routingTable, - required this.rpc, - required this.dht, - required this.upnp, - required this.detectAddressChanges, - required this.restrictedNatRetries, - required this.tls, - required this.application, - required this.protocol, - }); - - Map toJson() { - return { - 'connection_initial_timeout_ms': connectionInitialTimeoutMs, - 'connection_inactivity_timeout_ms': connectionInactivityTimeoutMs, - 'max_connections_per_ip4': maxConnectionsPerIp4, - 'max_connections_per_ip6_prefix': maxConnectionsPerIp6Prefix, - 'max_connections_per_ip6_prefix_size': maxConnectionsPerIp6PrefixSize, - 'max_connection_frequency_per_min': maxConnectionFrequencyPerMin, - 'client_whitelist_timeout_ms': clientWhitelistTimeoutMs, - 'reverse_connection_receipt_time_ms': reverseConnectionReceiptTimeMs, - 'hole_punch_receipt_time_ms': holePunchReceiptTimeMs, - 'network_key_password': networkKeyPassword, - 'routing_table': routingTable.toJson(), - 'rpc': rpc.toJson(), - 'dht': dht.toJson(), - 'upnp': upnp, - 'detect_address_changes': detectAddressChanges, - 'restricted_nat_retries': restrictedNatRetries, - 'tls': tls.toJson(), - 'application': application.toJson(), - 'protocol': protocol.toJson(), - }; - } - - VeilidConfigNetwork.fromJson(dynamic json) - : connectionInitialTimeoutMs = json['connection_initial_timeout_ms'], - connectionInactivityTimeoutMs = - json['connection_inactivity_timeout_ms'], - maxConnectionsPerIp4 = json['max_connections_per_ip4'], - maxConnectionsPerIp6Prefix = json['max_connections_per_ip6_prefix'], - maxConnectionsPerIp6PrefixSize = - json['max_connections_per_ip6_prefix_size'], - maxConnectionFrequencyPerMin = json['max_connection_frequency_per_min'], - clientWhitelistTimeoutMs = json['client_whitelist_timeout_ms'], - reverseConnectionReceiptTimeMs = - json['reverse_connection_receipt_time_ms'], - holePunchReceiptTimeMs = json['hole_punch_receipt_time_ms'], - networkKeyPassword = json['network_key_password'], - routingTable = VeilidConfigRoutingTable.fromJson(json['routing_table']), - rpc = VeilidConfigRPC.fromJson(json['rpc']), - dht = VeilidConfigDHT.fromJson(json['dht']), - upnp = json['upnp'], - detectAddressChanges = json['detect_address_changes'], - restrictedNatRetries = json['restricted_nat_retries'], - tls = VeilidConfigTLS.fromJson(json['tls']), - application = VeilidConfigApplication.fromJson(json['application']), - protocol = VeilidConfigProtocol.fromJson(json['protocol']); -} - -//////////// - -class VeilidConfigTableStore { - String directory; - bool delete; - - VeilidConfigTableStore({ - required this.directory, - required this.delete, - }); - - Map toJson() { - return {'directory': directory, 'delete': delete}; - } - - VeilidConfigTableStore.fromJson(dynamic json) - : directory = json['directory'], - delete = json['delete']; -} - -//////////// - -class VeilidConfigBlockStore { - String directory; - bool delete; - - VeilidConfigBlockStore({ - required this.directory, - required this.delete, - }); - - Map toJson() { - return {'directory': directory, 'delete': delete}; - } - - VeilidConfigBlockStore.fromJson(dynamic json) - : directory = json['directory'], - delete = json['delete']; -} - -//////////// - -class VeilidConfigProtectedStore { - bool allowInsecureFallback; - bool alwaysUseInsecureStorage; - String directory; - bool delete; - String deviceEncryptionKeyPassword; - String? newDeviceEncryptionKeyPassword; - - VeilidConfigProtectedStore( - {required this.allowInsecureFallback, - required this.alwaysUseInsecureStorage, - required this.directory, - required this.delete, - required this.deviceEncryptionKeyPassword, - String? newDeviceEncryptionKeyPassword}); - - Map toJson() { - return { - 'allow_insecure_fallback': allowInsecureFallback, - 'always_use_insecure_storage': alwaysUseInsecureStorage, - 'directory': directory, - 'delete': delete, - 'device_encryption_key_password': deviceEncryptionKeyPassword, - 'new_device_encryption_key': newDeviceEncryptionKeyPassword, - }; - } - - VeilidConfigProtectedStore.fromJson(dynamic json) - : allowInsecureFallback = json['allow_insecure_fallback'], - alwaysUseInsecureStorage = json['always_use_insecure_storage'], - directory = json['directory'], - delete = json['delete'], - deviceEncryptionKeyPassword = json['device_encryption_key_password'], - newDeviceEncryptionKeyPassword = - json['new_device_encryption_key_password']; -} - -//////////// - -class VeilidConfigCapabilities { - List disable; - - VeilidConfigCapabilities({ - required this.disable, - }); - - Map toJson() { - return { - 'disable': disable.map((p) => p).toList(), - }; - } - - VeilidConfigCapabilities.fromJson(dynamic json) - : disable = List.from(json['disable'].map((j) => j)); -} - -//////////// - -class VeilidConfig { - String programName; - String namespace; - VeilidConfigCapabilities capabilities; - VeilidConfigProtectedStore protectedStore; - VeilidConfigTableStore tableStore; - VeilidConfigBlockStore blockStore; - VeilidConfigNetwork network; - - VeilidConfig({ - required this.programName, - required this.namespace, - required this.capabilities, - required this.protectedStore, - required this.tableStore, - required this.blockStore, - required this.network, - }); - - Map toJson() { - return { - 'program_name': programName, - 'namespace': namespace, - 'capabilities': capabilities.toJson(), - 'protected_store': protectedStore.toJson(), - 'table_store': tableStore.toJson(), - 'block_store': blockStore.toJson(), - 'network': network.toJson() - }; - } - - VeilidConfig.fromJson(dynamic json) - : programName = json['program_name'], - namespace = json['namespace'], - capabilities = VeilidConfigCapabilities.fromJson(json['capabilities']), - protectedStore = - VeilidConfigProtectedStore.fromJson(json['protected_store']), - tableStore = VeilidConfigTableStore.fromJson(json['table_store']), - blockStore = VeilidConfigBlockStore.fromJson(json['block_store']), - network = VeilidConfigNetwork.fromJson(json['network']); + factory VeilidConfig.fromJson(Map json) => + _$VeilidConfigFromJson(json); } diff --git a/veilid-flutter/lib/veilid_config.freezed.dart b/veilid-flutter/lib/veilid_config.freezed.dart new file mode 100644 index 00000000..26554b99 --- /dev/null +++ b/veilid-flutter/lib/veilid_config.freezed.dart @@ -0,0 +1,6780 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'veilid_config.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +VeilidFFIConfigLoggingTerminal _$VeilidFFIConfigLoggingTerminalFromJson( + Map json) { + return _VeilidFFIConfigLoggingTerminal.fromJson(json); +} + +/// @nodoc +mixin _$VeilidFFIConfigLoggingTerminal { + bool get enabled => throw _privateConstructorUsedError; + VeilidConfigLogLevel get level => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $VeilidFFIConfigLoggingTerminalCopyWith + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VeilidFFIConfigLoggingTerminalCopyWith<$Res> { + factory $VeilidFFIConfigLoggingTerminalCopyWith( + VeilidFFIConfigLoggingTerminal value, + $Res Function(VeilidFFIConfigLoggingTerminal) then) = + _$VeilidFFIConfigLoggingTerminalCopyWithImpl<$Res, + VeilidFFIConfigLoggingTerminal>; + @useResult + $Res call({bool enabled, VeilidConfigLogLevel level}); +} + +/// @nodoc +class _$VeilidFFIConfigLoggingTerminalCopyWithImpl<$Res, + $Val extends VeilidFFIConfigLoggingTerminal> + implements $VeilidFFIConfigLoggingTerminalCopyWith<$Res> { + _$VeilidFFIConfigLoggingTerminalCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? enabled = null, + Object? level = null, + }) { + return _then(_value.copyWith( + enabled: null == enabled + ? _value.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + level: null == level + ? _value.level + : level // ignore: cast_nullable_to_non_nullable + as VeilidConfigLogLevel, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_VeilidFFIConfigLoggingTerminalCopyWith<$Res> + implements $VeilidFFIConfigLoggingTerminalCopyWith<$Res> { + factory _$$_VeilidFFIConfigLoggingTerminalCopyWith( + _$_VeilidFFIConfigLoggingTerminal value, + $Res Function(_$_VeilidFFIConfigLoggingTerminal) then) = + __$$_VeilidFFIConfigLoggingTerminalCopyWithImpl<$Res>; + @override + @useResult + $Res call({bool enabled, VeilidConfigLogLevel level}); +} + +/// @nodoc +class __$$_VeilidFFIConfigLoggingTerminalCopyWithImpl<$Res> + extends _$VeilidFFIConfigLoggingTerminalCopyWithImpl<$Res, + _$_VeilidFFIConfigLoggingTerminal> + implements _$$_VeilidFFIConfigLoggingTerminalCopyWith<$Res> { + __$$_VeilidFFIConfigLoggingTerminalCopyWithImpl( + _$_VeilidFFIConfigLoggingTerminal _value, + $Res Function(_$_VeilidFFIConfigLoggingTerminal) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? enabled = null, + Object? level = null, + }) { + return _then(_$_VeilidFFIConfigLoggingTerminal( + enabled: null == enabled + ? _value.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + level: null == level + ? _value.level + : level // ignore: cast_nullable_to_non_nullable + as VeilidConfigLogLevel, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_VeilidFFIConfigLoggingTerminal + with DiagnosticableTreeMixin + implements _VeilidFFIConfigLoggingTerminal { + const _$_VeilidFFIConfigLoggingTerminal( + {required this.enabled, required this.level}); + + factory _$_VeilidFFIConfigLoggingTerminal.fromJson( + Map json) => + _$$_VeilidFFIConfigLoggingTerminalFromJson(json); + + @override + final bool enabled; + @override + final VeilidConfigLogLevel level; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'VeilidFFIConfigLoggingTerminal(enabled: $enabled, level: $level)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'VeilidFFIConfigLoggingTerminal')) + ..add(DiagnosticsProperty('enabled', enabled)) + ..add(DiagnosticsProperty('level', level)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_VeilidFFIConfigLoggingTerminal && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.level, level) || other.level == level)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, enabled, level); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_VeilidFFIConfigLoggingTerminalCopyWith<_$_VeilidFFIConfigLoggingTerminal> + get copyWith => __$$_VeilidFFIConfigLoggingTerminalCopyWithImpl< + _$_VeilidFFIConfigLoggingTerminal>(this, _$identity); + + @override + Map toJson() { + return _$$_VeilidFFIConfigLoggingTerminalToJson( + this, + ); + } +} + +abstract class _VeilidFFIConfigLoggingTerminal + implements VeilidFFIConfigLoggingTerminal { + const factory _VeilidFFIConfigLoggingTerminal( + {required final bool enabled, + required final VeilidConfigLogLevel level}) = + _$_VeilidFFIConfigLoggingTerminal; + + factory _VeilidFFIConfigLoggingTerminal.fromJson(Map json) = + _$_VeilidFFIConfigLoggingTerminal.fromJson; + + @override + bool get enabled; + @override + VeilidConfigLogLevel get level; + @override + @JsonKey(ignore: true) + _$$_VeilidFFIConfigLoggingTerminalCopyWith<_$_VeilidFFIConfigLoggingTerminal> + get copyWith => throw _privateConstructorUsedError; +} + +VeilidFFIConfigLoggingOtlp _$VeilidFFIConfigLoggingOtlpFromJson( + Map json) { + return _VeilidFFIConfigLoggingOtlp.fromJson(json); +} + +/// @nodoc +mixin _$VeilidFFIConfigLoggingOtlp { + bool get enabled => throw _privateConstructorUsedError; + VeilidConfigLogLevel get level => throw _privateConstructorUsedError; + String get grpcEndpoint => throw _privateConstructorUsedError; + String get serviceName => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $VeilidFFIConfigLoggingOtlpCopyWith + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VeilidFFIConfigLoggingOtlpCopyWith<$Res> { + factory $VeilidFFIConfigLoggingOtlpCopyWith(VeilidFFIConfigLoggingOtlp value, + $Res Function(VeilidFFIConfigLoggingOtlp) then) = + _$VeilidFFIConfigLoggingOtlpCopyWithImpl<$Res, + VeilidFFIConfigLoggingOtlp>; + @useResult + $Res call( + {bool enabled, + VeilidConfigLogLevel level, + String grpcEndpoint, + String serviceName}); +} + +/// @nodoc +class _$VeilidFFIConfigLoggingOtlpCopyWithImpl<$Res, + $Val extends VeilidFFIConfigLoggingOtlp> + implements $VeilidFFIConfigLoggingOtlpCopyWith<$Res> { + _$VeilidFFIConfigLoggingOtlpCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? enabled = null, + Object? level = null, + Object? grpcEndpoint = null, + Object? serviceName = null, + }) { + return _then(_value.copyWith( + enabled: null == enabled + ? _value.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + level: null == level + ? _value.level + : level // ignore: cast_nullable_to_non_nullable + as VeilidConfigLogLevel, + grpcEndpoint: null == grpcEndpoint + ? _value.grpcEndpoint + : grpcEndpoint // ignore: cast_nullable_to_non_nullable + as String, + serviceName: null == serviceName + ? _value.serviceName + : serviceName // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_VeilidFFIConfigLoggingOtlpCopyWith<$Res> + implements $VeilidFFIConfigLoggingOtlpCopyWith<$Res> { + factory _$$_VeilidFFIConfigLoggingOtlpCopyWith( + _$_VeilidFFIConfigLoggingOtlp value, + $Res Function(_$_VeilidFFIConfigLoggingOtlp) then) = + __$$_VeilidFFIConfigLoggingOtlpCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {bool enabled, + VeilidConfigLogLevel level, + String grpcEndpoint, + String serviceName}); +} + +/// @nodoc +class __$$_VeilidFFIConfigLoggingOtlpCopyWithImpl<$Res> + extends _$VeilidFFIConfigLoggingOtlpCopyWithImpl<$Res, + _$_VeilidFFIConfigLoggingOtlp> + implements _$$_VeilidFFIConfigLoggingOtlpCopyWith<$Res> { + __$$_VeilidFFIConfigLoggingOtlpCopyWithImpl( + _$_VeilidFFIConfigLoggingOtlp _value, + $Res Function(_$_VeilidFFIConfigLoggingOtlp) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? enabled = null, + Object? level = null, + Object? grpcEndpoint = null, + Object? serviceName = null, + }) { + return _then(_$_VeilidFFIConfigLoggingOtlp( + enabled: null == enabled + ? _value.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + level: null == level + ? _value.level + : level // ignore: cast_nullable_to_non_nullable + as VeilidConfigLogLevel, + grpcEndpoint: null == grpcEndpoint + ? _value.grpcEndpoint + : grpcEndpoint // ignore: cast_nullable_to_non_nullable + as String, + serviceName: null == serviceName + ? _value.serviceName + : serviceName // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_VeilidFFIConfigLoggingOtlp + with DiagnosticableTreeMixin + implements _VeilidFFIConfigLoggingOtlp { + const _$_VeilidFFIConfigLoggingOtlp( + {required this.enabled, + required this.level, + required this.grpcEndpoint, + required this.serviceName}); + + factory _$_VeilidFFIConfigLoggingOtlp.fromJson(Map json) => + _$$_VeilidFFIConfigLoggingOtlpFromJson(json); + + @override + final bool enabled; + @override + final VeilidConfigLogLevel level; + @override + final String grpcEndpoint; + @override + final String serviceName; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'VeilidFFIConfigLoggingOtlp(enabled: $enabled, level: $level, grpcEndpoint: $grpcEndpoint, serviceName: $serviceName)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'VeilidFFIConfigLoggingOtlp')) + ..add(DiagnosticsProperty('enabled', enabled)) + ..add(DiagnosticsProperty('level', level)) + ..add(DiagnosticsProperty('grpcEndpoint', grpcEndpoint)) + ..add(DiagnosticsProperty('serviceName', serviceName)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_VeilidFFIConfigLoggingOtlp && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.level, level) || other.level == level) && + (identical(other.grpcEndpoint, grpcEndpoint) || + other.grpcEndpoint == grpcEndpoint) && + (identical(other.serviceName, serviceName) || + other.serviceName == serviceName)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => + Object.hash(runtimeType, enabled, level, grpcEndpoint, serviceName); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_VeilidFFIConfigLoggingOtlpCopyWith<_$_VeilidFFIConfigLoggingOtlp> + get copyWith => __$$_VeilidFFIConfigLoggingOtlpCopyWithImpl< + _$_VeilidFFIConfigLoggingOtlp>(this, _$identity); + + @override + Map toJson() { + return _$$_VeilidFFIConfigLoggingOtlpToJson( + this, + ); + } +} + +abstract class _VeilidFFIConfigLoggingOtlp + implements VeilidFFIConfigLoggingOtlp { + const factory _VeilidFFIConfigLoggingOtlp( + {required final bool enabled, + required final VeilidConfigLogLevel level, + required final String grpcEndpoint, + required final String serviceName}) = _$_VeilidFFIConfigLoggingOtlp; + + factory _VeilidFFIConfigLoggingOtlp.fromJson(Map json) = + _$_VeilidFFIConfigLoggingOtlp.fromJson; + + @override + bool get enabled; + @override + VeilidConfigLogLevel get level; + @override + String get grpcEndpoint; + @override + String get serviceName; + @override + @JsonKey(ignore: true) + _$$_VeilidFFIConfigLoggingOtlpCopyWith<_$_VeilidFFIConfigLoggingOtlp> + get copyWith => throw _privateConstructorUsedError; +} + +VeilidFFIConfigLoggingApi _$VeilidFFIConfigLoggingApiFromJson( + Map json) { + return _VeilidFFIConfigLoggingApi.fromJson(json); +} + +/// @nodoc +mixin _$VeilidFFIConfigLoggingApi { + bool get enabled => throw _privateConstructorUsedError; + VeilidConfigLogLevel get level => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $VeilidFFIConfigLoggingApiCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VeilidFFIConfigLoggingApiCopyWith<$Res> { + factory $VeilidFFIConfigLoggingApiCopyWith(VeilidFFIConfigLoggingApi value, + $Res Function(VeilidFFIConfigLoggingApi) then) = + _$VeilidFFIConfigLoggingApiCopyWithImpl<$Res, VeilidFFIConfigLoggingApi>; + @useResult + $Res call({bool enabled, VeilidConfigLogLevel level}); +} + +/// @nodoc +class _$VeilidFFIConfigLoggingApiCopyWithImpl<$Res, + $Val extends VeilidFFIConfigLoggingApi> + implements $VeilidFFIConfigLoggingApiCopyWith<$Res> { + _$VeilidFFIConfigLoggingApiCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? enabled = null, + Object? level = null, + }) { + return _then(_value.copyWith( + enabled: null == enabled + ? _value.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + level: null == level + ? _value.level + : level // ignore: cast_nullable_to_non_nullable + as VeilidConfigLogLevel, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_VeilidFFIConfigLoggingApiCopyWith<$Res> + implements $VeilidFFIConfigLoggingApiCopyWith<$Res> { + factory _$$_VeilidFFIConfigLoggingApiCopyWith( + _$_VeilidFFIConfigLoggingApi value, + $Res Function(_$_VeilidFFIConfigLoggingApi) then) = + __$$_VeilidFFIConfigLoggingApiCopyWithImpl<$Res>; + @override + @useResult + $Res call({bool enabled, VeilidConfigLogLevel level}); +} + +/// @nodoc +class __$$_VeilidFFIConfigLoggingApiCopyWithImpl<$Res> + extends _$VeilidFFIConfigLoggingApiCopyWithImpl<$Res, + _$_VeilidFFIConfigLoggingApi> + implements _$$_VeilidFFIConfigLoggingApiCopyWith<$Res> { + __$$_VeilidFFIConfigLoggingApiCopyWithImpl( + _$_VeilidFFIConfigLoggingApi _value, + $Res Function(_$_VeilidFFIConfigLoggingApi) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? enabled = null, + Object? level = null, + }) { + return _then(_$_VeilidFFIConfigLoggingApi( + enabled: null == enabled + ? _value.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + level: null == level + ? _value.level + : level // ignore: cast_nullable_to_non_nullable + as VeilidConfigLogLevel, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_VeilidFFIConfigLoggingApi + with DiagnosticableTreeMixin + implements _VeilidFFIConfigLoggingApi { + const _$_VeilidFFIConfigLoggingApi( + {required this.enabled, required this.level}); + + factory _$_VeilidFFIConfigLoggingApi.fromJson(Map json) => + _$$_VeilidFFIConfigLoggingApiFromJson(json); + + @override + final bool enabled; + @override + final VeilidConfigLogLevel level; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'VeilidFFIConfigLoggingApi(enabled: $enabled, level: $level)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'VeilidFFIConfigLoggingApi')) + ..add(DiagnosticsProperty('enabled', enabled)) + ..add(DiagnosticsProperty('level', level)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_VeilidFFIConfigLoggingApi && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.level, level) || other.level == level)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, enabled, level); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_VeilidFFIConfigLoggingApiCopyWith<_$_VeilidFFIConfigLoggingApi> + get copyWith => __$$_VeilidFFIConfigLoggingApiCopyWithImpl< + _$_VeilidFFIConfigLoggingApi>(this, _$identity); + + @override + Map toJson() { + return _$$_VeilidFFIConfigLoggingApiToJson( + this, + ); + } +} + +abstract class _VeilidFFIConfigLoggingApi implements VeilidFFIConfigLoggingApi { + const factory _VeilidFFIConfigLoggingApi( + {required final bool enabled, + required final VeilidConfigLogLevel level}) = + _$_VeilidFFIConfigLoggingApi; + + factory _VeilidFFIConfigLoggingApi.fromJson(Map json) = + _$_VeilidFFIConfigLoggingApi.fromJson; + + @override + bool get enabled; + @override + VeilidConfigLogLevel get level; + @override + @JsonKey(ignore: true) + _$$_VeilidFFIConfigLoggingApiCopyWith<_$_VeilidFFIConfigLoggingApi> + get copyWith => throw _privateConstructorUsedError; +} + +VeilidFFIConfigLogging _$VeilidFFIConfigLoggingFromJson( + Map json) { + return _VeilidFFIConfigLogging.fromJson(json); +} + +/// @nodoc +mixin _$VeilidFFIConfigLogging { + VeilidFFIConfigLoggingTerminal get terminal => + throw _privateConstructorUsedError; + VeilidFFIConfigLoggingOtlp get otlp => throw _privateConstructorUsedError; + VeilidFFIConfigLoggingApi get api => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $VeilidFFIConfigLoggingCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VeilidFFIConfigLoggingCopyWith<$Res> { + factory $VeilidFFIConfigLoggingCopyWith(VeilidFFIConfigLogging value, + $Res Function(VeilidFFIConfigLogging) then) = + _$VeilidFFIConfigLoggingCopyWithImpl<$Res, VeilidFFIConfigLogging>; + @useResult + $Res call( + {VeilidFFIConfigLoggingTerminal terminal, + VeilidFFIConfigLoggingOtlp otlp, + VeilidFFIConfigLoggingApi api}); + + $VeilidFFIConfigLoggingTerminalCopyWith<$Res> get terminal; + $VeilidFFIConfigLoggingOtlpCopyWith<$Res> get otlp; + $VeilidFFIConfigLoggingApiCopyWith<$Res> get api; +} + +/// @nodoc +class _$VeilidFFIConfigLoggingCopyWithImpl<$Res, + $Val extends VeilidFFIConfigLogging> + implements $VeilidFFIConfigLoggingCopyWith<$Res> { + _$VeilidFFIConfigLoggingCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? terminal = null, + Object? otlp = null, + Object? api = null, + }) { + return _then(_value.copyWith( + terminal: null == terminal + ? _value.terminal + : terminal // ignore: cast_nullable_to_non_nullable + as VeilidFFIConfigLoggingTerminal, + otlp: null == otlp + ? _value.otlp + : otlp // ignore: cast_nullable_to_non_nullable + as VeilidFFIConfigLoggingOtlp, + api: null == api + ? _value.api + : api // ignore: cast_nullable_to_non_nullable + as VeilidFFIConfigLoggingApi, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $VeilidFFIConfigLoggingTerminalCopyWith<$Res> get terminal { + return $VeilidFFIConfigLoggingTerminalCopyWith<$Res>(_value.terminal, + (value) { + return _then(_value.copyWith(terminal: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $VeilidFFIConfigLoggingOtlpCopyWith<$Res> get otlp { + return $VeilidFFIConfigLoggingOtlpCopyWith<$Res>(_value.otlp, (value) { + return _then(_value.copyWith(otlp: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $VeilidFFIConfigLoggingApiCopyWith<$Res> get api { + return $VeilidFFIConfigLoggingApiCopyWith<$Res>(_value.api, (value) { + return _then(_value.copyWith(api: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$_VeilidFFIConfigLoggingCopyWith<$Res> + implements $VeilidFFIConfigLoggingCopyWith<$Res> { + factory _$$_VeilidFFIConfigLoggingCopyWith(_$_VeilidFFIConfigLogging value, + $Res Function(_$_VeilidFFIConfigLogging) then) = + __$$_VeilidFFIConfigLoggingCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {VeilidFFIConfigLoggingTerminal terminal, + VeilidFFIConfigLoggingOtlp otlp, + VeilidFFIConfigLoggingApi api}); + + @override + $VeilidFFIConfigLoggingTerminalCopyWith<$Res> get terminal; + @override + $VeilidFFIConfigLoggingOtlpCopyWith<$Res> get otlp; + @override + $VeilidFFIConfigLoggingApiCopyWith<$Res> get api; +} + +/// @nodoc +class __$$_VeilidFFIConfigLoggingCopyWithImpl<$Res> + extends _$VeilidFFIConfigLoggingCopyWithImpl<$Res, + _$_VeilidFFIConfigLogging> + implements _$$_VeilidFFIConfigLoggingCopyWith<$Res> { + __$$_VeilidFFIConfigLoggingCopyWithImpl(_$_VeilidFFIConfigLogging _value, + $Res Function(_$_VeilidFFIConfigLogging) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? terminal = null, + Object? otlp = null, + Object? api = null, + }) { + return _then(_$_VeilidFFIConfigLogging( + terminal: null == terminal + ? _value.terminal + : terminal // ignore: cast_nullable_to_non_nullable + as VeilidFFIConfigLoggingTerminal, + otlp: null == otlp + ? _value.otlp + : otlp // ignore: cast_nullable_to_non_nullable + as VeilidFFIConfigLoggingOtlp, + api: null == api + ? _value.api + : api // ignore: cast_nullable_to_non_nullable + as VeilidFFIConfigLoggingApi, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_VeilidFFIConfigLogging + with DiagnosticableTreeMixin + implements _VeilidFFIConfigLogging { + const _$_VeilidFFIConfigLogging( + {required this.terminal, required this.otlp, required this.api}); + + factory _$_VeilidFFIConfigLogging.fromJson(Map json) => + _$$_VeilidFFIConfigLoggingFromJson(json); + + @override + final VeilidFFIConfigLoggingTerminal terminal; + @override + final VeilidFFIConfigLoggingOtlp otlp; + @override + final VeilidFFIConfigLoggingApi api; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'VeilidFFIConfigLogging(terminal: $terminal, otlp: $otlp, api: $api)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'VeilidFFIConfigLogging')) + ..add(DiagnosticsProperty('terminal', terminal)) + ..add(DiagnosticsProperty('otlp', otlp)) + ..add(DiagnosticsProperty('api', api)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_VeilidFFIConfigLogging && + (identical(other.terminal, terminal) || + other.terminal == terminal) && + (identical(other.otlp, otlp) || other.otlp == otlp) && + (identical(other.api, api) || other.api == api)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, terminal, otlp, api); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_VeilidFFIConfigLoggingCopyWith<_$_VeilidFFIConfigLogging> get copyWith => + __$$_VeilidFFIConfigLoggingCopyWithImpl<_$_VeilidFFIConfigLogging>( + this, _$identity); + + @override + Map toJson() { + return _$$_VeilidFFIConfigLoggingToJson( + this, + ); + } +} + +abstract class _VeilidFFIConfigLogging implements VeilidFFIConfigLogging { + const factory _VeilidFFIConfigLogging( + {required final VeilidFFIConfigLoggingTerminal terminal, + required final VeilidFFIConfigLoggingOtlp otlp, + required final VeilidFFIConfigLoggingApi api}) = + _$_VeilidFFIConfigLogging; + + factory _VeilidFFIConfigLogging.fromJson(Map json) = + _$_VeilidFFIConfigLogging.fromJson; + + @override + VeilidFFIConfigLoggingTerminal get terminal; + @override + VeilidFFIConfigLoggingOtlp get otlp; + @override + VeilidFFIConfigLoggingApi get api; + @override + @JsonKey(ignore: true) + _$$_VeilidFFIConfigLoggingCopyWith<_$_VeilidFFIConfigLogging> get copyWith => + throw _privateConstructorUsedError; +} + +VeilidFFIConfig _$VeilidFFIConfigFromJson(Map json) { + return _VeilidFFIConfig.fromJson(json); +} + +/// @nodoc +mixin _$VeilidFFIConfig { + VeilidFFIConfigLogging get logging => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $VeilidFFIConfigCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VeilidFFIConfigCopyWith<$Res> { + factory $VeilidFFIConfigCopyWith( + VeilidFFIConfig value, $Res Function(VeilidFFIConfig) then) = + _$VeilidFFIConfigCopyWithImpl<$Res, VeilidFFIConfig>; + @useResult + $Res call({VeilidFFIConfigLogging logging}); + + $VeilidFFIConfigLoggingCopyWith<$Res> get logging; +} + +/// @nodoc +class _$VeilidFFIConfigCopyWithImpl<$Res, $Val extends VeilidFFIConfig> + implements $VeilidFFIConfigCopyWith<$Res> { + _$VeilidFFIConfigCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? logging = null, + }) { + return _then(_value.copyWith( + logging: null == logging + ? _value.logging + : logging // ignore: cast_nullable_to_non_nullable + as VeilidFFIConfigLogging, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $VeilidFFIConfigLoggingCopyWith<$Res> get logging { + return $VeilidFFIConfigLoggingCopyWith<$Res>(_value.logging, (value) { + return _then(_value.copyWith(logging: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$_VeilidFFIConfigCopyWith<$Res> + implements $VeilidFFIConfigCopyWith<$Res> { + factory _$$_VeilidFFIConfigCopyWith( + _$_VeilidFFIConfig value, $Res Function(_$_VeilidFFIConfig) then) = + __$$_VeilidFFIConfigCopyWithImpl<$Res>; + @override + @useResult + $Res call({VeilidFFIConfigLogging logging}); + + @override + $VeilidFFIConfigLoggingCopyWith<$Res> get logging; +} + +/// @nodoc +class __$$_VeilidFFIConfigCopyWithImpl<$Res> + extends _$VeilidFFIConfigCopyWithImpl<$Res, _$_VeilidFFIConfig> + implements _$$_VeilidFFIConfigCopyWith<$Res> { + __$$_VeilidFFIConfigCopyWithImpl( + _$_VeilidFFIConfig _value, $Res Function(_$_VeilidFFIConfig) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? logging = null, + }) { + return _then(_$_VeilidFFIConfig( + logging: null == logging + ? _value.logging + : logging // ignore: cast_nullable_to_non_nullable + as VeilidFFIConfigLogging, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_VeilidFFIConfig + with DiagnosticableTreeMixin + implements _VeilidFFIConfig { + const _$_VeilidFFIConfig({required this.logging}); + + factory _$_VeilidFFIConfig.fromJson(Map json) => + _$$_VeilidFFIConfigFromJson(json); + + @override + final VeilidFFIConfigLogging logging; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'VeilidFFIConfig(logging: $logging)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'VeilidFFIConfig')) + ..add(DiagnosticsProperty('logging', logging)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_VeilidFFIConfig && + (identical(other.logging, logging) || other.logging == logging)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, logging); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_VeilidFFIConfigCopyWith<_$_VeilidFFIConfig> get copyWith => + __$$_VeilidFFIConfigCopyWithImpl<_$_VeilidFFIConfig>(this, _$identity); + + @override + Map toJson() { + return _$$_VeilidFFIConfigToJson( + this, + ); + } +} + +abstract class _VeilidFFIConfig implements VeilidFFIConfig { + const factory _VeilidFFIConfig( + {required final VeilidFFIConfigLogging logging}) = _$_VeilidFFIConfig; + + factory _VeilidFFIConfig.fromJson(Map json) = + _$_VeilidFFIConfig.fromJson; + + @override + VeilidFFIConfigLogging get logging; + @override + @JsonKey(ignore: true) + _$$_VeilidFFIConfigCopyWith<_$_VeilidFFIConfig> get copyWith => + throw _privateConstructorUsedError; +} + +VeilidWASMConfigLoggingPerformance _$VeilidWASMConfigLoggingPerformanceFromJson( + Map json) { + return _VeilidWASMConfigLoggingPerformance.fromJson(json); +} + +/// @nodoc +mixin _$VeilidWASMConfigLoggingPerformance { + bool get enabled => throw _privateConstructorUsedError; + VeilidConfigLogLevel get level => throw _privateConstructorUsedError; + bool get logsInTimings => throw _privateConstructorUsedError; + bool get logsInConsole => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $VeilidWASMConfigLoggingPerformanceCopyWith< + VeilidWASMConfigLoggingPerformance> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VeilidWASMConfigLoggingPerformanceCopyWith<$Res> { + factory $VeilidWASMConfigLoggingPerformanceCopyWith( + VeilidWASMConfigLoggingPerformance value, + $Res Function(VeilidWASMConfigLoggingPerformance) then) = + _$VeilidWASMConfigLoggingPerformanceCopyWithImpl<$Res, + VeilidWASMConfigLoggingPerformance>; + @useResult + $Res call( + {bool enabled, + VeilidConfigLogLevel level, + bool logsInTimings, + bool logsInConsole}); +} + +/// @nodoc +class _$VeilidWASMConfigLoggingPerformanceCopyWithImpl<$Res, + $Val extends VeilidWASMConfigLoggingPerformance> + implements $VeilidWASMConfigLoggingPerformanceCopyWith<$Res> { + _$VeilidWASMConfigLoggingPerformanceCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? enabled = null, + Object? level = null, + Object? logsInTimings = null, + Object? logsInConsole = null, + }) { + return _then(_value.copyWith( + enabled: null == enabled + ? _value.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + level: null == level + ? _value.level + : level // ignore: cast_nullable_to_non_nullable + as VeilidConfigLogLevel, + logsInTimings: null == logsInTimings + ? _value.logsInTimings + : logsInTimings // ignore: cast_nullable_to_non_nullable + as bool, + logsInConsole: null == logsInConsole + ? _value.logsInConsole + : logsInConsole // ignore: cast_nullable_to_non_nullable + as bool, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_VeilidWASMConfigLoggingPerformanceCopyWith<$Res> + implements $VeilidWASMConfigLoggingPerformanceCopyWith<$Res> { + factory _$$_VeilidWASMConfigLoggingPerformanceCopyWith( + _$_VeilidWASMConfigLoggingPerformance value, + $Res Function(_$_VeilidWASMConfigLoggingPerformance) then) = + __$$_VeilidWASMConfigLoggingPerformanceCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {bool enabled, + VeilidConfigLogLevel level, + bool logsInTimings, + bool logsInConsole}); +} + +/// @nodoc +class __$$_VeilidWASMConfigLoggingPerformanceCopyWithImpl<$Res> + extends _$VeilidWASMConfigLoggingPerformanceCopyWithImpl<$Res, + _$_VeilidWASMConfigLoggingPerformance> + implements _$$_VeilidWASMConfigLoggingPerformanceCopyWith<$Res> { + __$$_VeilidWASMConfigLoggingPerformanceCopyWithImpl( + _$_VeilidWASMConfigLoggingPerformance _value, + $Res Function(_$_VeilidWASMConfigLoggingPerformance) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? enabled = null, + Object? level = null, + Object? logsInTimings = null, + Object? logsInConsole = null, + }) { + return _then(_$_VeilidWASMConfigLoggingPerformance( + enabled: null == enabled + ? _value.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + level: null == level + ? _value.level + : level // ignore: cast_nullable_to_non_nullable + as VeilidConfigLogLevel, + logsInTimings: null == logsInTimings + ? _value.logsInTimings + : logsInTimings // ignore: cast_nullable_to_non_nullable + as bool, + logsInConsole: null == logsInConsole + ? _value.logsInConsole + : logsInConsole // ignore: cast_nullable_to_non_nullable + as bool, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_VeilidWASMConfigLoggingPerformance + with DiagnosticableTreeMixin + implements _VeilidWASMConfigLoggingPerformance { + const _$_VeilidWASMConfigLoggingPerformance( + {required this.enabled, + required this.level, + required this.logsInTimings, + required this.logsInConsole}); + + factory _$_VeilidWASMConfigLoggingPerformance.fromJson( + Map json) => + _$$_VeilidWASMConfigLoggingPerformanceFromJson(json); + + @override + final bool enabled; + @override + final VeilidConfigLogLevel level; + @override + final bool logsInTimings; + @override + final bool logsInConsole; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'VeilidWASMConfigLoggingPerformance(enabled: $enabled, level: $level, logsInTimings: $logsInTimings, logsInConsole: $logsInConsole)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'VeilidWASMConfigLoggingPerformance')) + ..add(DiagnosticsProperty('enabled', enabled)) + ..add(DiagnosticsProperty('level', level)) + ..add(DiagnosticsProperty('logsInTimings', logsInTimings)) + ..add(DiagnosticsProperty('logsInConsole', logsInConsole)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_VeilidWASMConfigLoggingPerformance && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.level, level) || other.level == level) && + (identical(other.logsInTimings, logsInTimings) || + other.logsInTimings == logsInTimings) && + (identical(other.logsInConsole, logsInConsole) || + other.logsInConsole == logsInConsole)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => + Object.hash(runtimeType, enabled, level, logsInTimings, logsInConsole); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_VeilidWASMConfigLoggingPerformanceCopyWith< + _$_VeilidWASMConfigLoggingPerformance> + get copyWith => __$$_VeilidWASMConfigLoggingPerformanceCopyWithImpl< + _$_VeilidWASMConfigLoggingPerformance>(this, _$identity); + + @override + Map toJson() { + return _$$_VeilidWASMConfigLoggingPerformanceToJson( + this, + ); + } +} + +abstract class _VeilidWASMConfigLoggingPerformance + implements VeilidWASMConfigLoggingPerformance { + const factory _VeilidWASMConfigLoggingPerformance( + {required final bool enabled, + required final VeilidConfigLogLevel level, + required final bool logsInTimings, + required final bool logsInConsole}) = + _$_VeilidWASMConfigLoggingPerformance; + + factory _VeilidWASMConfigLoggingPerformance.fromJson( + Map json) = + _$_VeilidWASMConfigLoggingPerformance.fromJson; + + @override + bool get enabled; + @override + VeilidConfigLogLevel get level; + @override + bool get logsInTimings; + @override + bool get logsInConsole; + @override + @JsonKey(ignore: true) + _$$_VeilidWASMConfigLoggingPerformanceCopyWith< + _$_VeilidWASMConfigLoggingPerformance> + get copyWith => throw _privateConstructorUsedError; +} + +VeilidWASMConfigLoggingApi _$VeilidWASMConfigLoggingApiFromJson( + Map json) { + return _VeilidWASMConfigLoggingApi.fromJson(json); +} + +/// @nodoc +mixin _$VeilidWASMConfigLoggingApi { + bool get enabled => throw _privateConstructorUsedError; + VeilidConfigLogLevel get level => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $VeilidWASMConfigLoggingApiCopyWith + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VeilidWASMConfigLoggingApiCopyWith<$Res> { + factory $VeilidWASMConfigLoggingApiCopyWith(VeilidWASMConfigLoggingApi value, + $Res Function(VeilidWASMConfigLoggingApi) then) = + _$VeilidWASMConfigLoggingApiCopyWithImpl<$Res, + VeilidWASMConfigLoggingApi>; + @useResult + $Res call({bool enabled, VeilidConfigLogLevel level}); +} + +/// @nodoc +class _$VeilidWASMConfigLoggingApiCopyWithImpl<$Res, + $Val extends VeilidWASMConfigLoggingApi> + implements $VeilidWASMConfigLoggingApiCopyWith<$Res> { + _$VeilidWASMConfigLoggingApiCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? enabled = null, + Object? level = null, + }) { + return _then(_value.copyWith( + enabled: null == enabled + ? _value.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + level: null == level + ? _value.level + : level // ignore: cast_nullable_to_non_nullable + as VeilidConfigLogLevel, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_VeilidWASMConfigLoggingApiCopyWith<$Res> + implements $VeilidWASMConfigLoggingApiCopyWith<$Res> { + factory _$$_VeilidWASMConfigLoggingApiCopyWith( + _$_VeilidWASMConfigLoggingApi value, + $Res Function(_$_VeilidWASMConfigLoggingApi) then) = + __$$_VeilidWASMConfigLoggingApiCopyWithImpl<$Res>; + @override + @useResult + $Res call({bool enabled, VeilidConfigLogLevel level}); +} + +/// @nodoc +class __$$_VeilidWASMConfigLoggingApiCopyWithImpl<$Res> + extends _$VeilidWASMConfigLoggingApiCopyWithImpl<$Res, + _$_VeilidWASMConfigLoggingApi> + implements _$$_VeilidWASMConfigLoggingApiCopyWith<$Res> { + __$$_VeilidWASMConfigLoggingApiCopyWithImpl( + _$_VeilidWASMConfigLoggingApi _value, + $Res Function(_$_VeilidWASMConfigLoggingApi) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? enabled = null, + Object? level = null, + }) { + return _then(_$_VeilidWASMConfigLoggingApi( + enabled: null == enabled + ? _value.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + level: null == level + ? _value.level + : level // ignore: cast_nullable_to_non_nullable + as VeilidConfigLogLevel, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_VeilidWASMConfigLoggingApi + with DiagnosticableTreeMixin + implements _VeilidWASMConfigLoggingApi { + const _$_VeilidWASMConfigLoggingApi( + {required this.enabled, required this.level}); + + factory _$_VeilidWASMConfigLoggingApi.fromJson(Map json) => + _$$_VeilidWASMConfigLoggingApiFromJson(json); + + @override + final bool enabled; + @override + final VeilidConfigLogLevel level; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'VeilidWASMConfigLoggingApi(enabled: $enabled, level: $level)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'VeilidWASMConfigLoggingApi')) + ..add(DiagnosticsProperty('enabled', enabled)) + ..add(DiagnosticsProperty('level', level)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_VeilidWASMConfigLoggingApi && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.level, level) || other.level == level)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, enabled, level); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_VeilidWASMConfigLoggingApiCopyWith<_$_VeilidWASMConfigLoggingApi> + get copyWith => __$$_VeilidWASMConfigLoggingApiCopyWithImpl< + _$_VeilidWASMConfigLoggingApi>(this, _$identity); + + @override + Map toJson() { + return _$$_VeilidWASMConfigLoggingApiToJson( + this, + ); + } +} + +abstract class _VeilidWASMConfigLoggingApi + implements VeilidWASMConfigLoggingApi { + const factory _VeilidWASMConfigLoggingApi( + {required final bool enabled, + required final VeilidConfigLogLevel level}) = + _$_VeilidWASMConfigLoggingApi; + + factory _VeilidWASMConfigLoggingApi.fromJson(Map json) = + _$_VeilidWASMConfigLoggingApi.fromJson; + + @override + bool get enabled; + @override + VeilidConfigLogLevel get level; + @override + @JsonKey(ignore: true) + _$$_VeilidWASMConfigLoggingApiCopyWith<_$_VeilidWASMConfigLoggingApi> + get copyWith => throw _privateConstructorUsedError; +} + +VeilidWASMConfigLogging _$VeilidWASMConfigLoggingFromJson( + Map json) { + return _VeilidWASMConfigLogging.fromJson(json); +} + +/// @nodoc +mixin _$VeilidWASMConfigLogging { + VeilidWASMConfigLoggingPerformance get performance => + throw _privateConstructorUsedError; + VeilidWASMConfigLoggingApi get api => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $VeilidWASMConfigLoggingCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VeilidWASMConfigLoggingCopyWith<$Res> { + factory $VeilidWASMConfigLoggingCopyWith(VeilidWASMConfigLogging value, + $Res Function(VeilidWASMConfigLogging) then) = + _$VeilidWASMConfigLoggingCopyWithImpl<$Res, VeilidWASMConfigLogging>; + @useResult + $Res call( + {VeilidWASMConfigLoggingPerformance performance, + VeilidWASMConfigLoggingApi api}); + + $VeilidWASMConfigLoggingPerformanceCopyWith<$Res> get performance; + $VeilidWASMConfigLoggingApiCopyWith<$Res> get api; +} + +/// @nodoc +class _$VeilidWASMConfigLoggingCopyWithImpl<$Res, + $Val extends VeilidWASMConfigLogging> + implements $VeilidWASMConfigLoggingCopyWith<$Res> { + _$VeilidWASMConfigLoggingCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? performance = null, + Object? api = null, + }) { + return _then(_value.copyWith( + performance: null == performance + ? _value.performance + : performance // ignore: cast_nullable_to_non_nullable + as VeilidWASMConfigLoggingPerformance, + api: null == api + ? _value.api + : api // ignore: cast_nullable_to_non_nullable + as VeilidWASMConfigLoggingApi, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $VeilidWASMConfigLoggingPerformanceCopyWith<$Res> get performance { + return $VeilidWASMConfigLoggingPerformanceCopyWith<$Res>(_value.performance, + (value) { + return _then(_value.copyWith(performance: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $VeilidWASMConfigLoggingApiCopyWith<$Res> get api { + return $VeilidWASMConfigLoggingApiCopyWith<$Res>(_value.api, (value) { + return _then(_value.copyWith(api: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$_VeilidWASMConfigLoggingCopyWith<$Res> + implements $VeilidWASMConfigLoggingCopyWith<$Res> { + factory _$$_VeilidWASMConfigLoggingCopyWith(_$_VeilidWASMConfigLogging value, + $Res Function(_$_VeilidWASMConfigLogging) then) = + __$$_VeilidWASMConfigLoggingCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {VeilidWASMConfigLoggingPerformance performance, + VeilidWASMConfigLoggingApi api}); + + @override + $VeilidWASMConfigLoggingPerformanceCopyWith<$Res> get performance; + @override + $VeilidWASMConfigLoggingApiCopyWith<$Res> get api; +} + +/// @nodoc +class __$$_VeilidWASMConfigLoggingCopyWithImpl<$Res> + extends _$VeilidWASMConfigLoggingCopyWithImpl<$Res, + _$_VeilidWASMConfigLogging> + implements _$$_VeilidWASMConfigLoggingCopyWith<$Res> { + __$$_VeilidWASMConfigLoggingCopyWithImpl(_$_VeilidWASMConfigLogging _value, + $Res Function(_$_VeilidWASMConfigLogging) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? performance = null, + Object? api = null, + }) { + return _then(_$_VeilidWASMConfigLogging( + performance: null == performance + ? _value.performance + : performance // ignore: cast_nullable_to_non_nullable + as VeilidWASMConfigLoggingPerformance, + api: null == api + ? _value.api + : api // ignore: cast_nullable_to_non_nullable + as VeilidWASMConfigLoggingApi, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_VeilidWASMConfigLogging + with DiagnosticableTreeMixin + implements _VeilidWASMConfigLogging { + const _$_VeilidWASMConfigLogging( + {required this.performance, required this.api}); + + factory _$_VeilidWASMConfigLogging.fromJson(Map json) => + _$$_VeilidWASMConfigLoggingFromJson(json); + + @override + final VeilidWASMConfigLoggingPerformance performance; + @override + final VeilidWASMConfigLoggingApi api; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'VeilidWASMConfigLogging(performance: $performance, api: $api)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'VeilidWASMConfigLogging')) + ..add(DiagnosticsProperty('performance', performance)) + ..add(DiagnosticsProperty('api', api)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_VeilidWASMConfigLogging && + (identical(other.performance, performance) || + other.performance == performance) && + (identical(other.api, api) || other.api == api)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, performance, api); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_VeilidWASMConfigLoggingCopyWith<_$_VeilidWASMConfigLogging> + get copyWith => + __$$_VeilidWASMConfigLoggingCopyWithImpl<_$_VeilidWASMConfigLogging>( + this, _$identity); + + @override + Map toJson() { + return _$$_VeilidWASMConfigLoggingToJson( + this, + ); + } +} + +abstract class _VeilidWASMConfigLogging implements VeilidWASMConfigLogging { + const factory _VeilidWASMConfigLogging( + {required final VeilidWASMConfigLoggingPerformance performance, + required final VeilidWASMConfigLoggingApi api}) = + _$_VeilidWASMConfigLogging; + + factory _VeilidWASMConfigLogging.fromJson(Map json) = + _$_VeilidWASMConfigLogging.fromJson; + + @override + VeilidWASMConfigLoggingPerformance get performance; + @override + VeilidWASMConfigLoggingApi get api; + @override + @JsonKey(ignore: true) + _$$_VeilidWASMConfigLoggingCopyWith<_$_VeilidWASMConfigLogging> + get copyWith => throw _privateConstructorUsedError; +} + +VeilidWASMConfig _$VeilidWASMConfigFromJson(Map json) { + return _VeilidWASMConfig.fromJson(json); +} + +/// @nodoc +mixin _$VeilidWASMConfig { + VeilidWASMConfigLogging get logging => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $VeilidWASMConfigCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VeilidWASMConfigCopyWith<$Res> { + factory $VeilidWASMConfigCopyWith( + VeilidWASMConfig value, $Res Function(VeilidWASMConfig) then) = + _$VeilidWASMConfigCopyWithImpl<$Res, VeilidWASMConfig>; + @useResult + $Res call({VeilidWASMConfigLogging logging}); + + $VeilidWASMConfigLoggingCopyWith<$Res> get logging; +} + +/// @nodoc +class _$VeilidWASMConfigCopyWithImpl<$Res, $Val extends VeilidWASMConfig> + implements $VeilidWASMConfigCopyWith<$Res> { + _$VeilidWASMConfigCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? logging = null, + }) { + return _then(_value.copyWith( + logging: null == logging + ? _value.logging + : logging // ignore: cast_nullable_to_non_nullable + as VeilidWASMConfigLogging, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $VeilidWASMConfigLoggingCopyWith<$Res> get logging { + return $VeilidWASMConfigLoggingCopyWith<$Res>(_value.logging, (value) { + return _then(_value.copyWith(logging: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$_VeilidWASMConfigCopyWith<$Res> + implements $VeilidWASMConfigCopyWith<$Res> { + factory _$$_VeilidWASMConfigCopyWith( + _$_VeilidWASMConfig value, $Res Function(_$_VeilidWASMConfig) then) = + __$$_VeilidWASMConfigCopyWithImpl<$Res>; + @override + @useResult + $Res call({VeilidWASMConfigLogging logging}); + + @override + $VeilidWASMConfigLoggingCopyWith<$Res> get logging; +} + +/// @nodoc +class __$$_VeilidWASMConfigCopyWithImpl<$Res> + extends _$VeilidWASMConfigCopyWithImpl<$Res, _$_VeilidWASMConfig> + implements _$$_VeilidWASMConfigCopyWith<$Res> { + __$$_VeilidWASMConfigCopyWithImpl( + _$_VeilidWASMConfig _value, $Res Function(_$_VeilidWASMConfig) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? logging = null, + }) { + return _then(_$_VeilidWASMConfig( + logging: null == logging + ? _value.logging + : logging // ignore: cast_nullable_to_non_nullable + as VeilidWASMConfigLogging, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_VeilidWASMConfig + with DiagnosticableTreeMixin + implements _VeilidWASMConfig { + const _$_VeilidWASMConfig({required this.logging}); + + factory _$_VeilidWASMConfig.fromJson(Map json) => + _$$_VeilidWASMConfigFromJson(json); + + @override + final VeilidWASMConfigLogging logging; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'VeilidWASMConfig(logging: $logging)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'VeilidWASMConfig')) + ..add(DiagnosticsProperty('logging', logging)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_VeilidWASMConfig && + (identical(other.logging, logging) || other.logging == logging)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, logging); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_VeilidWASMConfigCopyWith<_$_VeilidWASMConfig> get copyWith => + __$$_VeilidWASMConfigCopyWithImpl<_$_VeilidWASMConfig>(this, _$identity); + + @override + Map toJson() { + return _$$_VeilidWASMConfigToJson( + this, + ); + } +} + +abstract class _VeilidWASMConfig implements VeilidWASMConfig { + const factory _VeilidWASMConfig( + {required final VeilidWASMConfigLogging logging}) = _$_VeilidWASMConfig; + + factory _VeilidWASMConfig.fromJson(Map json) = + _$_VeilidWASMConfig.fromJson; + + @override + VeilidWASMConfigLogging get logging; + @override + @JsonKey(ignore: true) + _$$_VeilidWASMConfigCopyWith<_$_VeilidWASMConfig> get copyWith => + throw _privateConstructorUsedError; +} + +VeilidConfigHTTPS _$VeilidConfigHTTPSFromJson(Map json) { + return _VeilidConfigHTTPS.fromJson(json); +} + +/// @nodoc +mixin _$VeilidConfigHTTPS { + bool get enabled => throw _privateConstructorUsedError; + String get listenAddress => throw _privateConstructorUsedError; + String get path => throw _privateConstructorUsedError; + String? get url => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $VeilidConfigHTTPSCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VeilidConfigHTTPSCopyWith<$Res> { + factory $VeilidConfigHTTPSCopyWith( + VeilidConfigHTTPS value, $Res Function(VeilidConfigHTTPS) then) = + _$VeilidConfigHTTPSCopyWithImpl<$Res, VeilidConfigHTTPS>; + @useResult + $Res call({bool enabled, String listenAddress, String path, String? url}); +} + +/// @nodoc +class _$VeilidConfigHTTPSCopyWithImpl<$Res, $Val extends VeilidConfigHTTPS> + implements $VeilidConfigHTTPSCopyWith<$Res> { + _$VeilidConfigHTTPSCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? enabled = null, + Object? listenAddress = null, + Object? path = null, + Object? url = freezed, + }) { + return _then(_value.copyWith( + enabled: null == enabled + ? _value.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + listenAddress: null == listenAddress + ? _value.listenAddress + : listenAddress // ignore: cast_nullable_to_non_nullable + as String, + path: null == path + ? _value.path + : path // ignore: cast_nullable_to_non_nullable + as String, + url: freezed == url + ? _value.url + : url // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_VeilidConfigHTTPSCopyWith<$Res> + implements $VeilidConfigHTTPSCopyWith<$Res> { + factory _$$_VeilidConfigHTTPSCopyWith(_$_VeilidConfigHTTPS value, + $Res Function(_$_VeilidConfigHTTPS) then) = + __$$_VeilidConfigHTTPSCopyWithImpl<$Res>; + @override + @useResult + $Res call({bool enabled, String listenAddress, String path, String? url}); +} + +/// @nodoc +class __$$_VeilidConfigHTTPSCopyWithImpl<$Res> + extends _$VeilidConfigHTTPSCopyWithImpl<$Res, _$_VeilidConfigHTTPS> + implements _$$_VeilidConfigHTTPSCopyWith<$Res> { + __$$_VeilidConfigHTTPSCopyWithImpl( + _$_VeilidConfigHTTPS _value, $Res Function(_$_VeilidConfigHTTPS) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? enabled = null, + Object? listenAddress = null, + Object? path = null, + Object? url = freezed, + }) { + return _then(_$_VeilidConfigHTTPS( + enabled: null == enabled + ? _value.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + listenAddress: null == listenAddress + ? _value.listenAddress + : listenAddress // ignore: cast_nullable_to_non_nullable + as String, + path: null == path + ? _value.path + : path // ignore: cast_nullable_to_non_nullable + as String, + url: freezed == url + ? _value.url + : url // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_VeilidConfigHTTPS + with DiagnosticableTreeMixin + implements _VeilidConfigHTTPS { + const _$_VeilidConfigHTTPS( + {required this.enabled, + required this.listenAddress, + required this.path, + this.url}); + + factory _$_VeilidConfigHTTPS.fromJson(Map json) => + _$$_VeilidConfigHTTPSFromJson(json); + + @override + final bool enabled; + @override + final String listenAddress; + @override + final String path; + @override + final String? url; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'VeilidConfigHTTPS(enabled: $enabled, listenAddress: $listenAddress, path: $path, url: $url)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'VeilidConfigHTTPS')) + ..add(DiagnosticsProperty('enabled', enabled)) + ..add(DiagnosticsProperty('listenAddress', listenAddress)) + ..add(DiagnosticsProperty('path', path)) + ..add(DiagnosticsProperty('url', url)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_VeilidConfigHTTPS && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.listenAddress, listenAddress) || + other.listenAddress == listenAddress) && + (identical(other.path, path) || other.path == path) && + (identical(other.url, url) || other.url == url)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => + Object.hash(runtimeType, enabled, listenAddress, path, url); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_VeilidConfigHTTPSCopyWith<_$_VeilidConfigHTTPS> get copyWith => + __$$_VeilidConfigHTTPSCopyWithImpl<_$_VeilidConfigHTTPS>( + this, _$identity); + + @override + Map toJson() { + return _$$_VeilidConfigHTTPSToJson( + this, + ); + } +} + +abstract class _VeilidConfigHTTPS implements VeilidConfigHTTPS { + const factory _VeilidConfigHTTPS( + {required final bool enabled, + required final String listenAddress, + required final String path, + final String? url}) = _$_VeilidConfigHTTPS; + + factory _VeilidConfigHTTPS.fromJson(Map json) = + _$_VeilidConfigHTTPS.fromJson; + + @override + bool get enabled; + @override + String get listenAddress; + @override + String get path; + @override + String? get url; + @override + @JsonKey(ignore: true) + _$$_VeilidConfigHTTPSCopyWith<_$_VeilidConfigHTTPS> get copyWith => + throw _privateConstructorUsedError; +} + +VeilidConfigHTTP _$VeilidConfigHTTPFromJson(Map json) { + return _VeilidConfigHTTP.fromJson(json); +} + +/// @nodoc +mixin _$VeilidConfigHTTP { + bool get enabled => throw _privateConstructorUsedError; + String get listenAddress => throw _privateConstructorUsedError; + String get path => throw _privateConstructorUsedError; + String? get url => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $VeilidConfigHTTPCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VeilidConfigHTTPCopyWith<$Res> { + factory $VeilidConfigHTTPCopyWith( + VeilidConfigHTTP value, $Res Function(VeilidConfigHTTP) then) = + _$VeilidConfigHTTPCopyWithImpl<$Res, VeilidConfigHTTP>; + @useResult + $Res call({bool enabled, String listenAddress, String path, String? url}); +} + +/// @nodoc +class _$VeilidConfigHTTPCopyWithImpl<$Res, $Val extends VeilidConfigHTTP> + implements $VeilidConfigHTTPCopyWith<$Res> { + _$VeilidConfigHTTPCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? enabled = null, + Object? listenAddress = null, + Object? path = null, + Object? url = freezed, + }) { + return _then(_value.copyWith( + enabled: null == enabled + ? _value.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + listenAddress: null == listenAddress + ? _value.listenAddress + : listenAddress // ignore: cast_nullable_to_non_nullable + as String, + path: null == path + ? _value.path + : path // ignore: cast_nullable_to_non_nullable + as String, + url: freezed == url + ? _value.url + : url // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_VeilidConfigHTTPCopyWith<$Res> + implements $VeilidConfigHTTPCopyWith<$Res> { + factory _$$_VeilidConfigHTTPCopyWith( + _$_VeilidConfigHTTP value, $Res Function(_$_VeilidConfigHTTP) then) = + __$$_VeilidConfigHTTPCopyWithImpl<$Res>; + @override + @useResult + $Res call({bool enabled, String listenAddress, String path, String? url}); +} + +/// @nodoc +class __$$_VeilidConfigHTTPCopyWithImpl<$Res> + extends _$VeilidConfigHTTPCopyWithImpl<$Res, _$_VeilidConfigHTTP> + implements _$$_VeilidConfigHTTPCopyWith<$Res> { + __$$_VeilidConfigHTTPCopyWithImpl( + _$_VeilidConfigHTTP _value, $Res Function(_$_VeilidConfigHTTP) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? enabled = null, + Object? listenAddress = null, + Object? path = null, + Object? url = freezed, + }) { + return _then(_$_VeilidConfigHTTP( + enabled: null == enabled + ? _value.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + listenAddress: null == listenAddress + ? _value.listenAddress + : listenAddress // ignore: cast_nullable_to_non_nullable + as String, + path: null == path + ? _value.path + : path // ignore: cast_nullable_to_non_nullable + as String, + url: freezed == url + ? _value.url + : url // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_VeilidConfigHTTP + with DiagnosticableTreeMixin + implements _VeilidConfigHTTP { + const _$_VeilidConfigHTTP( + {required this.enabled, + required this.listenAddress, + required this.path, + this.url}); + + factory _$_VeilidConfigHTTP.fromJson(Map json) => + _$$_VeilidConfigHTTPFromJson(json); + + @override + final bool enabled; + @override + final String listenAddress; + @override + final String path; + @override + final String? url; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'VeilidConfigHTTP(enabled: $enabled, listenAddress: $listenAddress, path: $path, url: $url)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'VeilidConfigHTTP')) + ..add(DiagnosticsProperty('enabled', enabled)) + ..add(DiagnosticsProperty('listenAddress', listenAddress)) + ..add(DiagnosticsProperty('path', path)) + ..add(DiagnosticsProperty('url', url)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_VeilidConfigHTTP && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.listenAddress, listenAddress) || + other.listenAddress == listenAddress) && + (identical(other.path, path) || other.path == path) && + (identical(other.url, url) || other.url == url)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => + Object.hash(runtimeType, enabled, listenAddress, path, url); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_VeilidConfigHTTPCopyWith<_$_VeilidConfigHTTP> get copyWith => + __$$_VeilidConfigHTTPCopyWithImpl<_$_VeilidConfigHTTP>(this, _$identity); + + @override + Map toJson() { + return _$$_VeilidConfigHTTPToJson( + this, + ); + } +} + +abstract class _VeilidConfigHTTP implements VeilidConfigHTTP { + const factory _VeilidConfigHTTP( + {required final bool enabled, + required final String listenAddress, + required final String path, + final String? url}) = _$_VeilidConfigHTTP; + + factory _VeilidConfigHTTP.fromJson(Map json) = + _$_VeilidConfigHTTP.fromJson; + + @override + bool get enabled; + @override + String get listenAddress; + @override + String get path; + @override + String? get url; + @override + @JsonKey(ignore: true) + _$$_VeilidConfigHTTPCopyWith<_$_VeilidConfigHTTP> get copyWith => + throw _privateConstructorUsedError; +} + +VeilidConfigApplication _$VeilidConfigApplicationFromJson( + Map json) { + return _VeilidConfigApplication.fromJson(json); +} + +/// @nodoc +mixin _$VeilidConfigApplication { + VeilidConfigHTTPS get https => throw _privateConstructorUsedError; + VeilidConfigHTTP get http => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $VeilidConfigApplicationCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VeilidConfigApplicationCopyWith<$Res> { + factory $VeilidConfigApplicationCopyWith(VeilidConfigApplication value, + $Res Function(VeilidConfigApplication) then) = + _$VeilidConfigApplicationCopyWithImpl<$Res, VeilidConfigApplication>; + @useResult + $Res call({VeilidConfigHTTPS https, VeilidConfigHTTP http}); + + $VeilidConfigHTTPSCopyWith<$Res> get https; + $VeilidConfigHTTPCopyWith<$Res> get http; +} + +/// @nodoc +class _$VeilidConfigApplicationCopyWithImpl<$Res, + $Val extends VeilidConfigApplication> + implements $VeilidConfigApplicationCopyWith<$Res> { + _$VeilidConfigApplicationCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? https = null, + Object? http = null, + }) { + return _then(_value.copyWith( + https: null == https + ? _value.https + : https // ignore: cast_nullable_to_non_nullable + as VeilidConfigHTTPS, + http: null == http + ? _value.http + : http // ignore: cast_nullable_to_non_nullable + as VeilidConfigHTTP, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $VeilidConfigHTTPSCopyWith<$Res> get https { + return $VeilidConfigHTTPSCopyWith<$Res>(_value.https, (value) { + return _then(_value.copyWith(https: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $VeilidConfigHTTPCopyWith<$Res> get http { + return $VeilidConfigHTTPCopyWith<$Res>(_value.http, (value) { + return _then(_value.copyWith(http: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$_VeilidConfigApplicationCopyWith<$Res> + implements $VeilidConfigApplicationCopyWith<$Res> { + factory _$$_VeilidConfigApplicationCopyWith(_$_VeilidConfigApplication value, + $Res Function(_$_VeilidConfigApplication) then) = + __$$_VeilidConfigApplicationCopyWithImpl<$Res>; + @override + @useResult + $Res call({VeilidConfigHTTPS https, VeilidConfigHTTP http}); + + @override + $VeilidConfigHTTPSCopyWith<$Res> get https; + @override + $VeilidConfigHTTPCopyWith<$Res> get http; +} + +/// @nodoc +class __$$_VeilidConfigApplicationCopyWithImpl<$Res> + extends _$VeilidConfigApplicationCopyWithImpl<$Res, + _$_VeilidConfigApplication> + implements _$$_VeilidConfigApplicationCopyWith<$Res> { + __$$_VeilidConfigApplicationCopyWithImpl(_$_VeilidConfigApplication _value, + $Res Function(_$_VeilidConfigApplication) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? https = null, + Object? http = null, + }) { + return _then(_$_VeilidConfigApplication( + https: null == https + ? _value.https + : https // ignore: cast_nullable_to_non_nullable + as VeilidConfigHTTPS, + http: null == http + ? _value.http + : http // ignore: cast_nullable_to_non_nullable + as VeilidConfigHTTP, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_VeilidConfigApplication + with DiagnosticableTreeMixin + implements _VeilidConfigApplication { + const _$_VeilidConfigApplication({required this.https, required this.http}); + + factory _$_VeilidConfigApplication.fromJson(Map json) => + _$$_VeilidConfigApplicationFromJson(json); + + @override + final VeilidConfigHTTPS https; + @override + final VeilidConfigHTTP http; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'VeilidConfigApplication(https: $https, http: $http)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'VeilidConfigApplication')) + ..add(DiagnosticsProperty('https', https)) + ..add(DiagnosticsProperty('http', http)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_VeilidConfigApplication && + (identical(other.https, https) || other.https == https) && + (identical(other.http, http) || other.http == http)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, https, http); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_VeilidConfigApplicationCopyWith<_$_VeilidConfigApplication> + get copyWith => + __$$_VeilidConfigApplicationCopyWithImpl<_$_VeilidConfigApplication>( + this, _$identity); + + @override + Map toJson() { + return _$$_VeilidConfigApplicationToJson( + this, + ); + } +} + +abstract class _VeilidConfigApplication implements VeilidConfigApplication { + const factory _VeilidConfigApplication( + {required final VeilidConfigHTTPS https, + required final VeilidConfigHTTP http}) = _$_VeilidConfigApplication; + + factory _VeilidConfigApplication.fromJson(Map json) = + _$_VeilidConfigApplication.fromJson; + + @override + VeilidConfigHTTPS get https; + @override + VeilidConfigHTTP get http; + @override + @JsonKey(ignore: true) + _$$_VeilidConfigApplicationCopyWith<_$_VeilidConfigApplication> + get copyWith => throw _privateConstructorUsedError; +} + +VeilidConfigUDP _$VeilidConfigUDPFromJson(Map json) { + return _VeilidConfigUDP.fromJson(json); +} + +/// @nodoc +mixin _$VeilidConfigUDP { + bool get enabled => throw _privateConstructorUsedError; + int get socketPoolSize => throw _privateConstructorUsedError; + String get listenAddress => throw _privateConstructorUsedError; + String? get publicAddress => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $VeilidConfigUDPCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VeilidConfigUDPCopyWith<$Res> { + factory $VeilidConfigUDPCopyWith( + VeilidConfigUDP value, $Res Function(VeilidConfigUDP) then) = + _$VeilidConfigUDPCopyWithImpl<$Res, VeilidConfigUDP>; + @useResult + $Res call( + {bool enabled, + int socketPoolSize, + String listenAddress, + String? publicAddress}); +} + +/// @nodoc +class _$VeilidConfigUDPCopyWithImpl<$Res, $Val extends VeilidConfigUDP> + implements $VeilidConfigUDPCopyWith<$Res> { + _$VeilidConfigUDPCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? enabled = null, + Object? socketPoolSize = null, + Object? listenAddress = null, + Object? publicAddress = freezed, + }) { + return _then(_value.copyWith( + enabled: null == enabled + ? _value.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + socketPoolSize: null == socketPoolSize + ? _value.socketPoolSize + : socketPoolSize // ignore: cast_nullable_to_non_nullable + as int, + listenAddress: null == listenAddress + ? _value.listenAddress + : listenAddress // ignore: cast_nullable_to_non_nullable + as String, + publicAddress: freezed == publicAddress + ? _value.publicAddress + : publicAddress // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_VeilidConfigUDPCopyWith<$Res> + implements $VeilidConfigUDPCopyWith<$Res> { + factory _$$_VeilidConfigUDPCopyWith( + _$_VeilidConfigUDP value, $Res Function(_$_VeilidConfigUDP) then) = + __$$_VeilidConfigUDPCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {bool enabled, + int socketPoolSize, + String listenAddress, + String? publicAddress}); +} + +/// @nodoc +class __$$_VeilidConfigUDPCopyWithImpl<$Res> + extends _$VeilidConfigUDPCopyWithImpl<$Res, _$_VeilidConfigUDP> + implements _$$_VeilidConfigUDPCopyWith<$Res> { + __$$_VeilidConfigUDPCopyWithImpl( + _$_VeilidConfigUDP _value, $Res Function(_$_VeilidConfigUDP) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? enabled = null, + Object? socketPoolSize = null, + Object? listenAddress = null, + Object? publicAddress = freezed, + }) { + return _then(_$_VeilidConfigUDP( + enabled: null == enabled + ? _value.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + socketPoolSize: null == socketPoolSize + ? _value.socketPoolSize + : socketPoolSize // ignore: cast_nullable_to_non_nullable + as int, + listenAddress: null == listenAddress + ? _value.listenAddress + : listenAddress // ignore: cast_nullable_to_non_nullable + as String, + publicAddress: freezed == publicAddress + ? _value.publicAddress + : publicAddress // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_VeilidConfigUDP + with DiagnosticableTreeMixin + implements _VeilidConfigUDP { + const _$_VeilidConfigUDP( + {required this.enabled, + required this.socketPoolSize, + required this.listenAddress, + this.publicAddress}); + + factory _$_VeilidConfigUDP.fromJson(Map json) => + _$$_VeilidConfigUDPFromJson(json); + + @override + final bool enabled; + @override + final int socketPoolSize; + @override + final String listenAddress; + @override + final String? publicAddress; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'VeilidConfigUDP(enabled: $enabled, socketPoolSize: $socketPoolSize, listenAddress: $listenAddress, publicAddress: $publicAddress)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'VeilidConfigUDP')) + ..add(DiagnosticsProperty('enabled', enabled)) + ..add(DiagnosticsProperty('socketPoolSize', socketPoolSize)) + ..add(DiagnosticsProperty('listenAddress', listenAddress)) + ..add(DiagnosticsProperty('publicAddress', publicAddress)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_VeilidConfigUDP && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.socketPoolSize, socketPoolSize) || + other.socketPoolSize == socketPoolSize) && + (identical(other.listenAddress, listenAddress) || + other.listenAddress == listenAddress) && + (identical(other.publicAddress, publicAddress) || + other.publicAddress == publicAddress)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, enabled, socketPoolSize, listenAddress, publicAddress); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_VeilidConfigUDPCopyWith<_$_VeilidConfigUDP> get copyWith => + __$$_VeilidConfigUDPCopyWithImpl<_$_VeilidConfigUDP>(this, _$identity); + + @override + Map toJson() { + return _$$_VeilidConfigUDPToJson( + this, + ); + } +} + +abstract class _VeilidConfigUDP implements VeilidConfigUDP { + const factory _VeilidConfigUDP( + {required final bool enabled, + required final int socketPoolSize, + required final String listenAddress, + final String? publicAddress}) = _$_VeilidConfigUDP; + + factory _VeilidConfigUDP.fromJson(Map json) = + _$_VeilidConfigUDP.fromJson; + + @override + bool get enabled; + @override + int get socketPoolSize; + @override + String get listenAddress; + @override + String? get publicAddress; + @override + @JsonKey(ignore: true) + _$$_VeilidConfigUDPCopyWith<_$_VeilidConfigUDP> get copyWith => + throw _privateConstructorUsedError; +} + +VeilidConfigTCP _$VeilidConfigTCPFromJson(Map json) { + return _VeilidConfigTCP.fromJson(json); +} + +/// @nodoc +mixin _$VeilidConfigTCP { + bool get connect => throw _privateConstructorUsedError; + bool get listen => throw _privateConstructorUsedError; + int get maxConnections => throw _privateConstructorUsedError; + String get listenAddress => throw _privateConstructorUsedError; + String? get publicAddress => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $VeilidConfigTCPCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VeilidConfigTCPCopyWith<$Res> { + factory $VeilidConfigTCPCopyWith( + VeilidConfigTCP value, $Res Function(VeilidConfigTCP) then) = + _$VeilidConfigTCPCopyWithImpl<$Res, VeilidConfigTCP>; + @useResult + $Res call( + {bool connect, + bool listen, + int maxConnections, + String listenAddress, + String? publicAddress}); +} + +/// @nodoc +class _$VeilidConfigTCPCopyWithImpl<$Res, $Val extends VeilidConfigTCP> + implements $VeilidConfigTCPCopyWith<$Res> { + _$VeilidConfigTCPCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? connect = null, + Object? listen = null, + Object? maxConnections = null, + Object? listenAddress = null, + Object? publicAddress = freezed, + }) { + return _then(_value.copyWith( + connect: null == connect + ? _value.connect + : connect // ignore: cast_nullable_to_non_nullable + as bool, + listen: null == listen + ? _value.listen + : listen // ignore: cast_nullable_to_non_nullable + as bool, + maxConnections: null == maxConnections + ? _value.maxConnections + : maxConnections // ignore: cast_nullable_to_non_nullable + as int, + listenAddress: null == listenAddress + ? _value.listenAddress + : listenAddress // ignore: cast_nullable_to_non_nullable + as String, + publicAddress: freezed == publicAddress + ? _value.publicAddress + : publicAddress // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_VeilidConfigTCPCopyWith<$Res> + implements $VeilidConfigTCPCopyWith<$Res> { + factory _$$_VeilidConfigTCPCopyWith( + _$_VeilidConfigTCP value, $Res Function(_$_VeilidConfigTCP) then) = + __$$_VeilidConfigTCPCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {bool connect, + bool listen, + int maxConnections, + String listenAddress, + String? publicAddress}); +} + +/// @nodoc +class __$$_VeilidConfigTCPCopyWithImpl<$Res> + extends _$VeilidConfigTCPCopyWithImpl<$Res, _$_VeilidConfigTCP> + implements _$$_VeilidConfigTCPCopyWith<$Res> { + __$$_VeilidConfigTCPCopyWithImpl( + _$_VeilidConfigTCP _value, $Res Function(_$_VeilidConfigTCP) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? connect = null, + Object? listen = null, + Object? maxConnections = null, + Object? listenAddress = null, + Object? publicAddress = freezed, + }) { + return _then(_$_VeilidConfigTCP( + connect: null == connect + ? _value.connect + : connect // ignore: cast_nullable_to_non_nullable + as bool, + listen: null == listen + ? _value.listen + : listen // ignore: cast_nullable_to_non_nullable + as bool, + maxConnections: null == maxConnections + ? _value.maxConnections + : maxConnections // ignore: cast_nullable_to_non_nullable + as int, + listenAddress: null == listenAddress + ? _value.listenAddress + : listenAddress // ignore: cast_nullable_to_non_nullable + as String, + publicAddress: freezed == publicAddress + ? _value.publicAddress + : publicAddress // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_VeilidConfigTCP + with DiagnosticableTreeMixin + implements _VeilidConfigTCP { + const _$_VeilidConfigTCP( + {required this.connect, + required this.listen, + required this.maxConnections, + required this.listenAddress, + this.publicAddress}); + + factory _$_VeilidConfigTCP.fromJson(Map json) => + _$$_VeilidConfigTCPFromJson(json); + + @override + final bool connect; + @override + final bool listen; + @override + final int maxConnections; + @override + final String listenAddress; + @override + final String? publicAddress; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'VeilidConfigTCP(connect: $connect, listen: $listen, maxConnections: $maxConnections, listenAddress: $listenAddress, publicAddress: $publicAddress)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'VeilidConfigTCP')) + ..add(DiagnosticsProperty('connect', connect)) + ..add(DiagnosticsProperty('listen', listen)) + ..add(DiagnosticsProperty('maxConnections', maxConnections)) + ..add(DiagnosticsProperty('listenAddress', listenAddress)) + ..add(DiagnosticsProperty('publicAddress', publicAddress)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_VeilidConfigTCP && + (identical(other.connect, connect) || other.connect == connect) && + (identical(other.listen, listen) || other.listen == listen) && + (identical(other.maxConnections, maxConnections) || + other.maxConnections == maxConnections) && + (identical(other.listenAddress, listenAddress) || + other.listenAddress == listenAddress) && + (identical(other.publicAddress, publicAddress) || + other.publicAddress == publicAddress)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, connect, listen, maxConnections, + listenAddress, publicAddress); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_VeilidConfigTCPCopyWith<_$_VeilidConfigTCP> get copyWith => + __$$_VeilidConfigTCPCopyWithImpl<_$_VeilidConfigTCP>(this, _$identity); + + @override + Map toJson() { + return _$$_VeilidConfigTCPToJson( + this, + ); + } +} + +abstract class _VeilidConfigTCP implements VeilidConfigTCP { + const factory _VeilidConfigTCP( + {required final bool connect, + required final bool listen, + required final int maxConnections, + required final String listenAddress, + final String? publicAddress}) = _$_VeilidConfigTCP; + + factory _VeilidConfigTCP.fromJson(Map json) = + _$_VeilidConfigTCP.fromJson; + + @override + bool get connect; + @override + bool get listen; + @override + int get maxConnections; + @override + String get listenAddress; + @override + String? get publicAddress; + @override + @JsonKey(ignore: true) + _$$_VeilidConfigTCPCopyWith<_$_VeilidConfigTCP> get copyWith => + throw _privateConstructorUsedError; +} + +VeilidConfigWS _$VeilidConfigWSFromJson(Map json) { + return _VeilidConfigWS.fromJson(json); +} + +/// @nodoc +mixin _$VeilidConfigWS { + bool get connect => throw _privateConstructorUsedError; + bool get listen => throw _privateConstructorUsedError; + int get maxConnections => throw _privateConstructorUsedError; + String get listenAddress => throw _privateConstructorUsedError; + String get path => throw _privateConstructorUsedError; + String? get url => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $VeilidConfigWSCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VeilidConfigWSCopyWith<$Res> { + factory $VeilidConfigWSCopyWith( + VeilidConfigWS value, $Res Function(VeilidConfigWS) then) = + _$VeilidConfigWSCopyWithImpl<$Res, VeilidConfigWS>; + @useResult + $Res call( + {bool connect, + bool listen, + int maxConnections, + String listenAddress, + String path, + String? url}); +} + +/// @nodoc +class _$VeilidConfigWSCopyWithImpl<$Res, $Val extends VeilidConfigWS> + implements $VeilidConfigWSCopyWith<$Res> { + _$VeilidConfigWSCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? connect = null, + Object? listen = null, + Object? maxConnections = null, + Object? listenAddress = null, + Object? path = null, + Object? url = freezed, + }) { + return _then(_value.copyWith( + connect: null == connect + ? _value.connect + : connect // ignore: cast_nullable_to_non_nullable + as bool, + listen: null == listen + ? _value.listen + : listen // ignore: cast_nullable_to_non_nullable + as bool, + maxConnections: null == maxConnections + ? _value.maxConnections + : maxConnections // ignore: cast_nullable_to_non_nullable + as int, + listenAddress: null == listenAddress + ? _value.listenAddress + : listenAddress // ignore: cast_nullable_to_non_nullable + as String, + path: null == path + ? _value.path + : path // ignore: cast_nullable_to_non_nullable + as String, + url: freezed == url + ? _value.url + : url // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_VeilidConfigWSCopyWith<$Res> + implements $VeilidConfigWSCopyWith<$Res> { + factory _$$_VeilidConfigWSCopyWith( + _$_VeilidConfigWS value, $Res Function(_$_VeilidConfigWS) then) = + __$$_VeilidConfigWSCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {bool connect, + bool listen, + int maxConnections, + String listenAddress, + String path, + String? url}); +} + +/// @nodoc +class __$$_VeilidConfigWSCopyWithImpl<$Res> + extends _$VeilidConfigWSCopyWithImpl<$Res, _$_VeilidConfigWS> + implements _$$_VeilidConfigWSCopyWith<$Res> { + __$$_VeilidConfigWSCopyWithImpl( + _$_VeilidConfigWS _value, $Res Function(_$_VeilidConfigWS) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? connect = null, + Object? listen = null, + Object? maxConnections = null, + Object? listenAddress = null, + Object? path = null, + Object? url = freezed, + }) { + return _then(_$_VeilidConfigWS( + connect: null == connect + ? _value.connect + : connect // ignore: cast_nullable_to_non_nullable + as bool, + listen: null == listen + ? _value.listen + : listen // ignore: cast_nullable_to_non_nullable + as bool, + maxConnections: null == maxConnections + ? _value.maxConnections + : maxConnections // ignore: cast_nullable_to_non_nullable + as int, + listenAddress: null == listenAddress + ? _value.listenAddress + : listenAddress // ignore: cast_nullable_to_non_nullable + as String, + path: null == path + ? _value.path + : path // ignore: cast_nullable_to_non_nullable + as String, + url: freezed == url + ? _value.url + : url // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_VeilidConfigWS + with DiagnosticableTreeMixin + implements _VeilidConfigWS { + const _$_VeilidConfigWS( + {required this.connect, + required this.listen, + required this.maxConnections, + required this.listenAddress, + required this.path, + this.url}); + + factory _$_VeilidConfigWS.fromJson(Map json) => + _$$_VeilidConfigWSFromJson(json); + + @override + final bool connect; + @override + final bool listen; + @override + final int maxConnections; + @override + final String listenAddress; + @override + final String path; + @override + final String? url; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'VeilidConfigWS(connect: $connect, listen: $listen, maxConnections: $maxConnections, listenAddress: $listenAddress, path: $path, url: $url)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'VeilidConfigWS')) + ..add(DiagnosticsProperty('connect', connect)) + ..add(DiagnosticsProperty('listen', listen)) + ..add(DiagnosticsProperty('maxConnections', maxConnections)) + ..add(DiagnosticsProperty('listenAddress', listenAddress)) + ..add(DiagnosticsProperty('path', path)) + ..add(DiagnosticsProperty('url', url)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_VeilidConfigWS && + (identical(other.connect, connect) || other.connect == connect) && + (identical(other.listen, listen) || other.listen == listen) && + (identical(other.maxConnections, maxConnections) || + other.maxConnections == maxConnections) && + (identical(other.listenAddress, listenAddress) || + other.listenAddress == listenAddress) && + (identical(other.path, path) || other.path == path) && + (identical(other.url, url) || other.url == url)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, connect, listen, maxConnections, listenAddress, path, url); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_VeilidConfigWSCopyWith<_$_VeilidConfigWS> get copyWith => + __$$_VeilidConfigWSCopyWithImpl<_$_VeilidConfigWS>(this, _$identity); + + @override + Map toJson() { + return _$$_VeilidConfigWSToJson( + this, + ); + } +} + +abstract class _VeilidConfigWS implements VeilidConfigWS { + const factory _VeilidConfigWS( + {required final bool connect, + required final bool listen, + required final int maxConnections, + required final String listenAddress, + required final String path, + final String? url}) = _$_VeilidConfigWS; + + factory _VeilidConfigWS.fromJson(Map json) = + _$_VeilidConfigWS.fromJson; + + @override + bool get connect; + @override + bool get listen; + @override + int get maxConnections; + @override + String get listenAddress; + @override + String get path; + @override + String? get url; + @override + @JsonKey(ignore: true) + _$$_VeilidConfigWSCopyWith<_$_VeilidConfigWS> get copyWith => + throw _privateConstructorUsedError; +} + +VeilidConfigWSS _$VeilidConfigWSSFromJson(Map json) { + return _VeilidConfigWSS.fromJson(json); +} + +/// @nodoc +mixin _$VeilidConfigWSS { + bool get connect => throw _privateConstructorUsedError; + bool get listen => throw _privateConstructorUsedError; + int get maxConnections => throw _privateConstructorUsedError; + String get listenAddress => throw _privateConstructorUsedError; + String get path => throw _privateConstructorUsedError; + String? get url => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $VeilidConfigWSSCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VeilidConfigWSSCopyWith<$Res> { + factory $VeilidConfigWSSCopyWith( + VeilidConfigWSS value, $Res Function(VeilidConfigWSS) then) = + _$VeilidConfigWSSCopyWithImpl<$Res, VeilidConfigWSS>; + @useResult + $Res call( + {bool connect, + bool listen, + int maxConnections, + String listenAddress, + String path, + String? url}); +} + +/// @nodoc +class _$VeilidConfigWSSCopyWithImpl<$Res, $Val extends VeilidConfigWSS> + implements $VeilidConfigWSSCopyWith<$Res> { + _$VeilidConfigWSSCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? connect = null, + Object? listen = null, + Object? maxConnections = null, + Object? listenAddress = null, + Object? path = null, + Object? url = freezed, + }) { + return _then(_value.copyWith( + connect: null == connect + ? _value.connect + : connect // ignore: cast_nullable_to_non_nullable + as bool, + listen: null == listen + ? _value.listen + : listen // ignore: cast_nullable_to_non_nullable + as bool, + maxConnections: null == maxConnections + ? _value.maxConnections + : maxConnections // ignore: cast_nullable_to_non_nullable + as int, + listenAddress: null == listenAddress + ? _value.listenAddress + : listenAddress // ignore: cast_nullable_to_non_nullable + as String, + path: null == path + ? _value.path + : path // ignore: cast_nullable_to_non_nullable + as String, + url: freezed == url + ? _value.url + : url // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_VeilidConfigWSSCopyWith<$Res> + implements $VeilidConfigWSSCopyWith<$Res> { + factory _$$_VeilidConfigWSSCopyWith( + _$_VeilidConfigWSS value, $Res Function(_$_VeilidConfigWSS) then) = + __$$_VeilidConfigWSSCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {bool connect, + bool listen, + int maxConnections, + String listenAddress, + String path, + String? url}); +} + +/// @nodoc +class __$$_VeilidConfigWSSCopyWithImpl<$Res> + extends _$VeilidConfigWSSCopyWithImpl<$Res, _$_VeilidConfigWSS> + implements _$$_VeilidConfigWSSCopyWith<$Res> { + __$$_VeilidConfigWSSCopyWithImpl( + _$_VeilidConfigWSS _value, $Res Function(_$_VeilidConfigWSS) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? connect = null, + Object? listen = null, + Object? maxConnections = null, + Object? listenAddress = null, + Object? path = null, + Object? url = freezed, + }) { + return _then(_$_VeilidConfigWSS( + connect: null == connect + ? _value.connect + : connect // ignore: cast_nullable_to_non_nullable + as bool, + listen: null == listen + ? _value.listen + : listen // ignore: cast_nullable_to_non_nullable + as bool, + maxConnections: null == maxConnections + ? _value.maxConnections + : maxConnections // ignore: cast_nullable_to_non_nullable + as int, + listenAddress: null == listenAddress + ? _value.listenAddress + : listenAddress // ignore: cast_nullable_to_non_nullable + as String, + path: null == path + ? _value.path + : path // ignore: cast_nullable_to_non_nullable + as String, + url: freezed == url + ? _value.url + : url // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_VeilidConfigWSS + with DiagnosticableTreeMixin + implements _VeilidConfigWSS { + const _$_VeilidConfigWSS( + {required this.connect, + required this.listen, + required this.maxConnections, + required this.listenAddress, + required this.path, + this.url}); + + factory _$_VeilidConfigWSS.fromJson(Map json) => + _$$_VeilidConfigWSSFromJson(json); + + @override + final bool connect; + @override + final bool listen; + @override + final int maxConnections; + @override + final String listenAddress; + @override + final String path; + @override + final String? url; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'VeilidConfigWSS(connect: $connect, listen: $listen, maxConnections: $maxConnections, listenAddress: $listenAddress, path: $path, url: $url)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'VeilidConfigWSS')) + ..add(DiagnosticsProperty('connect', connect)) + ..add(DiagnosticsProperty('listen', listen)) + ..add(DiagnosticsProperty('maxConnections', maxConnections)) + ..add(DiagnosticsProperty('listenAddress', listenAddress)) + ..add(DiagnosticsProperty('path', path)) + ..add(DiagnosticsProperty('url', url)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_VeilidConfigWSS && + (identical(other.connect, connect) || other.connect == connect) && + (identical(other.listen, listen) || other.listen == listen) && + (identical(other.maxConnections, maxConnections) || + other.maxConnections == maxConnections) && + (identical(other.listenAddress, listenAddress) || + other.listenAddress == listenAddress) && + (identical(other.path, path) || other.path == path) && + (identical(other.url, url) || other.url == url)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, connect, listen, maxConnections, listenAddress, path, url); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_VeilidConfigWSSCopyWith<_$_VeilidConfigWSS> get copyWith => + __$$_VeilidConfigWSSCopyWithImpl<_$_VeilidConfigWSS>(this, _$identity); + + @override + Map toJson() { + return _$$_VeilidConfigWSSToJson( + this, + ); + } +} + +abstract class _VeilidConfigWSS implements VeilidConfigWSS { + const factory _VeilidConfigWSS( + {required final bool connect, + required final bool listen, + required final int maxConnections, + required final String listenAddress, + required final String path, + final String? url}) = _$_VeilidConfigWSS; + + factory _VeilidConfigWSS.fromJson(Map json) = + _$_VeilidConfigWSS.fromJson; + + @override + bool get connect; + @override + bool get listen; + @override + int get maxConnections; + @override + String get listenAddress; + @override + String get path; + @override + String? get url; + @override + @JsonKey(ignore: true) + _$$_VeilidConfigWSSCopyWith<_$_VeilidConfigWSS> get copyWith => + throw _privateConstructorUsedError; +} + +VeilidConfigProtocol _$VeilidConfigProtocolFromJson(Map json) { + return _VeilidConfigProtocol.fromJson(json); +} + +/// @nodoc +mixin _$VeilidConfigProtocol { + VeilidConfigUDP get udp => throw _privateConstructorUsedError; + VeilidConfigTCP get tcp => throw _privateConstructorUsedError; + VeilidConfigWS get ws => throw _privateConstructorUsedError; + VeilidConfigWSS get wss => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $VeilidConfigProtocolCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VeilidConfigProtocolCopyWith<$Res> { + factory $VeilidConfigProtocolCopyWith(VeilidConfigProtocol value, + $Res Function(VeilidConfigProtocol) then) = + _$VeilidConfigProtocolCopyWithImpl<$Res, VeilidConfigProtocol>; + @useResult + $Res call( + {VeilidConfigUDP udp, + VeilidConfigTCP tcp, + VeilidConfigWS ws, + VeilidConfigWSS wss}); + + $VeilidConfigUDPCopyWith<$Res> get udp; + $VeilidConfigTCPCopyWith<$Res> get tcp; + $VeilidConfigWSCopyWith<$Res> get ws; + $VeilidConfigWSSCopyWith<$Res> get wss; +} + +/// @nodoc +class _$VeilidConfigProtocolCopyWithImpl<$Res, + $Val extends VeilidConfigProtocol> + implements $VeilidConfigProtocolCopyWith<$Res> { + _$VeilidConfigProtocolCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? udp = null, + Object? tcp = null, + Object? ws = null, + Object? wss = null, + }) { + return _then(_value.copyWith( + udp: null == udp + ? _value.udp + : udp // ignore: cast_nullable_to_non_nullable + as VeilidConfigUDP, + tcp: null == tcp + ? _value.tcp + : tcp // ignore: cast_nullable_to_non_nullable + as VeilidConfigTCP, + ws: null == ws + ? _value.ws + : ws // ignore: cast_nullable_to_non_nullable + as VeilidConfigWS, + wss: null == wss + ? _value.wss + : wss // ignore: cast_nullable_to_non_nullable + as VeilidConfigWSS, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $VeilidConfigUDPCopyWith<$Res> get udp { + return $VeilidConfigUDPCopyWith<$Res>(_value.udp, (value) { + return _then(_value.copyWith(udp: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $VeilidConfigTCPCopyWith<$Res> get tcp { + return $VeilidConfigTCPCopyWith<$Res>(_value.tcp, (value) { + return _then(_value.copyWith(tcp: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $VeilidConfigWSCopyWith<$Res> get ws { + return $VeilidConfigWSCopyWith<$Res>(_value.ws, (value) { + return _then(_value.copyWith(ws: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $VeilidConfigWSSCopyWith<$Res> get wss { + return $VeilidConfigWSSCopyWith<$Res>(_value.wss, (value) { + return _then(_value.copyWith(wss: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$_VeilidConfigProtocolCopyWith<$Res> + implements $VeilidConfigProtocolCopyWith<$Res> { + factory _$$_VeilidConfigProtocolCopyWith(_$_VeilidConfigProtocol value, + $Res Function(_$_VeilidConfigProtocol) then) = + __$$_VeilidConfigProtocolCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {VeilidConfigUDP udp, + VeilidConfigTCP tcp, + VeilidConfigWS ws, + VeilidConfigWSS wss}); + + @override + $VeilidConfigUDPCopyWith<$Res> get udp; + @override + $VeilidConfigTCPCopyWith<$Res> get tcp; + @override + $VeilidConfigWSCopyWith<$Res> get ws; + @override + $VeilidConfigWSSCopyWith<$Res> get wss; +} + +/// @nodoc +class __$$_VeilidConfigProtocolCopyWithImpl<$Res> + extends _$VeilidConfigProtocolCopyWithImpl<$Res, _$_VeilidConfigProtocol> + implements _$$_VeilidConfigProtocolCopyWith<$Res> { + __$$_VeilidConfigProtocolCopyWithImpl(_$_VeilidConfigProtocol _value, + $Res Function(_$_VeilidConfigProtocol) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? udp = null, + Object? tcp = null, + Object? ws = null, + Object? wss = null, + }) { + return _then(_$_VeilidConfigProtocol( + udp: null == udp + ? _value.udp + : udp // ignore: cast_nullable_to_non_nullable + as VeilidConfigUDP, + tcp: null == tcp + ? _value.tcp + : tcp // ignore: cast_nullable_to_non_nullable + as VeilidConfigTCP, + ws: null == ws + ? _value.ws + : ws // ignore: cast_nullable_to_non_nullable + as VeilidConfigWS, + wss: null == wss + ? _value.wss + : wss // ignore: cast_nullable_to_non_nullable + as VeilidConfigWSS, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_VeilidConfigProtocol + with DiagnosticableTreeMixin + implements _VeilidConfigProtocol { + const _$_VeilidConfigProtocol( + {required this.udp, + required this.tcp, + required this.ws, + required this.wss}); + + factory _$_VeilidConfigProtocol.fromJson(Map json) => + _$$_VeilidConfigProtocolFromJson(json); + + @override + final VeilidConfigUDP udp; + @override + final VeilidConfigTCP tcp; + @override + final VeilidConfigWS ws; + @override + final VeilidConfigWSS wss; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'VeilidConfigProtocol(udp: $udp, tcp: $tcp, ws: $ws, wss: $wss)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'VeilidConfigProtocol')) + ..add(DiagnosticsProperty('udp', udp)) + ..add(DiagnosticsProperty('tcp', tcp)) + ..add(DiagnosticsProperty('ws', ws)) + ..add(DiagnosticsProperty('wss', wss)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_VeilidConfigProtocol && + (identical(other.udp, udp) || other.udp == udp) && + (identical(other.tcp, tcp) || other.tcp == tcp) && + (identical(other.ws, ws) || other.ws == ws) && + (identical(other.wss, wss) || other.wss == wss)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, udp, tcp, ws, wss); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_VeilidConfigProtocolCopyWith<_$_VeilidConfigProtocol> get copyWith => + __$$_VeilidConfigProtocolCopyWithImpl<_$_VeilidConfigProtocol>( + this, _$identity); + + @override + Map toJson() { + return _$$_VeilidConfigProtocolToJson( + this, + ); + } +} + +abstract class _VeilidConfigProtocol implements VeilidConfigProtocol { + const factory _VeilidConfigProtocol( + {required final VeilidConfigUDP udp, + required final VeilidConfigTCP tcp, + required final VeilidConfigWS ws, + required final VeilidConfigWSS wss}) = _$_VeilidConfigProtocol; + + factory _VeilidConfigProtocol.fromJson(Map json) = + _$_VeilidConfigProtocol.fromJson; + + @override + VeilidConfigUDP get udp; + @override + VeilidConfigTCP get tcp; + @override + VeilidConfigWS get ws; + @override + VeilidConfigWSS get wss; + @override + @JsonKey(ignore: true) + _$$_VeilidConfigProtocolCopyWith<_$_VeilidConfigProtocol> get copyWith => + throw _privateConstructorUsedError; +} + +VeilidConfigTLS _$VeilidConfigTLSFromJson(Map json) { + return _VeilidConfigTLS.fromJson(json); +} + +/// @nodoc +mixin _$VeilidConfigTLS { + String get certificatePath => throw _privateConstructorUsedError; + String get privateKeyPath => throw _privateConstructorUsedError; + int get connectionInitialTimeoutMs => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $VeilidConfigTLSCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VeilidConfigTLSCopyWith<$Res> { + factory $VeilidConfigTLSCopyWith( + VeilidConfigTLS value, $Res Function(VeilidConfigTLS) then) = + _$VeilidConfigTLSCopyWithImpl<$Res, VeilidConfigTLS>; + @useResult + $Res call( + {String certificatePath, + String privateKeyPath, + int connectionInitialTimeoutMs}); +} + +/// @nodoc +class _$VeilidConfigTLSCopyWithImpl<$Res, $Val extends VeilidConfigTLS> + implements $VeilidConfigTLSCopyWith<$Res> { + _$VeilidConfigTLSCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? certificatePath = null, + Object? privateKeyPath = null, + Object? connectionInitialTimeoutMs = null, + }) { + return _then(_value.copyWith( + certificatePath: null == certificatePath + ? _value.certificatePath + : certificatePath // ignore: cast_nullable_to_non_nullable + as String, + privateKeyPath: null == privateKeyPath + ? _value.privateKeyPath + : privateKeyPath // ignore: cast_nullable_to_non_nullable + as String, + connectionInitialTimeoutMs: null == connectionInitialTimeoutMs + ? _value.connectionInitialTimeoutMs + : connectionInitialTimeoutMs // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_VeilidConfigTLSCopyWith<$Res> + implements $VeilidConfigTLSCopyWith<$Res> { + factory _$$_VeilidConfigTLSCopyWith( + _$_VeilidConfigTLS value, $Res Function(_$_VeilidConfigTLS) then) = + __$$_VeilidConfigTLSCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String certificatePath, + String privateKeyPath, + int connectionInitialTimeoutMs}); +} + +/// @nodoc +class __$$_VeilidConfigTLSCopyWithImpl<$Res> + extends _$VeilidConfigTLSCopyWithImpl<$Res, _$_VeilidConfigTLS> + implements _$$_VeilidConfigTLSCopyWith<$Res> { + __$$_VeilidConfigTLSCopyWithImpl( + _$_VeilidConfigTLS _value, $Res Function(_$_VeilidConfigTLS) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? certificatePath = null, + Object? privateKeyPath = null, + Object? connectionInitialTimeoutMs = null, + }) { + return _then(_$_VeilidConfigTLS( + certificatePath: null == certificatePath + ? _value.certificatePath + : certificatePath // ignore: cast_nullable_to_non_nullable + as String, + privateKeyPath: null == privateKeyPath + ? _value.privateKeyPath + : privateKeyPath // ignore: cast_nullable_to_non_nullable + as String, + connectionInitialTimeoutMs: null == connectionInitialTimeoutMs + ? _value.connectionInitialTimeoutMs + : connectionInitialTimeoutMs // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_VeilidConfigTLS + with DiagnosticableTreeMixin + implements _VeilidConfigTLS { + const _$_VeilidConfigTLS( + {required this.certificatePath, + required this.privateKeyPath, + required this.connectionInitialTimeoutMs}); + + factory _$_VeilidConfigTLS.fromJson(Map json) => + _$$_VeilidConfigTLSFromJson(json); + + @override + final String certificatePath; + @override + final String privateKeyPath; + @override + final int connectionInitialTimeoutMs; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'VeilidConfigTLS(certificatePath: $certificatePath, privateKeyPath: $privateKeyPath, connectionInitialTimeoutMs: $connectionInitialTimeoutMs)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'VeilidConfigTLS')) + ..add(DiagnosticsProperty('certificatePath', certificatePath)) + ..add(DiagnosticsProperty('privateKeyPath', privateKeyPath)) + ..add(DiagnosticsProperty( + 'connectionInitialTimeoutMs', connectionInitialTimeoutMs)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_VeilidConfigTLS && + (identical(other.certificatePath, certificatePath) || + other.certificatePath == certificatePath) && + (identical(other.privateKeyPath, privateKeyPath) || + other.privateKeyPath == privateKeyPath) && + (identical(other.connectionInitialTimeoutMs, + connectionInitialTimeoutMs) || + other.connectionInitialTimeoutMs == + connectionInitialTimeoutMs)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, certificatePath, privateKeyPath, connectionInitialTimeoutMs); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_VeilidConfigTLSCopyWith<_$_VeilidConfigTLS> get copyWith => + __$$_VeilidConfigTLSCopyWithImpl<_$_VeilidConfigTLS>(this, _$identity); + + @override + Map toJson() { + return _$$_VeilidConfigTLSToJson( + this, + ); + } +} + +abstract class _VeilidConfigTLS implements VeilidConfigTLS { + const factory _VeilidConfigTLS( + {required final String certificatePath, + required final String privateKeyPath, + required final int connectionInitialTimeoutMs}) = _$_VeilidConfigTLS; + + factory _VeilidConfigTLS.fromJson(Map json) = + _$_VeilidConfigTLS.fromJson; + + @override + String get certificatePath; + @override + String get privateKeyPath; + @override + int get connectionInitialTimeoutMs; + @override + @JsonKey(ignore: true) + _$$_VeilidConfigTLSCopyWith<_$_VeilidConfigTLS> get copyWith => + throw _privateConstructorUsedError; +} + +VeilidConfigDHT _$VeilidConfigDHTFromJson(Map json) { + return _VeilidConfigDHT.fromJson(json); +} + +/// @nodoc +mixin _$VeilidConfigDHT { + int get resolveNodeTimeoutMs => throw _privateConstructorUsedError; + int get resolveNodeCount => throw _privateConstructorUsedError; + int get resolveNodeFanout => throw _privateConstructorUsedError; + int get maxFindNodeCount => throw _privateConstructorUsedError; + int get getValueTimeoutMs => throw _privateConstructorUsedError; + int get getValueCount => throw _privateConstructorUsedError; + int get getValueFanout => throw _privateConstructorUsedError; + int get setValueTimeoutMs => throw _privateConstructorUsedError; + int get setValueCount => throw _privateConstructorUsedError; + int get setValueFanout => throw _privateConstructorUsedError; + int get minPeerCount => throw _privateConstructorUsedError; + int get minPeerRefreshTimeMs => throw _privateConstructorUsedError; + int get validateDialInfoReceiptTimeMs => throw _privateConstructorUsedError; + int get localSubkeyCacheSize => throw _privateConstructorUsedError; + int get localMaxSubkeyCacheMemoryMb => throw _privateConstructorUsedError; + int get remoteSubkeyCacheSize => throw _privateConstructorUsedError; + int get remoteMaxRecords => throw _privateConstructorUsedError; + int get remoteMaxSubkeyCacheMemoryMb => throw _privateConstructorUsedError; + int get remoteMaxStorageSpaceMb => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $VeilidConfigDHTCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VeilidConfigDHTCopyWith<$Res> { + factory $VeilidConfigDHTCopyWith( + VeilidConfigDHT value, $Res Function(VeilidConfigDHT) then) = + _$VeilidConfigDHTCopyWithImpl<$Res, VeilidConfigDHT>; + @useResult + $Res call( + {int resolveNodeTimeoutMs, + int resolveNodeCount, + int resolveNodeFanout, + int maxFindNodeCount, + int getValueTimeoutMs, + int getValueCount, + int getValueFanout, + int setValueTimeoutMs, + int setValueCount, + int setValueFanout, + int minPeerCount, + int minPeerRefreshTimeMs, + int validateDialInfoReceiptTimeMs, + int localSubkeyCacheSize, + int localMaxSubkeyCacheMemoryMb, + int remoteSubkeyCacheSize, + int remoteMaxRecords, + int remoteMaxSubkeyCacheMemoryMb, + int remoteMaxStorageSpaceMb}); +} + +/// @nodoc +class _$VeilidConfigDHTCopyWithImpl<$Res, $Val extends VeilidConfigDHT> + implements $VeilidConfigDHTCopyWith<$Res> { + _$VeilidConfigDHTCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? resolveNodeTimeoutMs = null, + Object? resolveNodeCount = null, + Object? resolveNodeFanout = null, + Object? maxFindNodeCount = null, + Object? getValueTimeoutMs = null, + Object? getValueCount = null, + Object? getValueFanout = null, + Object? setValueTimeoutMs = null, + Object? setValueCount = null, + Object? setValueFanout = null, + Object? minPeerCount = null, + Object? minPeerRefreshTimeMs = null, + Object? validateDialInfoReceiptTimeMs = null, + Object? localSubkeyCacheSize = null, + Object? localMaxSubkeyCacheMemoryMb = null, + Object? remoteSubkeyCacheSize = null, + Object? remoteMaxRecords = null, + Object? remoteMaxSubkeyCacheMemoryMb = null, + Object? remoteMaxStorageSpaceMb = null, + }) { + return _then(_value.copyWith( + resolveNodeTimeoutMs: null == resolveNodeTimeoutMs + ? _value.resolveNodeTimeoutMs + : resolveNodeTimeoutMs // ignore: cast_nullable_to_non_nullable + as int, + resolveNodeCount: null == resolveNodeCount + ? _value.resolveNodeCount + : resolveNodeCount // ignore: cast_nullable_to_non_nullable + as int, + resolveNodeFanout: null == resolveNodeFanout + ? _value.resolveNodeFanout + : resolveNodeFanout // ignore: cast_nullable_to_non_nullable + as int, + maxFindNodeCount: null == maxFindNodeCount + ? _value.maxFindNodeCount + : maxFindNodeCount // ignore: cast_nullable_to_non_nullable + as int, + getValueTimeoutMs: null == getValueTimeoutMs + ? _value.getValueTimeoutMs + : getValueTimeoutMs // ignore: cast_nullable_to_non_nullable + as int, + getValueCount: null == getValueCount + ? _value.getValueCount + : getValueCount // ignore: cast_nullable_to_non_nullable + as int, + getValueFanout: null == getValueFanout + ? _value.getValueFanout + : getValueFanout // ignore: cast_nullable_to_non_nullable + as int, + setValueTimeoutMs: null == setValueTimeoutMs + ? _value.setValueTimeoutMs + : setValueTimeoutMs // ignore: cast_nullable_to_non_nullable + as int, + setValueCount: null == setValueCount + ? _value.setValueCount + : setValueCount // ignore: cast_nullable_to_non_nullable + as int, + setValueFanout: null == setValueFanout + ? _value.setValueFanout + : setValueFanout // ignore: cast_nullable_to_non_nullable + as int, + minPeerCount: null == minPeerCount + ? _value.minPeerCount + : minPeerCount // ignore: cast_nullable_to_non_nullable + as int, + minPeerRefreshTimeMs: null == minPeerRefreshTimeMs + ? _value.minPeerRefreshTimeMs + : minPeerRefreshTimeMs // ignore: cast_nullable_to_non_nullable + as int, + validateDialInfoReceiptTimeMs: null == validateDialInfoReceiptTimeMs + ? _value.validateDialInfoReceiptTimeMs + : validateDialInfoReceiptTimeMs // ignore: cast_nullable_to_non_nullable + as int, + localSubkeyCacheSize: null == localSubkeyCacheSize + ? _value.localSubkeyCacheSize + : localSubkeyCacheSize // ignore: cast_nullable_to_non_nullable + as int, + localMaxSubkeyCacheMemoryMb: null == localMaxSubkeyCacheMemoryMb + ? _value.localMaxSubkeyCacheMemoryMb + : localMaxSubkeyCacheMemoryMb // ignore: cast_nullable_to_non_nullable + as int, + remoteSubkeyCacheSize: null == remoteSubkeyCacheSize + ? _value.remoteSubkeyCacheSize + : remoteSubkeyCacheSize // ignore: cast_nullable_to_non_nullable + as int, + remoteMaxRecords: null == remoteMaxRecords + ? _value.remoteMaxRecords + : remoteMaxRecords // ignore: cast_nullable_to_non_nullable + as int, + remoteMaxSubkeyCacheMemoryMb: null == remoteMaxSubkeyCacheMemoryMb + ? _value.remoteMaxSubkeyCacheMemoryMb + : remoteMaxSubkeyCacheMemoryMb // ignore: cast_nullable_to_non_nullable + as int, + remoteMaxStorageSpaceMb: null == remoteMaxStorageSpaceMb + ? _value.remoteMaxStorageSpaceMb + : remoteMaxStorageSpaceMb // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_VeilidConfigDHTCopyWith<$Res> + implements $VeilidConfigDHTCopyWith<$Res> { + factory _$$_VeilidConfigDHTCopyWith( + _$_VeilidConfigDHT value, $Res Function(_$_VeilidConfigDHT) then) = + __$$_VeilidConfigDHTCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {int resolveNodeTimeoutMs, + int resolveNodeCount, + int resolveNodeFanout, + int maxFindNodeCount, + int getValueTimeoutMs, + int getValueCount, + int getValueFanout, + int setValueTimeoutMs, + int setValueCount, + int setValueFanout, + int minPeerCount, + int minPeerRefreshTimeMs, + int validateDialInfoReceiptTimeMs, + int localSubkeyCacheSize, + int localMaxSubkeyCacheMemoryMb, + int remoteSubkeyCacheSize, + int remoteMaxRecords, + int remoteMaxSubkeyCacheMemoryMb, + int remoteMaxStorageSpaceMb}); +} + +/// @nodoc +class __$$_VeilidConfigDHTCopyWithImpl<$Res> + extends _$VeilidConfigDHTCopyWithImpl<$Res, _$_VeilidConfigDHT> + implements _$$_VeilidConfigDHTCopyWith<$Res> { + __$$_VeilidConfigDHTCopyWithImpl( + _$_VeilidConfigDHT _value, $Res Function(_$_VeilidConfigDHT) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? resolveNodeTimeoutMs = null, + Object? resolveNodeCount = null, + Object? resolveNodeFanout = null, + Object? maxFindNodeCount = null, + Object? getValueTimeoutMs = null, + Object? getValueCount = null, + Object? getValueFanout = null, + Object? setValueTimeoutMs = null, + Object? setValueCount = null, + Object? setValueFanout = null, + Object? minPeerCount = null, + Object? minPeerRefreshTimeMs = null, + Object? validateDialInfoReceiptTimeMs = null, + Object? localSubkeyCacheSize = null, + Object? localMaxSubkeyCacheMemoryMb = null, + Object? remoteSubkeyCacheSize = null, + Object? remoteMaxRecords = null, + Object? remoteMaxSubkeyCacheMemoryMb = null, + Object? remoteMaxStorageSpaceMb = null, + }) { + return _then(_$_VeilidConfigDHT( + resolveNodeTimeoutMs: null == resolveNodeTimeoutMs + ? _value.resolveNodeTimeoutMs + : resolveNodeTimeoutMs // ignore: cast_nullable_to_non_nullable + as int, + resolveNodeCount: null == resolveNodeCount + ? _value.resolveNodeCount + : resolveNodeCount // ignore: cast_nullable_to_non_nullable + as int, + resolveNodeFanout: null == resolveNodeFanout + ? _value.resolveNodeFanout + : resolveNodeFanout // ignore: cast_nullable_to_non_nullable + as int, + maxFindNodeCount: null == maxFindNodeCount + ? _value.maxFindNodeCount + : maxFindNodeCount // ignore: cast_nullable_to_non_nullable + as int, + getValueTimeoutMs: null == getValueTimeoutMs + ? _value.getValueTimeoutMs + : getValueTimeoutMs // ignore: cast_nullable_to_non_nullable + as int, + getValueCount: null == getValueCount + ? _value.getValueCount + : getValueCount // ignore: cast_nullable_to_non_nullable + as int, + getValueFanout: null == getValueFanout + ? _value.getValueFanout + : getValueFanout // ignore: cast_nullable_to_non_nullable + as int, + setValueTimeoutMs: null == setValueTimeoutMs + ? _value.setValueTimeoutMs + : setValueTimeoutMs // ignore: cast_nullable_to_non_nullable + as int, + setValueCount: null == setValueCount + ? _value.setValueCount + : setValueCount // ignore: cast_nullable_to_non_nullable + as int, + setValueFanout: null == setValueFanout + ? _value.setValueFanout + : setValueFanout // ignore: cast_nullable_to_non_nullable + as int, + minPeerCount: null == minPeerCount + ? _value.minPeerCount + : minPeerCount // ignore: cast_nullable_to_non_nullable + as int, + minPeerRefreshTimeMs: null == minPeerRefreshTimeMs + ? _value.minPeerRefreshTimeMs + : minPeerRefreshTimeMs // ignore: cast_nullable_to_non_nullable + as int, + validateDialInfoReceiptTimeMs: null == validateDialInfoReceiptTimeMs + ? _value.validateDialInfoReceiptTimeMs + : validateDialInfoReceiptTimeMs // ignore: cast_nullable_to_non_nullable + as int, + localSubkeyCacheSize: null == localSubkeyCacheSize + ? _value.localSubkeyCacheSize + : localSubkeyCacheSize // ignore: cast_nullable_to_non_nullable + as int, + localMaxSubkeyCacheMemoryMb: null == localMaxSubkeyCacheMemoryMb + ? _value.localMaxSubkeyCacheMemoryMb + : localMaxSubkeyCacheMemoryMb // ignore: cast_nullable_to_non_nullable + as int, + remoteSubkeyCacheSize: null == remoteSubkeyCacheSize + ? _value.remoteSubkeyCacheSize + : remoteSubkeyCacheSize // ignore: cast_nullable_to_non_nullable + as int, + remoteMaxRecords: null == remoteMaxRecords + ? _value.remoteMaxRecords + : remoteMaxRecords // ignore: cast_nullable_to_non_nullable + as int, + remoteMaxSubkeyCacheMemoryMb: null == remoteMaxSubkeyCacheMemoryMb + ? _value.remoteMaxSubkeyCacheMemoryMb + : remoteMaxSubkeyCacheMemoryMb // ignore: cast_nullable_to_non_nullable + as int, + remoteMaxStorageSpaceMb: null == remoteMaxStorageSpaceMb + ? _value.remoteMaxStorageSpaceMb + : remoteMaxStorageSpaceMb // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_VeilidConfigDHT + with DiagnosticableTreeMixin + implements _VeilidConfigDHT { + const _$_VeilidConfigDHT( + {required this.resolveNodeTimeoutMs, + required this.resolveNodeCount, + required this.resolveNodeFanout, + required this.maxFindNodeCount, + required this.getValueTimeoutMs, + required this.getValueCount, + required this.getValueFanout, + required this.setValueTimeoutMs, + required this.setValueCount, + required this.setValueFanout, + required this.minPeerCount, + required this.minPeerRefreshTimeMs, + required this.validateDialInfoReceiptTimeMs, + required this.localSubkeyCacheSize, + required this.localMaxSubkeyCacheMemoryMb, + required this.remoteSubkeyCacheSize, + required this.remoteMaxRecords, + required this.remoteMaxSubkeyCacheMemoryMb, + required this.remoteMaxStorageSpaceMb}); + + factory _$_VeilidConfigDHT.fromJson(Map json) => + _$$_VeilidConfigDHTFromJson(json); + + @override + final int resolveNodeTimeoutMs; + @override + final int resolveNodeCount; + @override + final int resolveNodeFanout; + @override + final int maxFindNodeCount; + @override + final int getValueTimeoutMs; + @override + final int getValueCount; + @override + final int getValueFanout; + @override + final int setValueTimeoutMs; + @override + final int setValueCount; + @override + final int setValueFanout; + @override + final int minPeerCount; + @override + final int minPeerRefreshTimeMs; + @override + final int validateDialInfoReceiptTimeMs; + @override + final int localSubkeyCacheSize; + @override + final int localMaxSubkeyCacheMemoryMb; + @override + final int remoteSubkeyCacheSize; + @override + final int remoteMaxRecords; + @override + final int remoteMaxSubkeyCacheMemoryMb; + @override + final int remoteMaxStorageSpaceMb; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'VeilidConfigDHT(resolveNodeTimeoutMs: $resolveNodeTimeoutMs, resolveNodeCount: $resolveNodeCount, resolveNodeFanout: $resolveNodeFanout, maxFindNodeCount: $maxFindNodeCount, getValueTimeoutMs: $getValueTimeoutMs, getValueCount: $getValueCount, getValueFanout: $getValueFanout, setValueTimeoutMs: $setValueTimeoutMs, setValueCount: $setValueCount, setValueFanout: $setValueFanout, minPeerCount: $minPeerCount, minPeerRefreshTimeMs: $minPeerRefreshTimeMs, validateDialInfoReceiptTimeMs: $validateDialInfoReceiptTimeMs, localSubkeyCacheSize: $localSubkeyCacheSize, localMaxSubkeyCacheMemoryMb: $localMaxSubkeyCacheMemoryMb, remoteSubkeyCacheSize: $remoteSubkeyCacheSize, remoteMaxRecords: $remoteMaxRecords, remoteMaxSubkeyCacheMemoryMb: $remoteMaxSubkeyCacheMemoryMb, remoteMaxStorageSpaceMb: $remoteMaxStorageSpaceMb)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'VeilidConfigDHT')) + ..add(DiagnosticsProperty('resolveNodeTimeoutMs', resolveNodeTimeoutMs)) + ..add(DiagnosticsProperty('resolveNodeCount', resolveNodeCount)) + ..add(DiagnosticsProperty('resolveNodeFanout', resolveNodeFanout)) + ..add(DiagnosticsProperty('maxFindNodeCount', maxFindNodeCount)) + ..add(DiagnosticsProperty('getValueTimeoutMs', getValueTimeoutMs)) + ..add(DiagnosticsProperty('getValueCount', getValueCount)) + ..add(DiagnosticsProperty('getValueFanout', getValueFanout)) + ..add(DiagnosticsProperty('setValueTimeoutMs', setValueTimeoutMs)) + ..add(DiagnosticsProperty('setValueCount', setValueCount)) + ..add(DiagnosticsProperty('setValueFanout', setValueFanout)) + ..add(DiagnosticsProperty('minPeerCount', minPeerCount)) + ..add(DiagnosticsProperty('minPeerRefreshTimeMs', minPeerRefreshTimeMs)) + ..add(DiagnosticsProperty( + 'validateDialInfoReceiptTimeMs', validateDialInfoReceiptTimeMs)) + ..add(DiagnosticsProperty('localSubkeyCacheSize', localSubkeyCacheSize)) + ..add(DiagnosticsProperty( + 'localMaxSubkeyCacheMemoryMb', localMaxSubkeyCacheMemoryMb)) + ..add(DiagnosticsProperty('remoteSubkeyCacheSize', remoteSubkeyCacheSize)) + ..add(DiagnosticsProperty('remoteMaxRecords', remoteMaxRecords)) + ..add(DiagnosticsProperty( + 'remoteMaxSubkeyCacheMemoryMb', remoteMaxSubkeyCacheMemoryMb)) + ..add(DiagnosticsProperty( + 'remoteMaxStorageSpaceMb', remoteMaxStorageSpaceMb)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_VeilidConfigDHT && + (identical(other.resolveNodeTimeoutMs, resolveNodeTimeoutMs) || + other.resolveNodeTimeoutMs == resolveNodeTimeoutMs) && + (identical(other.resolveNodeCount, resolveNodeCount) || + other.resolveNodeCount == resolveNodeCount) && + (identical(other.resolveNodeFanout, resolveNodeFanout) || + other.resolveNodeFanout == resolveNodeFanout) && + (identical(other.maxFindNodeCount, maxFindNodeCount) || + other.maxFindNodeCount == maxFindNodeCount) && + (identical(other.getValueTimeoutMs, getValueTimeoutMs) || + other.getValueTimeoutMs == getValueTimeoutMs) && + (identical(other.getValueCount, getValueCount) || + other.getValueCount == getValueCount) && + (identical(other.getValueFanout, getValueFanout) || + other.getValueFanout == getValueFanout) && + (identical(other.setValueTimeoutMs, setValueTimeoutMs) || + other.setValueTimeoutMs == setValueTimeoutMs) && + (identical(other.setValueCount, setValueCount) || + other.setValueCount == setValueCount) && + (identical(other.setValueFanout, setValueFanout) || + other.setValueFanout == setValueFanout) && + (identical(other.minPeerCount, minPeerCount) || + other.minPeerCount == minPeerCount) && + (identical(other.minPeerRefreshTimeMs, minPeerRefreshTimeMs) || + other.minPeerRefreshTimeMs == minPeerRefreshTimeMs) && + (identical(other.validateDialInfoReceiptTimeMs, + validateDialInfoReceiptTimeMs) || + other.validateDialInfoReceiptTimeMs == + validateDialInfoReceiptTimeMs) && + (identical(other.localSubkeyCacheSize, localSubkeyCacheSize) || + other.localSubkeyCacheSize == localSubkeyCacheSize) && + (identical(other.localMaxSubkeyCacheMemoryMb, + localMaxSubkeyCacheMemoryMb) || + other.localMaxSubkeyCacheMemoryMb == + localMaxSubkeyCacheMemoryMb) && + (identical(other.remoteSubkeyCacheSize, remoteSubkeyCacheSize) || + other.remoteSubkeyCacheSize == remoteSubkeyCacheSize) && + (identical(other.remoteMaxRecords, remoteMaxRecords) || + other.remoteMaxRecords == remoteMaxRecords) && + (identical(other.remoteMaxSubkeyCacheMemoryMb, + remoteMaxSubkeyCacheMemoryMb) || + other.remoteMaxSubkeyCacheMemoryMb == + remoteMaxSubkeyCacheMemoryMb) && + (identical( + other.remoteMaxStorageSpaceMb, remoteMaxStorageSpaceMb) || + other.remoteMaxStorageSpaceMb == remoteMaxStorageSpaceMb)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hashAll([ + runtimeType, + resolveNodeTimeoutMs, + resolveNodeCount, + resolveNodeFanout, + maxFindNodeCount, + getValueTimeoutMs, + getValueCount, + getValueFanout, + setValueTimeoutMs, + setValueCount, + setValueFanout, + minPeerCount, + minPeerRefreshTimeMs, + validateDialInfoReceiptTimeMs, + localSubkeyCacheSize, + localMaxSubkeyCacheMemoryMb, + remoteSubkeyCacheSize, + remoteMaxRecords, + remoteMaxSubkeyCacheMemoryMb, + remoteMaxStorageSpaceMb + ]); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_VeilidConfigDHTCopyWith<_$_VeilidConfigDHT> get copyWith => + __$$_VeilidConfigDHTCopyWithImpl<_$_VeilidConfigDHT>(this, _$identity); + + @override + Map toJson() { + return _$$_VeilidConfigDHTToJson( + this, + ); + } +} + +abstract class _VeilidConfigDHT implements VeilidConfigDHT { + const factory _VeilidConfigDHT( + {required final int resolveNodeTimeoutMs, + required final int resolveNodeCount, + required final int resolveNodeFanout, + required final int maxFindNodeCount, + required final int getValueTimeoutMs, + required final int getValueCount, + required final int getValueFanout, + required final int setValueTimeoutMs, + required final int setValueCount, + required final int setValueFanout, + required final int minPeerCount, + required final int minPeerRefreshTimeMs, + required final int validateDialInfoReceiptTimeMs, + required final int localSubkeyCacheSize, + required final int localMaxSubkeyCacheMemoryMb, + required final int remoteSubkeyCacheSize, + required final int remoteMaxRecords, + required final int remoteMaxSubkeyCacheMemoryMb, + required final int remoteMaxStorageSpaceMb}) = _$_VeilidConfigDHT; + + factory _VeilidConfigDHT.fromJson(Map json) = + _$_VeilidConfigDHT.fromJson; + + @override + int get resolveNodeTimeoutMs; + @override + int get resolveNodeCount; + @override + int get resolveNodeFanout; + @override + int get maxFindNodeCount; + @override + int get getValueTimeoutMs; + @override + int get getValueCount; + @override + int get getValueFanout; + @override + int get setValueTimeoutMs; + @override + int get setValueCount; + @override + int get setValueFanout; + @override + int get minPeerCount; + @override + int get minPeerRefreshTimeMs; + @override + int get validateDialInfoReceiptTimeMs; + @override + int get localSubkeyCacheSize; + @override + int get localMaxSubkeyCacheMemoryMb; + @override + int get remoteSubkeyCacheSize; + @override + int get remoteMaxRecords; + @override + int get remoteMaxSubkeyCacheMemoryMb; + @override + int get remoteMaxStorageSpaceMb; + @override + @JsonKey(ignore: true) + _$$_VeilidConfigDHTCopyWith<_$_VeilidConfigDHT> get copyWith => + throw _privateConstructorUsedError; +} + +VeilidConfigRPC _$VeilidConfigRPCFromJson(Map json) { + return _VeilidConfigRPC.fromJson(json); +} + +/// @nodoc +mixin _$VeilidConfigRPC { + int get concurrency => throw _privateConstructorUsedError; + int get queueSize => throw _privateConstructorUsedError; + int? get maxTimestampBehindMs => throw _privateConstructorUsedError; + int? get maxTimestampAheadMs => throw _privateConstructorUsedError; + int get timeoutMs => throw _privateConstructorUsedError; + int get maxRouteHopCount => throw _privateConstructorUsedError; + int get defaultRouteHopCount => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $VeilidConfigRPCCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VeilidConfigRPCCopyWith<$Res> { + factory $VeilidConfigRPCCopyWith( + VeilidConfigRPC value, $Res Function(VeilidConfigRPC) then) = + _$VeilidConfigRPCCopyWithImpl<$Res, VeilidConfigRPC>; + @useResult + $Res call( + {int concurrency, + int queueSize, + int? maxTimestampBehindMs, + int? maxTimestampAheadMs, + int timeoutMs, + int maxRouteHopCount, + int defaultRouteHopCount}); +} + +/// @nodoc +class _$VeilidConfigRPCCopyWithImpl<$Res, $Val extends VeilidConfigRPC> + implements $VeilidConfigRPCCopyWith<$Res> { + _$VeilidConfigRPCCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? concurrency = null, + Object? queueSize = null, + Object? maxTimestampBehindMs = freezed, + Object? maxTimestampAheadMs = freezed, + Object? timeoutMs = null, + Object? maxRouteHopCount = null, + Object? defaultRouteHopCount = null, + }) { + return _then(_value.copyWith( + concurrency: null == concurrency + ? _value.concurrency + : concurrency // ignore: cast_nullable_to_non_nullable + as int, + queueSize: null == queueSize + ? _value.queueSize + : queueSize // ignore: cast_nullable_to_non_nullable + as int, + maxTimestampBehindMs: freezed == maxTimestampBehindMs + ? _value.maxTimestampBehindMs + : maxTimestampBehindMs // ignore: cast_nullable_to_non_nullable + as int?, + maxTimestampAheadMs: freezed == maxTimestampAheadMs + ? _value.maxTimestampAheadMs + : maxTimestampAheadMs // ignore: cast_nullable_to_non_nullable + as int?, + timeoutMs: null == timeoutMs + ? _value.timeoutMs + : timeoutMs // ignore: cast_nullable_to_non_nullable + as int, + maxRouteHopCount: null == maxRouteHopCount + ? _value.maxRouteHopCount + : maxRouteHopCount // ignore: cast_nullable_to_non_nullable + as int, + defaultRouteHopCount: null == defaultRouteHopCount + ? _value.defaultRouteHopCount + : defaultRouteHopCount // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_VeilidConfigRPCCopyWith<$Res> + implements $VeilidConfigRPCCopyWith<$Res> { + factory _$$_VeilidConfigRPCCopyWith( + _$_VeilidConfigRPC value, $Res Function(_$_VeilidConfigRPC) then) = + __$$_VeilidConfigRPCCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {int concurrency, + int queueSize, + int? maxTimestampBehindMs, + int? maxTimestampAheadMs, + int timeoutMs, + int maxRouteHopCount, + int defaultRouteHopCount}); +} + +/// @nodoc +class __$$_VeilidConfigRPCCopyWithImpl<$Res> + extends _$VeilidConfigRPCCopyWithImpl<$Res, _$_VeilidConfigRPC> + implements _$$_VeilidConfigRPCCopyWith<$Res> { + __$$_VeilidConfigRPCCopyWithImpl( + _$_VeilidConfigRPC _value, $Res Function(_$_VeilidConfigRPC) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? concurrency = null, + Object? queueSize = null, + Object? maxTimestampBehindMs = freezed, + Object? maxTimestampAheadMs = freezed, + Object? timeoutMs = null, + Object? maxRouteHopCount = null, + Object? defaultRouteHopCount = null, + }) { + return _then(_$_VeilidConfigRPC( + concurrency: null == concurrency + ? _value.concurrency + : concurrency // ignore: cast_nullable_to_non_nullable + as int, + queueSize: null == queueSize + ? _value.queueSize + : queueSize // ignore: cast_nullable_to_non_nullable + as int, + maxTimestampBehindMs: freezed == maxTimestampBehindMs + ? _value.maxTimestampBehindMs + : maxTimestampBehindMs // ignore: cast_nullable_to_non_nullable + as int?, + maxTimestampAheadMs: freezed == maxTimestampAheadMs + ? _value.maxTimestampAheadMs + : maxTimestampAheadMs // ignore: cast_nullable_to_non_nullable + as int?, + timeoutMs: null == timeoutMs + ? _value.timeoutMs + : timeoutMs // ignore: cast_nullable_to_non_nullable + as int, + maxRouteHopCount: null == maxRouteHopCount + ? _value.maxRouteHopCount + : maxRouteHopCount // ignore: cast_nullable_to_non_nullable + as int, + defaultRouteHopCount: null == defaultRouteHopCount + ? _value.defaultRouteHopCount + : defaultRouteHopCount // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_VeilidConfigRPC + with DiagnosticableTreeMixin + implements _VeilidConfigRPC { + const _$_VeilidConfigRPC( + {required this.concurrency, + required this.queueSize, + this.maxTimestampBehindMs, + this.maxTimestampAheadMs, + required this.timeoutMs, + required this.maxRouteHopCount, + required this.defaultRouteHopCount}); + + factory _$_VeilidConfigRPC.fromJson(Map json) => + _$$_VeilidConfigRPCFromJson(json); + + @override + final int concurrency; + @override + final int queueSize; + @override + final int? maxTimestampBehindMs; + @override + final int? maxTimestampAheadMs; + @override + final int timeoutMs; + @override + final int maxRouteHopCount; + @override + final int defaultRouteHopCount; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'VeilidConfigRPC(concurrency: $concurrency, queueSize: $queueSize, maxTimestampBehindMs: $maxTimestampBehindMs, maxTimestampAheadMs: $maxTimestampAheadMs, timeoutMs: $timeoutMs, maxRouteHopCount: $maxRouteHopCount, defaultRouteHopCount: $defaultRouteHopCount)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'VeilidConfigRPC')) + ..add(DiagnosticsProperty('concurrency', concurrency)) + ..add(DiagnosticsProperty('queueSize', queueSize)) + ..add(DiagnosticsProperty('maxTimestampBehindMs', maxTimestampBehindMs)) + ..add(DiagnosticsProperty('maxTimestampAheadMs', maxTimestampAheadMs)) + ..add(DiagnosticsProperty('timeoutMs', timeoutMs)) + ..add(DiagnosticsProperty('maxRouteHopCount', maxRouteHopCount)) + ..add(DiagnosticsProperty('defaultRouteHopCount', defaultRouteHopCount)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_VeilidConfigRPC && + (identical(other.concurrency, concurrency) || + other.concurrency == concurrency) && + (identical(other.queueSize, queueSize) || + other.queueSize == queueSize) && + (identical(other.maxTimestampBehindMs, maxTimestampBehindMs) || + other.maxTimestampBehindMs == maxTimestampBehindMs) && + (identical(other.maxTimestampAheadMs, maxTimestampAheadMs) || + other.maxTimestampAheadMs == maxTimestampAheadMs) && + (identical(other.timeoutMs, timeoutMs) || + other.timeoutMs == timeoutMs) && + (identical(other.maxRouteHopCount, maxRouteHopCount) || + other.maxRouteHopCount == maxRouteHopCount) && + (identical(other.defaultRouteHopCount, defaultRouteHopCount) || + other.defaultRouteHopCount == defaultRouteHopCount)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, + concurrency, + queueSize, + maxTimestampBehindMs, + maxTimestampAheadMs, + timeoutMs, + maxRouteHopCount, + defaultRouteHopCount); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_VeilidConfigRPCCopyWith<_$_VeilidConfigRPC> get copyWith => + __$$_VeilidConfigRPCCopyWithImpl<_$_VeilidConfigRPC>(this, _$identity); + + @override + Map toJson() { + return _$$_VeilidConfigRPCToJson( + this, + ); + } +} + +abstract class _VeilidConfigRPC implements VeilidConfigRPC { + const factory _VeilidConfigRPC( + {required final int concurrency, + required final int queueSize, + final int? maxTimestampBehindMs, + final int? maxTimestampAheadMs, + required final int timeoutMs, + required final int maxRouteHopCount, + required final int defaultRouteHopCount}) = _$_VeilidConfigRPC; + + factory _VeilidConfigRPC.fromJson(Map json) = + _$_VeilidConfigRPC.fromJson; + + @override + int get concurrency; + @override + int get queueSize; + @override + int? get maxTimestampBehindMs; + @override + int? get maxTimestampAheadMs; + @override + int get timeoutMs; + @override + int get maxRouteHopCount; + @override + int get defaultRouteHopCount; + @override + @JsonKey(ignore: true) + _$$_VeilidConfigRPCCopyWith<_$_VeilidConfigRPC> get copyWith => + throw _privateConstructorUsedError; +} + +VeilidConfigRoutingTable _$VeilidConfigRoutingTableFromJson( + Map json) { + return _VeilidConfigRoutingTable.fromJson(json); +} + +/// @nodoc +mixin _$VeilidConfigRoutingTable { + List> get nodeId => + throw _privateConstructorUsedError; + List> get nodeIdSecret => + throw _privateConstructorUsedError; + List get bootstrap => throw _privateConstructorUsedError; + int get limitOverAttached => throw _privateConstructorUsedError; + int get limitFullyAttached => throw _privateConstructorUsedError; + int get limitAttachedStrong => throw _privateConstructorUsedError; + int get limitAttachedGood => throw _privateConstructorUsedError; + int get limitAttachedWeak => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $VeilidConfigRoutingTableCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VeilidConfigRoutingTableCopyWith<$Res> { + factory $VeilidConfigRoutingTableCopyWith(VeilidConfigRoutingTable value, + $Res Function(VeilidConfigRoutingTable) then) = + _$VeilidConfigRoutingTableCopyWithImpl<$Res, VeilidConfigRoutingTable>; + @useResult + $Res call( + {List> nodeId, + List> nodeIdSecret, + List bootstrap, + int limitOverAttached, + int limitFullyAttached, + int limitAttachedStrong, + int limitAttachedGood, + int limitAttachedWeak}); +} + +/// @nodoc +class _$VeilidConfigRoutingTableCopyWithImpl<$Res, + $Val extends VeilidConfigRoutingTable> + implements $VeilidConfigRoutingTableCopyWith<$Res> { + _$VeilidConfigRoutingTableCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? nodeId = null, + Object? nodeIdSecret = null, + Object? bootstrap = null, + Object? limitOverAttached = null, + Object? limitFullyAttached = null, + Object? limitAttachedStrong = null, + Object? limitAttachedGood = null, + Object? limitAttachedWeak = null, + }) { + return _then(_value.copyWith( + nodeId: null == nodeId + ? _value.nodeId + : nodeId // ignore: cast_nullable_to_non_nullable + as List>, + nodeIdSecret: null == nodeIdSecret + ? _value.nodeIdSecret + : nodeIdSecret // ignore: cast_nullable_to_non_nullable + as List>, + bootstrap: null == bootstrap + ? _value.bootstrap + : bootstrap // ignore: cast_nullable_to_non_nullable + as List, + limitOverAttached: null == limitOverAttached + ? _value.limitOverAttached + : limitOverAttached // ignore: cast_nullable_to_non_nullable + as int, + limitFullyAttached: null == limitFullyAttached + ? _value.limitFullyAttached + : limitFullyAttached // ignore: cast_nullable_to_non_nullable + as int, + limitAttachedStrong: null == limitAttachedStrong + ? _value.limitAttachedStrong + : limitAttachedStrong // ignore: cast_nullable_to_non_nullable + as int, + limitAttachedGood: null == limitAttachedGood + ? _value.limitAttachedGood + : limitAttachedGood // ignore: cast_nullable_to_non_nullable + as int, + limitAttachedWeak: null == limitAttachedWeak + ? _value.limitAttachedWeak + : limitAttachedWeak // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_VeilidConfigRoutingTableCopyWith<$Res> + implements $VeilidConfigRoutingTableCopyWith<$Res> { + factory _$$_VeilidConfigRoutingTableCopyWith( + _$_VeilidConfigRoutingTable value, + $Res Function(_$_VeilidConfigRoutingTable) then) = + __$$_VeilidConfigRoutingTableCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {List> nodeId, + List> nodeIdSecret, + List bootstrap, + int limitOverAttached, + int limitFullyAttached, + int limitAttachedStrong, + int limitAttachedGood, + int limitAttachedWeak}); +} + +/// @nodoc +class __$$_VeilidConfigRoutingTableCopyWithImpl<$Res> + extends _$VeilidConfigRoutingTableCopyWithImpl<$Res, + _$_VeilidConfigRoutingTable> + implements _$$_VeilidConfigRoutingTableCopyWith<$Res> { + __$$_VeilidConfigRoutingTableCopyWithImpl(_$_VeilidConfigRoutingTable _value, + $Res Function(_$_VeilidConfigRoutingTable) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? nodeId = null, + Object? nodeIdSecret = null, + Object? bootstrap = null, + Object? limitOverAttached = null, + Object? limitFullyAttached = null, + Object? limitAttachedStrong = null, + Object? limitAttachedGood = null, + Object? limitAttachedWeak = null, + }) { + return _then(_$_VeilidConfigRoutingTable( + nodeId: null == nodeId + ? _value._nodeId + : nodeId // ignore: cast_nullable_to_non_nullable + as List>, + nodeIdSecret: null == nodeIdSecret + ? _value._nodeIdSecret + : nodeIdSecret // ignore: cast_nullable_to_non_nullable + as List>, + bootstrap: null == bootstrap + ? _value._bootstrap + : bootstrap // ignore: cast_nullable_to_non_nullable + as List, + limitOverAttached: null == limitOverAttached + ? _value.limitOverAttached + : limitOverAttached // ignore: cast_nullable_to_non_nullable + as int, + limitFullyAttached: null == limitFullyAttached + ? _value.limitFullyAttached + : limitFullyAttached // ignore: cast_nullable_to_non_nullable + as int, + limitAttachedStrong: null == limitAttachedStrong + ? _value.limitAttachedStrong + : limitAttachedStrong // ignore: cast_nullable_to_non_nullable + as int, + limitAttachedGood: null == limitAttachedGood + ? _value.limitAttachedGood + : limitAttachedGood // ignore: cast_nullable_to_non_nullable + as int, + limitAttachedWeak: null == limitAttachedWeak + ? _value.limitAttachedWeak + : limitAttachedWeak // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_VeilidConfigRoutingTable + with DiagnosticableTreeMixin + implements _VeilidConfigRoutingTable { + const _$_VeilidConfigRoutingTable( + {required final List> nodeId, + required final List> nodeIdSecret, + required final List bootstrap, + required this.limitOverAttached, + required this.limitFullyAttached, + required this.limitAttachedStrong, + required this.limitAttachedGood, + required this.limitAttachedWeak}) + : _nodeId = nodeId, + _nodeIdSecret = nodeIdSecret, + _bootstrap = bootstrap; + + factory _$_VeilidConfigRoutingTable.fromJson(Map json) => + _$$_VeilidConfigRoutingTableFromJson(json); + + final List> _nodeId; + @override + List> get nodeId { + if (_nodeId is EqualUnmodifiableListView) return _nodeId; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_nodeId); + } + + final List> _nodeIdSecret; + @override + List> get nodeIdSecret { + if (_nodeIdSecret is EqualUnmodifiableListView) return _nodeIdSecret; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_nodeIdSecret); + } + + final List _bootstrap; + @override + List get bootstrap { + if (_bootstrap is EqualUnmodifiableListView) return _bootstrap; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_bootstrap); + } + + @override + final int limitOverAttached; + @override + final int limitFullyAttached; + @override + final int limitAttachedStrong; + @override + final int limitAttachedGood; + @override + final int limitAttachedWeak; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'VeilidConfigRoutingTable(nodeId: $nodeId, nodeIdSecret: $nodeIdSecret, bootstrap: $bootstrap, limitOverAttached: $limitOverAttached, limitFullyAttached: $limitFullyAttached, limitAttachedStrong: $limitAttachedStrong, limitAttachedGood: $limitAttachedGood, limitAttachedWeak: $limitAttachedWeak)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'VeilidConfigRoutingTable')) + ..add(DiagnosticsProperty('nodeId', nodeId)) + ..add(DiagnosticsProperty('nodeIdSecret', nodeIdSecret)) + ..add(DiagnosticsProperty('bootstrap', bootstrap)) + ..add(DiagnosticsProperty('limitOverAttached', limitOverAttached)) + ..add(DiagnosticsProperty('limitFullyAttached', limitFullyAttached)) + ..add(DiagnosticsProperty('limitAttachedStrong', limitAttachedStrong)) + ..add(DiagnosticsProperty('limitAttachedGood', limitAttachedGood)) + ..add(DiagnosticsProperty('limitAttachedWeak', limitAttachedWeak)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_VeilidConfigRoutingTable && + const DeepCollectionEquality().equals(other._nodeId, _nodeId) && + const DeepCollectionEquality() + .equals(other._nodeIdSecret, _nodeIdSecret) && + const DeepCollectionEquality() + .equals(other._bootstrap, _bootstrap) && + (identical(other.limitOverAttached, limitOverAttached) || + other.limitOverAttached == limitOverAttached) && + (identical(other.limitFullyAttached, limitFullyAttached) || + other.limitFullyAttached == limitFullyAttached) && + (identical(other.limitAttachedStrong, limitAttachedStrong) || + other.limitAttachedStrong == limitAttachedStrong) && + (identical(other.limitAttachedGood, limitAttachedGood) || + other.limitAttachedGood == limitAttachedGood) && + (identical(other.limitAttachedWeak, limitAttachedWeak) || + other.limitAttachedWeak == limitAttachedWeak)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(_nodeId), + const DeepCollectionEquality().hash(_nodeIdSecret), + const DeepCollectionEquality().hash(_bootstrap), + limitOverAttached, + limitFullyAttached, + limitAttachedStrong, + limitAttachedGood, + limitAttachedWeak); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_VeilidConfigRoutingTableCopyWith<_$_VeilidConfigRoutingTable> + get copyWith => __$$_VeilidConfigRoutingTableCopyWithImpl< + _$_VeilidConfigRoutingTable>(this, _$identity); + + @override + Map toJson() { + return _$$_VeilidConfigRoutingTableToJson( + this, + ); + } +} + +abstract class _VeilidConfigRoutingTable implements VeilidConfigRoutingTable { + const factory _VeilidConfigRoutingTable( + {required final List> nodeId, + required final List> nodeIdSecret, + required final List bootstrap, + required final int limitOverAttached, + required final int limitFullyAttached, + required final int limitAttachedStrong, + required final int limitAttachedGood, + required final int limitAttachedWeak}) = _$_VeilidConfigRoutingTable; + + factory _VeilidConfigRoutingTable.fromJson(Map json) = + _$_VeilidConfigRoutingTable.fromJson; + + @override + List> get nodeId; + @override + List> get nodeIdSecret; + @override + List get bootstrap; + @override + int get limitOverAttached; + @override + int get limitFullyAttached; + @override + int get limitAttachedStrong; + @override + int get limitAttachedGood; + @override + int get limitAttachedWeak; + @override + @JsonKey(ignore: true) + _$$_VeilidConfigRoutingTableCopyWith<_$_VeilidConfigRoutingTable> + get copyWith => throw _privateConstructorUsedError; +} + +VeilidConfigNetwork _$VeilidConfigNetworkFromJson(Map json) { + return _VeilidConfigNetwork.fromJson(json); +} + +/// @nodoc +mixin _$VeilidConfigNetwork { + int get connectionInitialTimeoutMs => throw _privateConstructorUsedError; + int get connectionInactivityTimeoutMs => throw _privateConstructorUsedError; + int get maxConnectionsPerIp4 => throw _privateConstructorUsedError; + int get maxConnectionsPerIp6Prefix => throw _privateConstructorUsedError; + int get maxConnectionsPerIp6PrefixSize => throw _privateConstructorUsedError; + int get maxConnectionFrequencyPerMin => throw _privateConstructorUsedError; + int get clientWhitelistTimeoutMs => throw _privateConstructorUsedError; + int get reverseConnectionReceiptTimeMs => throw _privateConstructorUsedError; + int get holePunchReceiptTimeMs => throw _privateConstructorUsedError; + String? get networkKeyPassword => throw _privateConstructorUsedError; + VeilidConfigRoutingTable get routingTable => + throw _privateConstructorUsedError; + VeilidConfigRPC get rpc => throw _privateConstructorUsedError; + VeilidConfigDHT get dht => throw _privateConstructorUsedError; + bool get upnp => throw _privateConstructorUsedError; + bool get detectAddressChanges => throw _privateConstructorUsedError; + int get restrictedNatRetries => throw _privateConstructorUsedError; + VeilidConfigTLS get tls => throw _privateConstructorUsedError; + VeilidConfigApplication get application => throw _privateConstructorUsedError; + VeilidConfigProtocol get protocol => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $VeilidConfigNetworkCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VeilidConfigNetworkCopyWith<$Res> { + factory $VeilidConfigNetworkCopyWith( + VeilidConfigNetwork value, $Res Function(VeilidConfigNetwork) then) = + _$VeilidConfigNetworkCopyWithImpl<$Res, VeilidConfigNetwork>; + @useResult + $Res call( + {int connectionInitialTimeoutMs, + int connectionInactivityTimeoutMs, + int maxConnectionsPerIp4, + int maxConnectionsPerIp6Prefix, + int maxConnectionsPerIp6PrefixSize, + int maxConnectionFrequencyPerMin, + int clientWhitelistTimeoutMs, + int reverseConnectionReceiptTimeMs, + int holePunchReceiptTimeMs, + String? networkKeyPassword, + VeilidConfigRoutingTable routingTable, + VeilidConfigRPC rpc, + VeilidConfigDHT dht, + bool upnp, + bool detectAddressChanges, + int restrictedNatRetries, + VeilidConfigTLS tls, + VeilidConfigApplication application, + VeilidConfigProtocol protocol}); + + $VeilidConfigRoutingTableCopyWith<$Res> get routingTable; + $VeilidConfigRPCCopyWith<$Res> get rpc; + $VeilidConfigDHTCopyWith<$Res> get dht; + $VeilidConfigTLSCopyWith<$Res> get tls; + $VeilidConfigApplicationCopyWith<$Res> get application; + $VeilidConfigProtocolCopyWith<$Res> get protocol; +} + +/// @nodoc +class _$VeilidConfigNetworkCopyWithImpl<$Res, $Val extends VeilidConfigNetwork> + implements $VeilidConfigNetworkCopyWith<$Res> { + _$VeilidConfigNetworkCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? connectionInitialTimeoutMs = null, + Object? connectionInactivityTimeoutMs = null, + Object? maxConnectionsPerIp4 = null, + Object? maxConnectionsPerIp6Prefix = null, + Object? maxConnectionsPerIp6PrefixSize = null, + Object? maxConnectionFrequencyPerMin = null, + Object? clientWhitelistTimeoutMs = null, + Object? reverseConnectionReceiptTimeMs = null, + Object? holePunchReceiptTimeMs = null, + Object? networkKeyPassword = freezed, + Object? routingTable = null, + Object? rpc = null, + Object? dht = null, + Object? upnp = null, + Object? detectAddressChanges = null, + Object? restrictedNatRetries = null, + Object? tls = null, + Object? application = null, + Object? protocol = null, + }) { + return _then(_value.copyWith( + connectionInitialTimeoutMs: null == connectionInitialTimeoutMs + ? _value.connectionInitialTimeoutMs + : connectionInitialTimeoutMs // ignore: cast_nullable_to_non_nullable + as int, + connectionInactivityTimeoutMs: null == connectionInactivityTimeoutMs + ? _value.connectionInactivityTimeoutMs + : connectionInactivityTimeoutMs // ignore: cast_nullable_to_non_nullable + as int, + maxConnectionsPerIp4: null == maxConnectionsPerIp4 + ? _value.maxConnectionsPerIp4 + : maxConnectionsPerIp4 // ignore: cast_nullable_to_non_nullable + as int, + maxConnectionsPerIp6Prefix: null == maxConnectionsPerIp6Prefix + ? _value.maxConnectionsPerIp6Prefix + : maxConnectionsPerIp6Prefix // ignore: cast_nullable_to_non_nullable + as int, + maxConnectionsPerIp6PrefixSize: null == maxConnectionsPerIp6PrefixSize + ? _value.maxConnectionsPerIp6PrefixSize + : maxConnectionsPerIp6PrefixSize // ignore: cast_nullable_to_non_nullable + as int, + maxConnectionFrequencyPerMin: null == maxConnectionFrequencyPerMin + ? _value.maxConnectionFrequencyPerMin + : maxConnectionFrequencyPerMin // ignore: cast_nullable_to_non_nullable + as int, + clientWhitelistTimeoutMs: null == clientWhitelistTimeoutMs + ? _value.clientWhitelistTimeoutMs + : clientWhitelistTimeoutMs // ignore: cast_nullable_to_non_nullable + as int, + reverseConnectionReceiptTimeMs: null == reverseConnectionReceiptTimeMs + ? _value.reverseConnectionReceiptTimeMs + : reverseConnectionReceiptTimeMs // ignore: cast_nullable_to_non_nullable + as int, + holePunchReceiptTimeMs: null == holePunchReceiptTimeMs + ? _value.holePunchReceiptTimeMs + : holePunchReceiptTimeMs // ignore: cast_nullable_to_non_nullable + as int, + networkKeyPassword: freezed == networkKeyPassword + ? _value.networkKeyPassword + : networkKeyPassword // ignore: cast_nullable_to_non_nullable + as String?, + routingTable: null == routingTable + ? _value.routingTable + : routingTable // ignore: cast_nullable_to_non_nullable + as VeilidConfigRoutingTable, + rpc: null == rpc + ? _value.rpc + : rpc // ignore: cast_nullable_to_non_nullable + as VeilidConfigRPC, + dht: null == dht + ? _value.dht + : dht // ignore: cast_nullable_to_non_nullable + as VeilidConfigDHT, + upnp: null == upnp + ? _value.upnp + : upnp // ignore: cast_nullable_to_non_nullable + as bool, + detectAddressChanges: null == detectAddressChanges + ? _value.detectAddressChanges + : detectAddressChanges // ignore: cast_nullable_to_non_nullable + as bool, + restrictedNatRetries: null == restrictedNatRetries + ? _value.restrictedNatRetries + : restrictedNatRetries // ignore: cast_nullable_to_non_nullable + as int, + tls: null == tls + ? _value.tls + : tls // ignore: cast_nullable_to_non_nullable + as VeilidConfigTLS, + application: null == application + ? _value.application + : application // ignore: cast_nullable_to_non_nullable + as VeilidConfigApplication, + protocol: null == protocol + ? _value.protocol + : protocol // ignore: cast_nullable_to_non_nullable + as VeilidConfigProtocol, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $VeilidConfigRoutingTableCopyWith<$Res> get routingTable { + return $VeilidConfigRoutingTableCopyWith<$Res>(_value.routingTable, + (value) { + return _then(_value.copyWith(routingTable: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $VeilidConfigRPCCopyWith<$Res> get rpc { + return $VeilidConfigRPCCopyWith<$Res>(_value.rpc, (value) { + return _then(_value.copyWith(rpc: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $VeilidConfigDHTCopyWith<$Res> get dht { + return $VeilidConfigDHTCopyWith<$Res>(_value.dht, (value) { + return _then(_value.copyWith(dht: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $VeilidConfigTLSCopyWith<$Res> get tls { + return $VeilidConfigTLSCopyWith<$Res>(_value.tls, (value) { + return _then(_value.copyWith(tls: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $VeilidConfigApplicationCopyWith<$Res> get application { + return $VeilidConfigApplicationCopyWith<$Res>(_value.application, (value) { + return _then(_value.copyWith(application: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $VeilidConfigProtocolCopyWith<$Res> get protocol { + return $VeilidConfigProtocolCopyWith<$Res>(_value.protocol, (value) { + return _then(_value.copyWith(protocol: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$_VeilidConfigNetworkCopyWith<$Res> + implements $VeilidConfigNetworkCopyWith<$Res> { + factory _$$_VeilidConfigNetworkCopyWith(_$_VeilidConfigNetwork value, + $Res Function(_$_VeilidConfigNetwork) then) = + __$$_VeilidConfigNetworkCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {int connectionInitialTimeoutMs, + int connectionInactivityTimeoutMs, + int maxConnectionsPerIp4, + int maxConnectionsPerIp6Prefix, + int maxConnectionsPerIp6PrefixSize, + int maxConnectionFrequencyPerMin, + int clientWhitelistTimeoutMs, + int reverseConnectionReceiptTimeMs, + int holePunchReceiptTimeMs, + String? networkKeyPassword, + VeilidConfigRoutingTable routingTable, + VeilidConfigRPC rpc, + VeilidConfigDHT dht, + bool upnp, + bool detectAddressChanges, + int restrictedNatRetries, + VeilidConfigTLS tls, + VeilidConfigApplication application, + VeilidConfigProtocol protocol}); + + @override + $VeilidConfigRoutingTableCopyWith<$Res> get routingTable; + @override + $VeilidConfigRPCCopyWith<$Res> get rpc; + @override + $VeilidConfigDHTCopyWith<$Res> get dht; + @override + $VeilidConfigTLSCopyWith<$Res> get tls; + @override + $VeilidConfigApplicationCopyWith<$Res> get application; + @override + $VeilidConfigProtocolCopyWith<$Res> get protocol; +} + +/// @nodoc +class __$$_VeilidConfigNetworkCopyWithImpl<$Res> + extends _$VeilidConfigNetworkCopyWithImpl<$Res, _$_VeilidConfigNetwork> + implements _$$_VeilidConfigNetworkCopyWith<$Res> { + __$$_VeilidConfigNetworkCopyWithImpl(_$_VeilidConfigNetwork _value, + $Res Function(_$_VeilidConfigNetwork) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? connectionInitialTimeoutMs = null, + Object? connectionInactivityTimeoutMs = null, + Object? maxConnectionsPerIp4 = null, + Object? maxConnectionsPerIp6Prefix = null, + Object? maxConnectionsPerIp6PrefixSize = null, + Object? maxConnectionFrequencyPerMin = null, + Object? clientWhitelistTimeoutMs = null, + Object? reverseConnectionReceiptTimeMs = null, + Object? holePunchReceiptTimeMs = null, + Object? networkKeyPassword = freezed, + Object? routingTable = null, + Object? rpc = null, + Object? dht = null, + Object? upnp = null, + Object? detectAddressChanges = null, + Object? restrictedNatRetries = null, + Object? tls = null, + Object? application = null, + Object? protocol = null, + }) { + return _then(_$_VeilidConfigNetwork( + connectionInitialTimeoutMs: null == connectionInitialTimeoutMs + ? _value.connectionInitialTimeoutMs + : connectionInitialTimeoutMs // ignore: cast_nullable_to_non_nullable + as int, + connectionInactivityTimeoutMs: null == connectionInactivityTimeoutMs + ? _value.connectionInactivityTimeoutMs + : connectionInactivityTimeoutMs // ignore: cast_nullable_to_non_nullable + as int, + maxConnectionsPerIp4: null == maxConnectionsPerIp4 + ? _value.maxConnectionsPerIp4 + : maxConnectionsPerIp4 // ignore: cast_nullable_to_non_nullable + as int, + maxConnectionsPerIp6Prefix: null == maxConnectionsPerIp6Prefix + ? _value.maxConnectionsPerIp6Prefix + : maxConnectionsPerIp6Prefix // ignore: cast_nullable_to_non_nullable + as int, + maxConnectionsPerIp6PrefixSize: null == maxConnectionsPerIp6PrefixSize + ? _value.maxConnectionsPerIp6PrefixSize + : maxConnectionsPerIp6PrefixSize // ignore: cast_nullable_to_non_nullable + as int, + maxConnectionFrequencyPerMin: null == maxConnectionFrequencyPerMin + ? _value.maxConnectionFrequencyPerMin + : maxConnectionFrequencyPerMin // ignore: cast_nullable_to_non_nullable + as int, + clientWhitelistTimeoutMs: null == clientWhitelistTimeoutMs + ? _value.clientWhitelistTimeoutMs + : clientWhitelistTimeoutMs // ignore: cast_nullable_to_non_nullable + as int, + reverseConnectionReceiptTimeMs: null == reverseConnectionReceiptTimeMs + ? _value.reverseConnectionReceiptTimeMs + : reverseConnectionReceiptTimeMs // ignore: cast_nullable_to_non_nullable + as int, + holePunchReceiptTimeMs: null == holePunchReceiptTimeMs + ? _value.holePunchReceiptTimeMs + : holePunchReceiptTimeMs // ignore: cast_nullable_to_non_nullable + as int, + networkKeyPassword: freezed == networkKeyPassword + ? _value.networkKeyPassword + : networkKeyPassword // ignore: cast_nullable_to_non_nullable + as String?, + routingTable: null == routingTable + ? _value.routingTable + : routingTable // ignore: cast_nullable_to_non_nullable + as VeilidConfigRoutingTable, + rpc: null == rpc + ? _value.rpc + : rpc // ignore: cast_nullable_to_non_nullable + as VeilidConfigRPC, + dht: null == dht + ? _value.dht + : dht // ignore: cast_nullable_to_non_nullable + as VeilidConfigDHT, + upnp: null == upnp + ? _value.upnp + : upnp // ignore: cast_nullable_to_non_nullable + as bool, + detectAddressChanges: null == detectAddressChanges + ? _value.detectAddressChanges + : detectAddressChanges // ignore: cast_nullable_to_non_nullable + as bool, + restrictedNatRetries: null == restrictedNatRetries + ? _value.restrictedNatRetries + : restrictedNatRetries // ignore: cast_nullable_to_non_nullable + as int, + tls: null == tls + ? _value.tls + : tls // ignore: cast_nullable_to_non_nullable + as VeilidConfigTLS, + application: null == application + ? _value.application + : application // ignore: cast_nullable_to_non_nullable + as VeilidConfigApplication, + protocol: null == protocol + ? _value.protocol + : protocol // ignore: cast_nullable_to_non_nullable + as VeilidConfigProtocol, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_VeilidConfigNetwork + with DiagnosticableTreeMixin + implements _VeilidConfigNetwork { + const _$_VeilidConfigNetwork( + {required this.connectionInitialTimeoutMs, + required this.connectionInactivityTimeoutMs, + required this.maxConnectionsPerIp4, + required this.maxConnectionsPerIp6Prefix, + required this.maxConnectionsPerIp6PrefixSize, + required this.maxConnectionFrequencyPerMin, + required this.clientWhitelistTimeoutMs, + required this.reverseConnectionReceiptTimeMs, + required this.holePunchReceiptTimeMs, + this.networkKeyPassword, + required this.routingTable, + required this.rpc, + required this.dht, + required this.upnp, + required this.detectAddressChanges, + required this.restrictedNatRetries, + required this.tls, + required this.application, + required this.protocol}); + + factory _$_VeilidConfigNetwork.fromJson(Map json) => + _$$_VeilidConfigNetworkFromJson(json); + + @override + final int connectionInitialTimeoutMs; + @override + final int connectionInactivityTimeoutMs; + @override + final int maxConnectionsPerIp4; + @override + final int maxConnectionsPerIp6Prefix; + @override + final int maxConnectionsPerIp6PrefixSize; + @override + final int maxConnectionFrequencyPerMin; + @override + final int clientWhitelistTimeoutMs; + @override + final int reverseConnectionReceiptTimeMs; + @override + final int holePunchReceiptTimeMs; + @override + final String? networkKeyPassword; + @override + final VeilidConfigRoutingTable routingTable; + @override + final VeilidConfigRPC rpc; + @override + final VeilidConfigDHT dht; + @override + final bool upnp; + @override + final bool detectAddressChanges; + @override + final int restrictedNatRetries; + @override + final VeilidConfigTLS tls; + @override + final VeilidConfigApplication application; + @override + final VeilidConfigProtocol protocol; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'VeilidConfigNetwork(connectionInitialTimeoutMs: $connectionInitialTimeoutMs, connectionInactivityTimeoutMs: $connectionInactivityTimeoutMs, maxConnectionsPerIp4: $maxConnectionsPerIp4, maxConnectionsPerIp6Prefix: $maxConnectionsPerIp6Prefix, maxConnectionsPerIp6PrefixSize: $maxConnectionsPerIp6PrefixSize, maxConnectionFrequencyPerMin: $maxConnectionFrequencyPerMin, clientWhitelistTimeoutMs: $clientWhitelistTimeoutMs, reverseConnectionReceiptTimeMs: $reverseConnectionReceiptTimeMs, holePunchReceiptTimeMs: $holePunchReceiptTimeMs, networkKeyPassword: $networkKeyPassword, routingTable: $routingTable, rpc: $rpc, dht: $dht, upnp: $upnp, detectAddressChanges: $detectAddressChanges, restrictedNatRetries: $restrictedNatRetries, tls: $tls, application: $application, protocol: $protocol)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'VeilidConfigNetwork')) + ..add(DiagnosticsProperty( + 'connectionInitialTimeoutMs', connectionInitialTimeoutMs)) + ..add(DiagnosticsProperty( + 'connectionInactivityTimeoutMs', connectionInactivityTimeoutMs)) + ..add(DiagnosticsProperty('maxConnectionsPerIp4', maxConnectionsPerIp4)) + ..add(DiagnosticsProperty( + 'maxConnectionsPerIp6Prefix', maxConnectionsPerIp6Prefix)) + ..add(DiagnosticsProperty( + 'maxConnectionsPerIp6PrefixSize', maxConnectionsPerIp6PrefixSize)) + ..add(DiagnosticsProperty( + 'maxConnectionFrequencyPerMin', maxConnectionFrequencyPerMin)) + ..add(DiagnosticsProperty( + 'clientWhitelistTimeoutMs', clientWhitelistTimeoutMs)) + ..add(DiagnosticsProperty( + 'reverseConnectionReceiptTimeMs', reverseConnectionReceiptTimeMs)) + ..add( + DiagnosticsProperty('holePunchReceiptTimeMs', holePunchReceiptTimeMs)) + ..add(DiagnosticsProperty('networkKeyPassword', networkKeyPassword)) + ..add(DiagnosticsProperty('routingTable', routingTable)) + ..add(DiagnosticsProperty('rpc', rpc)) + ..add(DiagnosticsProperty('dht', dht)) + ..add(DiagnosticsProperty('upnp', upnp)) + ..add(DiagnosticsProperty('detectAddressChanges', detectAddressChanges)) + ..add(DiagnosticsProperty('restrictedNatRetries', restrictedNatRetries)) + ..add(DiagnosticsProperty('tls', tls)) + ..add(DiagnosticsProperty('application', application)) + ..add(DiagnosticsProperty('protocol', protocol)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_VeilidConfigNetwork && + (identical(other.connectionInitialTimeoutMs, connectionInitialTimeoutMs) || + other.connectionInitialTimeoutMs == + connectionInitialTimeoutMs) && + (identical(other.connectionInactivityTimeoutMs, connectionInactivityTimeoutMs) || + other.connectionInactivityTimeoutMs == + connectionInactivityTimeoutMs) && + (identical(other.maxConnectionsPerIp4, maxConnectionsPerIp4) || + other.maxConnectionsPerIp4 == maxConnectionsPerIp4) && + (identical(other.maxConnectionsPerIp6Prefix, maxConnectionsPerIp6Prefix) || + other.maxConnectionsPerIp6Prefix == + maxConnectionsPerIp6Prefix) && + (identical(other.maxConnectionsPerIp6PrefixSize, maxConnectionsPerIp6PrefixSize) || + other.maxConnectionsPerIp6PrefixSize == + maxConnectionsPerIp6PrefixSize) && + (identical(other.maxConnectionFrequencyPerMin, maxConnectionFrequencyPerMin) || + other.maxConnectionFrequencyPerMin == + maxConnectionFrequencyPerMin) && + (identical(other.clientWhitelistTimeoutMs, clientWhitelistTimeoutMs) || + other.clientWhitelistTimeoutMs == clientWhitelistTimeoutMs) && + (identical(other.reverseConnectionReceiptTimeMs, + reverseConnectionReceiptTimeMs) || + other.reverseConnectionReceiptTimeMs == + reverseConnectionReceiptTimeMs) && + (identical(other.holePunchReceiptTimeMs, holePunchReceiptTimeMs) || + other.holePunchReceiptTimeMs == holePunchReceiptTimeMs) && + (identical(other.networkKeyPassword, networkKeyPassword) || + other.networkKeyPassword == networkKeyPassword) && + (identical(other.routingTable, routingTable) || + other.routingTable == routingTable) && + (identical(other.rpc, rpc) || other.rpc == rpc) && + (identical(other.dht, dht) || other.dht == dht) && + (identical(other.upnp, upnp) || other.upnp == upnp) && + (identical(other.detectAddressChanges, detectAddressChanges) || + other.detectAddressChanges == detectAddressChanges) && + (identical(other.restrictedNatRetries, restrictedNatRetries) || + other.restrictedNatRetries == restrictedNatRetries) && + (identical(other.tls, tls) || other.tls == tls) && + (identical(other.application, application) || + other.application == application) && + (identical(other.protocol, protocol) || + other.protocol == protocol)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hashAll([ + runtimeType, + connectionInitialTimeoutMs, + connectionInactivityTimeoutMs, + maxConnectionsPerIp4, + maxConnectionsPerIp6Prefix, + maxConnectionsPerIp6PrefixSize, + maxConnectionFrequencyPerMin, + clientWhitelistTimeoutMs, + reverseConnectionReceiptTimeMs, + holePunchReceiptTimeMs, + networkKeyPassword, + routingTable, + rpc, + dht, + upnp, + detectAddressChanges, + restrictedNatRetries, + tls, + application, + protocol + ]); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_VeilidConfigNetworkCopyWith<_$_VeilidConfigNetwork> get copyWith => + __$$_VeilidConfigNetworkCopyWithImpl<_$_VeilidConfigNetwork>( + this, _$identity); + + @override + Map toJson() { + return _$$_VeilidConfigNetworkToJson( + this, + ); + } +} + +abstract class _VeilidConfigNetwork implements VeilidConfigNetwork { + const factory _VeilidConfigNetwork( + {required final int connectionInitialTimeoutMs, + required final int connectionInactivityTimeoutMs, + required final int maxConnectionsPerIp4, + required final int maxConnectionsPerIp6Prefix, + required final int maxConnectionsPerIp6PrefixSize, + required final int maxConnectionFrequencyPerMin, + required final int clientWhitelistTimeoutMs, + required final int reverseConnectionReceiptTimeMs, + required final int holePunchReceiptTimeMs, + final String? networkKeyPassword, + required final VeilidConfigRoutingTable routingTable, + required final VeilidConfigRPC rpc, + required final VeilidConfigDHT dht, + required final bool upnp, + required final bool detectAddressChanges, + required final int restrictedNatRetries, + required final VeilidConfigTLS tls, + required final VeilidConfigApplication application, + required final VeilidConfigProtocol protocol}) = _$_VeilidConfigNetwork; + + factory _VeilidConfigNetwork.fromJson(Map json) = + _$_VeilidConfigNetwork.fromJson; + + @override + int get connectionInitialTimeoutMs; + @override + int get connectionInactivityTimeoutMs; + @override + int get maxConnectionsPerIp4; + @override + int get maxConnectionsPerIp6Prefix; + @override + int get maxConnectionsPerIp6PrefixSize; + @override + int get maxConnectionFrequencyPerMin; + @override + int get clientWhitelistTimeoutMs; + @override + int get reverseConnectionReceiptTimeMs; + @override + int get holePunchReceiptTimeMs; + @override + String? get networkKeyPassword; + @override + VeilidConfigRoutingTable get routingTable; + @override + VeilidConfigRPC get rpc; + @override + VeilidConfigDHT get dht; + @override + bool get upnp; + @override + bool get detectAddressChanges; + @override + int get restrictedNatRetries; + @override + VeilidConfigTLS get tls; + @override + VeilidConfigApplication get application; + @override + VeilidConfigProtocol get protocol; + @override + @JsonKey(ignore: true) + _$$_VeilidConfigNetworkCopyWith<_$_VeilidConfigNetwork> get copyWith => + throw _privateConstructorUsedError; +} + +VeilidConfigTableStore _$VeilidConfigTableStoreFromJson( + Map json) { + return _VeilidConfigTableStore.fromJson(json); +} + +/// @nodoc +mixin _$VeilidConfigTableStore { + String get directory => throw _privateConstructorUsedError; + bool get delete => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $VeilidConfigTableStoreCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VeilidConfigTableStoreCopyWith<$Res> { + factory $VeilidConfigTableStoreCopyWith(VeilidConfigTableStore value, + $Res Function(VeilidConfigTableStore) then) = + _$VeilidConfigTableStoreCopyWithImpl<$Res, VeilidConfigTableStore>; + @useResult + $Res call({String directory, bool delete}); +} + +/// @nodoc +class _$VeilidConfigTableStoreCopyWithImpl<$Res, + $Val extends VeilidConfigTableStore> + implements $VeilidConfigTableStoreCopyWith<$Res> { + _$VeilidConfigTableStoreCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? directory = null, + Object? delete = null, + }) { + return _then(_value.copyWith( + directory: null == directory + ? _value.directory + : directory // ignore: cast_nullable_to_non_nullable + as String, + delete: null == delete + ? _value.delete + : delete // ignore: cast_nullable_to_non_nullable + as bool, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_VeilidConfigTableStoreCopyWith<$Res> + implements $VeilidConfigTableStoreCopyWith<$Res> { + factory _$$_VeilidConfigTableStoreCopyWith(_$_VeilidConfigTableStore value, + $Res Function(_$_VeilidConfigTableStore) then) = + __$$_VeilidConfigTableStoreCopyWithImpl<$Res>; + @override + @useResult + $Res call({String directory, bool delete}); +} + +/// @nodoc +class __$$_VeilidConfigTableStoreCopyWithImpl<$Res> + extends _$VeilidConfigTableStoreCopyWithImpl<$Res, + _$_VeilidConfigTableStore> + implements _$$_VeilidConfigTableStoreCopyWith<$Res> { + __$$_VeilidConfigTableStoreCopyWithImpl(_$_VeilidConfigTableStore _value, + $Res Function(_$_VeilidConfigTableStore) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? directory = null, + Object? delete = null, + }) { + return _then(_$_VeilidConfigTableStore( + directory: null == directory + ? _value.directory + : directory // ignore: cast_nullable_to_non_nullable + as String, + delete: null == delete + ? _value.delete + : delete // ignore: cast_nullable_to_non_nullable + as bool, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_VeilidConfigTableStore + with DiagnosticableTreeMixin + implements _VeilidConfigTableStore { + const _$_VeilidConfigTableStore( + {required this.directory, required this.delete}); + + factory _$_VeilidConfigTableStore.fromJson(Map json) => + _$$_VeilidConfigTableStoreFromJson(json); + + @override + final String directory; + @override + final bool delete; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'VeilidConfigTableStore(directory: $directory, delete: $delete)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'VeilidConfigTableStore')) + ..add(DiagnosticsProperty('directory', directory)) + ..add(DiagnosticsProperty('delete', delete)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_VeilidConfigTableStore && + (identical(other.directory, directory) || + other.directory == directory) && + (identical(other.delete, delete) || other.delete == delete)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, directory, delete); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_VeilidConfigTableStoreCopyWith<_$_VeilidConfigTableStore> get copyWith => + __$$_VeilidConfigTableStoreCopyWithImpl<_$_VeilidConfigTableStore>( + this, _$identity); + + @override + Map toJson() { + return _$$_VeilidConfigTableStoreToJson( + this, + ); + } +} + +abstract class _VeilidConfigTableStore implements VeilidConfigTableStore { + const factory _VeilidConfigTableStore( + {required final String directory, + required final bool delete}) = _$_VeilidConfigTableStore; + + factory _VeilidConfigTableStore.fromJson(Map json) = + _$_VeilidConfigTableStore.fromJson; + + @override + String get directory; + @override + bool get delete; + @override + @JsonKey(ignore: true) + _$$_VeilidConfigTableStoreCopyWith<_$_VeilidConfigTableStore> get copyWith => + throw _privateConstructorUsedError; +} + +VeilidConfigBlockStore _$VeilidConfigBlockStoreFromJson( + Map json) { + return _VeilidConfigBlockStore.fromJson(json); +} + +/// @nodoc +mixin _$VeilidConfigBlockStore { + String get directory => throw _privateConstructorUsedError; + bool get delete => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $VeilidConfigBlockStoreCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VeilidConfigBlockStoreCopyWith<$Res> { + factory $VeilidConfigBlockStoreCopyWith(VeilidConfigBlockStore value, + $Res Function(VeilidConfigBlockStore) then) = + _$VeilidConfigBlockStoreCopyWithImpl<$Res, VeilidConfigBlockStore>; + @useResult + $Res call({String directory, bool delete}); +} + +/// @nodoc +class _$VeilidConfigBlockStoreCopyWithImpl<$Res, + $Val extends VeilidConfigBlockStore> + implements $VeilidConfigBlockStoreCopyWith<$Res> { + _$VeilidConfigBlockStoreCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? directory = null, + Object? delete = null, + }) { + return _then(_value.copyWith( + directory: null == directory + ? _value.directory + : directory // ignore: cast_nullable_to_non_nullable + as String, + delete: null == delete + ? _value.delete + : delete // ignore: cast_nullable_to_non_nullable + as bool, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_VeilidConfigBlockStoreCopyWith<$Res> + implements $VeilidConfigBlockStoreCopyWith<$Res> { + factory _$$_VeilidConfigBlockStoreCopyWith(_$_VeilidConfigBlockStore value, + $Res Function(_$_VeilidConfigBlockStore) then) = + __$$_VeilidConfigBlockStoreCopyWithImpl<$Res>; + @override + @useResult + $Res call({String directory, bool delete}); +} + +/// @nodoc +class __$$_VeilidConfigBlockStoreCopyWithImpl<$Res> + extends _$VeilidConfigBlockStoreCopyWithImpl<$Res, + _$_VeilidConfigBlockStore> + implements _$$_VeilidConfigBlockStoreCopyWith<$Res> { + __$$_VeilidConfigBlockStoreCopyWithImpl(_$_VeilidConfigBlockStore _value, + $Res Function(_$_VeilidConfigBlockStore) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? directory = null, + Object? delete = null, + }) { + return _then(_$_VeilidConfigBlockStore( + directory: null == directory + ? _value.directory + : directory // ignore: cast_nullable_to_non_nullable + as String, + delete: null == delete + ? _value.delete + : delete // ignore: cast_nullable_to_non_nullable + as bool, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_VeilidConfigBlockStore + with DiagnosticableTreeMixin + implements _VeilidConfigBlockStore { + const _$_VeilidConfigBlockStore( + {required this.directory, required this.delete}); + + factory _$_VeilidConfigBlockStore.fromJson(Map json) => + _$$_VeilidConfigBlockStoreFromJson(json); + + @override + final String directory; + @override + final bool delete; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'VeilidConfigBlockStore(directory: $directory, delete: $delete)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'VeilidConfigBlockStore')) + ..add(DiagnosticsProperty('directory', directory)) + ..add(DiagnosticsProperty('delete', delete)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_VeilidConfigBlockStore && + (identical(other.directory, directory) || + other.directory == directory) && + (identical(other.delete, delete) || other.delete == delete)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, directory, delete); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_VeilidConfigBlockStoreCopyWith<_$_VeilidConfigBlockStore> get copyWith => + __$$_VeilidConfigBlockStoreCopyWithImpl<_$_VeilidConfigBlockStore>( + this, _$identity); + + @override + Map toJson() { + return _$$_VeilidConfigBlockStoreToJson( + this, + ); + } +} + +abstract class _VeilidConfigBlockStore implements VeilidConfigBlockStore { + const factory _VeilidConfigBlockStore( + {required final String directory, + required final bool delete}) = _$_VeilidConfigBlockStore; + + factory _VeilidConfigBlockStore.fromJson(Map json) = + _$_VeilidConfigBlockStore.fromJson; + + @override + String get directory; + @override + bool get delete; + @override + @JsonKey(ignore: true) + _$$_VeilidConfigBlockStoreCopyWith<_$_VeilidConfigBlockStore> get copyWith => + throw _privateConstructorUsedError; +} + +VeilidConfigProtectedStore _$VeilidConfigProtectedStoreFromJson( + Map json) { + return _VeilidConfigProtectedStore.fromJson(json); +} + +/// @nodoc +mixin _$VeilidConfigProtectedStore { + bool get allowInsecureFallback => throw _privateConstructorUsedError; + bool get alwaysUseInsecureStorage => throw _privateConstructorUsedError; + String get directory => throw _privateConstructorUsedError; + bool get delete => throw _privateConstructorUsedError; + String get deviceEncryptionKeyPassword => throw _privateConstructorUsedError; + String? get newDeviceEncryptionKeyPassword => + throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $VeilidConfigProtectedStoreCopyWith + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VeilidConfigProtectedStoreCopyWith<$Res> { + factory $VeilidConfigProtectedStoreCopyWith(VeilidConfigProtectedStore value, + $Res Function(VeilidConfigProtectedStore) then) = + _$VeilidConfigProtectedStoreCopyWithImpl<$Res, + VeilidConfigProtectedStore>; + @useResult + $Res call( + {bool allowInsecureFallback, + bool alwaysUseInsecureStorage, + String directory, + bool delete, + String deviceEncryptionKeyPassword, + String? newDeviceEncryptionKeyPassword}); +} + +/// @nodoc +class _$VeilidConfigProtectedStoreCopyWithImpl<$Res, + $Val extends VeilidConfigProtectedStore> + implements $VeilidConfigProtectedStoreCopyWith<$Res> { + _$VeilidConfigProtectedStoreCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? allowInsecureFallback = null, + Object? alwaysUseInsecureStorage = null, + Object? directory = null, + Object? delete = null, + Object? deviceEncryptionKeyPassword = null, + Object? newDeviceEncryptionKeyPassword = freezed, + }) { + return _then(_value.copyWith( + allowInsecureFallback: null == allowInsecureFallback + ? _value.allowInsecureFallback + : allowInsecureFallback // ignore: cast_nullable_to_non_nullable + as bool, + alwaysUseInsecureStorage: null == alwaysUseInsecureStorage + ? _value.alwaysUseInsecureStorage + : alwaysUseInsecureStorage // ignore: cast_nullable_to_non_nullable + as bool, + directory: null == directory + ? _value.directory + : directory // ignore: cast_nullable_to_non_nullable + as String, + delete: null == delete + ? _value.delete + : delete // ignore: cast_nullable_to_non_nullable + as bool, + deviceEncryptionKeyPassword: null == deviceEncryptionKeyPassword + ? _value.deviceEncryptionKeyPassword + : deviceEncryptionKeyPassword // ignore: cast_nullable_to_non_nullable + as String, + newDeviceEncryptionKeyPassword: freezed == newDeviceEncryptionKeyPassword + ? _value.newDeviceEncryptionKeyPassword + : newDeviceEncryptionKeyPassword // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_VeilidConfigProtectedStoreCopyWith<$Res> + implements $VeilidConfigProtectedStoreCopyWith<$Res> { + factory _$$_VeilidConfigProtectedStoreCopyWith( + _$_VeilidConfigProtectedStore value, + $Res Function(_$_VeilidConfigProtectedStore) then) = + __$$_VeilidConfigProtectedStoreCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {bool allowInsecureFallback, + bool alwaysUseInsecureStorage, + String directory, + bool delete, + String deviceEncryptionKeyPassword, + String? newDeviceEncryptionKeyPassword}); +} + +/// @nodoc +class __$$_VeilidConfigProtectedStoreCopyWithImpl<$Res> + extends _$VeilidConfigProtectedStoreCopyWithImpl<$Res, + _$_VeilidConfigProtectedStore> + implements _$$_VeilidConfigProtectedStoreCopyWith<$Res> { + __$$_VeilidConfigProtectedStoreCopyWithImpl( + _$_VeilidConfigProtectedStore _value, + $Res Function(_$_VeilidConfigProtectedStore) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? allowInsecureFallback = null, + Object? alwaysUseInsecureStorage = null, + Object? directory = null, + Object? delete = null, + Object? deviceEncryptionKeyPassword = null, + Object? newDeviceEncryptionKeyPassword = freezed, + }) { + return _then(_$_VeilidConfigProtectedStore( + allowInsecureFallback: null == allowInsecureFallback + ? _value.allowInsecureFallback + : allowInsecureFallback // ignore: cast_nullable_to_non_nullable + as bool, + alwaysUseInsecureStorage: null == alwaysUseInsecureStorage + ? _value.alwaysUseInsecureStorage + : alwaysUseInsecureStorage // ignore: cast_nullable_to_non_nullable + as bool, + directory: null == directory + ? _value.directory + : directory // ignore: cast_nullable_to_non_nullable + as String, + delete: null == delete + ? _value.delete + : delete // ignore: cast_nullable_to_non_nullable + as bool, + deviceEncryptionKeyPassword: null == deviceEncryptionKeyPassword + ? _value.deviceEncryptionKeyPassword + : deviceEncryptionKeyPassword // ignore: cast_nullable_to_non_nullable + as String, + newDeviceEncryptionKeyPassword: freezed == newDeviceEncryptionKeyPassword + ? _value.newDeviceEncryptionKeyPassword + : newDeviceEncryptionKeyPassword // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_VeilidConfigProtectedStore + with DiagnosticableTreeMixin + implements _VeilidConfigProtectedStore { + const _$_VeilidConfigProtectedStore( + {required this.allowInsecureFallback, + required this.alwaysUseInsecureStorage, + required this.directory, + required this.delete, + required this.deviceEncryptionKeyPassword, + this.newDeviceEncryptionKeyPassword}); + + factory _$_VeilidConfigProtectedStore.fromJson(Map json) => + _$$_VeilidConfigProtectedStoreFromJson(json); + + @override + final bool allowInsecureFallback; + @override + final bool alwaysUseInsecureStorage; + @override + final String directory; + @override + final bool delete; + @override + final String deviceEncryptionKeyPassword; + @override + final String? newDeviceEncryptionKeyPassword; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'VeilidConfigProtectedStore(allowInsecureFallback: $allowInsecureFallback, alwaysUseInsecureStorage: $alwaysUseInsecureStorage, directory: $directory, delete: $delete, deviceEncryptionKeyPassword: $deviceEncryptionKeyPassword, newDeviceEncryptionKeyPassword: $newDeviceEncryptionKeyPassword)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'VeilidConfigProtectedStore')) + ..add(DiagnosticsProperty('allowInsecureFallback', allowInsecureFallback)) + ..add(DiagnosticsProperty( + 'alwaysUseInsecureStorage', alwaysUseInsecureStorage)) + ..add(DiagnosticsProperty('directory', directory)) + ..add(DiagnosticsProperty('delete', delete)) + ..add(DiagnosticsProperty( + 'deviceEncryptionKeyPassword', deviceEncryptionKeyPassword)) + ..add(DiagnosticsProperty( + 'newDeviceEncryptionKeyPassword', newDeviceEncryptionKeyPassword)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_VeilidConfigProtectedStore && + (identical(other.allowInsecureFallback, allowInsecureFallback) || + other.allowInsecureFallback == allowInsecureFallback) && + (identical( + other.alwaysUseInsecureStorage, alwaysUseInsecureStorage) || + other.alwaysUseInsecureStorage == alwaysUseInsecureStorage) && + (identical(other.directory, directory) || + other.directory == directory) && + (identical(other.delete, delete) || other.delete == delete) && + (identical(other.deviceEncryptionKeyPassword, + deviceEncryptionKeyPassword) || + other.deviceEncryptionKeyPassword == + deviceEncryptionKeyPassword) && + (identical(other.newDeviceEncryptionKeyPassword, + newDeviceEncryptionKeyPassword) || + other.newDeviceEncryptionKeyPassword == + newDeviceEncryptionKeyPassword)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, + allowInsecureFallback, + alwaysUseInsecureStorage, + directory, + delete, + deviceEncryptionKeyPassword, + newDeviceEncryptionKeyPassword); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_VeilidConfigProtectedStoreCopyWith<_$_VeilidConfigProtectedStore> + get copyWith => __$$_VeilidConfigProtectedStoreCopyWithImpl< + _$_VeilidConfigProtectedStore>(this, _$identity); + + @override + Map toJson() { + return _$$_VeilidConfigProtectedStoreToJson( + this, + ); + } +} + +abstract class _VeilidConfigProtectedStore + implements VeilidConfigProtectedStore { + const factory _VeilidConfigProtectedStore( + {required final bool allowInsecureFallback, + required final bool alwaysUseInsecureStorage, + required final String directory, + required final bool delete, + required final String deviceEncryptionKeyPassword, + final String? newDeviceEncryptionKeyPassword}) = + _$_VeilidConfigProtectedStore; + + factory _VeilidConfigProtectedStore.fromJson(Map json) = + _$_VeilidConfigProtectedStore.fromJson; + + @override + bool get allowInsecureFallback; + @override + bool get alwaysUseInsecureStorage; + @override + String get directory; + @override + bool get delete; + @override + String get deviceEncryptionKeyPassword; + @override + String? get newDeviceEncryptionKeyPassword; + @override + @JsonKey(ignore: true) + _$$_VeilidConfigProtectedStoreCopyWith<_$_VeilidConfigProtectedStore> + get copyWith => throw _privateConstructorUsedError; +} + +VeilidConfigCapabilities _$VeilidConfigCapabilitiesFromJson( + Map json) { + return _VeilidConfigCapabilities.fromJson(json); +} + +/// @nodoc +mixin _$VeilidConfigCapabilities { + List get disable => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $VeilidConfigCapabilitiesCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VeilidConfigCapabilitiesCopyWith<$Res> { + factory $VeilidConfigCapabilitiesCopyWith(VeilidConfigCapabilities value, + $Res Function(VeilidConfigCapabilities) then) = + _$VeilidConfigCapabilitiesCopyWithImpl<$Res, VeilidConfigCapabilities>; + @useResult + $Res call({List disable}); +} + +/// @nodoc +class _$VeilidConfigCapabilitiesCopyWithImpl<$Res, + $Val extends VeilidConfigCapabilities> + implements $VeilidConfigCapabilitiesCopyWith<$Res> { + _$VeilidConfigCapabilitiesCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? disable = null, + }) { + return _then(_value.copyWith( + disable: null == disable + ? _value.disable + : disable // ignore: cast_nullable_to_non_nullable + as List, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_VeilidConfigCapabilitiesCopyWith<$Res> + implements $VeilidConfigCapabilitiesCopyWith<$Res> { + factory _$$_VeilidConfigCapabilitiesCopyWith( + _$_VeilidConfigCapabilities value, + $Res Function(_$_VeilidConfigCapabilities) then) = + __$$_VeilidConfigCapabilitiesCopyWithImpl<$Res>; + @override + @useResult + $Res call({List disable}); +} + +/// @nodoc +class __$$_VeilidConfigCapabilitiesCopyWithImpl<$Res> + extends _$VeilidConfigCapabilitiesCopyWithImpl<$Res, + _$_VeilidConfigCapabilities> + implements _$$_VeilidConfigCapabilitiesCopyWith<$Res> { + __$$_VeilidConfigCapabilitiesCopyWithImpl(_$_VeilidConfigCapabilities _value, + $Res Function(_$_VeilidConfigCapabilities) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? disable = null, + }) { + return _then(_$_VeilidConfigCapabilities( + disable: null == disable + ? _value._disable + : disable // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_VeilidConfigCapabilities + with DiagnosticableTreeMixin + implements _VeilidConfigCapabilities { + const _$_VeilidConfigCapabilities({required final List disable}) + : _disable = disable; + + factory _$_VeilidConfigCapabilities.fromJson(Map json) => + _$$_VeilidConfigCapabilitiesFromJson(json); + + final List _disable; + @override + List get disable { + if (_disable is EqualUnmodifiableListView) return _disable; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_disable); + } + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'VeilidConfigCapabilities(disable: $disable)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'VeilidConfigCapabilities')) + ..add(DiagnosticsProperty('disable', disable)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_VeilidConfigCapabilities && + const DeepCollectionEquality().equals(other._disable, _disable)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => + Object.hash(runtimeType, const DeepCollectionEquality().hash(_disable)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_VeilidConfigCapabilitiesCopyWith<_$_VeilidConfigCapabilities> + get copyWith => __$$_VeilidConfigCapabilitiesCopyWithImpl< + _$_VeilidConfigCapabilities>(this, _$identity); + + @override + Map toJson() { + return _$$_VeilidConfigCapabilitiesToJson( + this, + ); + } +} + +abstract class _VeilidConfigCapabilities implements VeilidConfigCapabilities { + const factory _VeilidConfigCapabilities( + {required final List disable}) = _$_VeilidConfigCapabilities; + + factory _VeilidConfigCapabilities.fromJson(Map json) = + _$_VeilidConfigCapabilities.fromJson; + + @override + List get disable; + @override + @JsonKey(ignore: true) + _$$_VeilidConfigCapabilitiesCopyWith<_$_VeilidConfigCapabilities> + get copyWith => throw _privateConstructorUsedError; +} + +VeilidConfig _$VeilidConfigFromJson(Map json) { + return _VeilidConfig.fromJson(json); +} + +/// @nodoc +mixin _$VeilidConfig { + String get programName => throw _privateConstructorUsedError; + String get namespace => throw _privateConstructorUsedError; + VeilidConfigCapabilities get capabilities => + throw _privateConstructorUsedError; + VeilidConfigProtectedStore get protectedStore => + throw _privateConstructorUsedError; + VeilidConfigTableStore get tableStore => throw _privateConstructorUsedError; + VeilidConfigBlockStore get blockStore => throw _privateConstructorUsedError; + VeilidConfigNetwork get network => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $VeilidConfigCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VeilidConfigCopyWith<$Res> { + factory $VeilidConfigCopyWith( + VeilidConfig value, $Res Function(VeilidConfig) then) = + _$VeilidConfigCopyWithImpl<$Res, VeilidConfig>; + @useResult + $Res call( + {String programName, + String namespace, + VeilidConfigCapabilities capabilities, + VeilidConfigProtectedStore protectedStore, + VeilidConfigTableStore tableStore, + VeilidConfigBlockStore blockStore, + VeilidConfigNetwork network}); + + $VeilidConfigCapabilitiesCopyWith<$Res> get capabilities; + $VeilidConfigProtectedStoreCopyWith<$Res> get protectedStore; + $VeilidConfigTableStoreCopyWith<$Res> get tableStore; + $VeilidConfigBlockStoreCopyWith<$Res> get blockStore; + $VeilidConfigNetworkCopyWith<$Res> get network; +} + +/// @nodoc +class _$VeilidConfigCopyWithImpl<$Res, $Val extends VeilidConfig> + implements $VeilidConfigCopyWith<$Res> { + _$VeilidConfigCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? programName = null, + Object? namespace = null, + Object? capabilities = null, + Object? protectedStore = null, + Object? tableStore = null, + Object? blockStore = null, + Object? network = null, + }) { + return _then(_value.copyWith( + programName: null == programName + ? _value.programName + : programName // ignore: cast_nullable_to_non_nullable + as String, + namespace: null == namespace + ? _value.namespace + : namespace // ignore: cast_nullable_to_non_nullable + as String, + capabilities: null == capabilities + ? _value.capabilities + : capabilities // ignore: cast_nullable_to_non_nullable + as VeilidConfigCapabilities, + protectedStore: null == protectedStore + ? _value.protectedStore + : protectedStore // ignore: cast_nullable_to_non_nullable + as VeilidConfigProtectedStore, + tableStore: null == tableStore + ? _value.tableStore + : tableStore // ignore: cast_nullable_to_non_nullable + as VeilidConfigTableStore, + blockStore: null == blockStore + ? _value.blockStore + : blockStore // ignore: cast_nullable_to_non_nullable + as VeilidConfigBlockStore, + network: null == network + ? _value.network + : network // ignore: cast_nullable_to_non_nullable + as VeilidConfigNetwork, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $VeilidConfigCapabilitiesCopyWith<$Res> get capabilities { + return $VeilidConfigCapabilitiesCopyWith<$Res>(_value.capabilities, + (value) { + return _then(_value.copyWith(capabilities: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $VeilidConfigProtectedStoreCopyWith<$Res> get protectedStore { + return $VeilidConfigProtectedStoreCopyWith<$Res>(_value.protectedStore, + (value) { + return _then(_value.copyWith(protectedStore: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $VeilidConfigTableStoreCopyWith<$Res> get tableStore { + return $VeilidConfigTableStoreCopyWith<$Res>(_value.tableStore, (value) { + return _then(_value.copyWith(tableStore: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $VeilidConfigBlockStoreCopyWith<$Res> get blockStore { + return $VeilidConfigBlockStoreCopyWith<$Res>(_value.blockStore, (value) { + return _then(_value.copyWith(blockStore: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $VeilidConfigNetworkCopyWith<$Res> get network { + return $VeilidConfigNetworkCopyWith<$Res>(_value.network, (value) { + return _then(_value.copyWith(network: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$_VeilidConfigCopyWith<$Res> + implements $VeilidConfigCopyWith<$Res> { + factory _$$_VeilidConfigCopyWith( + _$_VeilidConfig value, $Res Function(_$_VeilidConfig) then) = + __$$_VeilidConfigCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String programName, + String namespace, + VeilidConfigCapabilities capabilities, + VeilidConfigProtectedStore protectedStore, + VeilidConfigTableStore tableStore, + VeilidConfigBlockStore blockStore, + VeilidConfigNetwork network}); + + @override + $VeilidConfigCapabilitiesCopyWith<$Res> get capabilities; + @override + $VeilidConfigProtectedStoreCopyWith<$Res> get protectedStore; + @override + $VeilidConfigTableStoreCopyWith<$Res> get tableStore; + @override + $VeilidConfigBlockStoreCopyWith<$Res> get blockStore; + @override + $VeilidConfigNetworkCopyWith<$Res> get network; +} + +/// @nodoc +class __$$_VeilidConfigCopyWithImpl<$Res> + extends _$VeilidConfigCopyWithImpl<$Res, _$_VeilidConfig> + implements _$$_VeilidConfigCopyWith<$Res> { + __$$_VeilidConfigCopyWithImpl( + _$_VeilidConfig _value, $Res Function(_$_VeilidConfig) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? programName = null, + Object? namespace = null, + Object? capabilities = null, + Object? protectedStore = null, + Object? tableStore = null, + Object? blockStore = null, + Object? network = null, + }) { + return _then(_$_VeilidConfig( + programName: null == programName + ? _value.programName + : programName // ignore: cast_nullable_to_non_nullable + as String, + namespace: null == namespace + ? _value.namespace + : namespace // ignore: cast_nullable_to_non_nullable + as String, + capabilities: null == capabilities + ? _value.capabilities + : capabilities // ignore: cast_nullable_to_non_nullable + as VeilidConfigCapabilities, + protectedStore: null == protectedStore + ? _value.protectedStore + : protectedStore // ignore: cast_nullable_to_non_nullable + as VeilidConfigProtectedStore, + tableStore: null == tableStore + ? _value.tableStore + : tableStore // ignore: cast_nullable_to_non_nullable + as VeilidConfigTableStore, + blockStore: null == blockStore + ? _value.blockStore + : blockStore // ignore: cast_nullable_to_non_nullable + as VeilidConfigBlockStore, + network: null == network + ? _value.network + : network // ignore: cast_nullable_to_non_nullable + as VeilidConfigNetwork, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_VeilidConfig with DiagnosticableTreeMixin implements _VeilidConfig { + const _$_VeilidConfig( + {required this.programName, + required this.namespace, + required this.capabilities, + required this.protectedStore, + required this.tableStore, + required this.blockStore, + required this.network}); + + factory _$_VeilidConfig.fromJson(Map json) => + _$$_VeilidConfigFromJson(json); + + @override + final String programName; + @override + final String namespace; + @override + final VeilidConfigCapabilities capabilities; + @override + final VeilidConfigProtectedStore protectedStore; + @override + final VeilidConfigTableStore tableStore; + @override + final VeilidConfigBlockStore blockStore; + @override + final VeilidConfigNetwork network; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'VeilidConfig(programName: $programName, namespace: $namespace, capabilities: $capabilities, protectedStore: $protectedStore, tableStore: $tableStore, blockStore: $blockStore, network: $network)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'VeilidConfig')) + ..add(DiagnosticsProperty('programName', programName)) + ..add(DiagnosticsProperty('namespace', namespace)) + ..add(DiagnosticsProperty('capabilities', capabilities)) + ..add(DiagnosticsProperty('protectedStore', protectedStore)) + ..add(DiagnosticsProperty('tableStore', tableStore)) + ..add(DiagnosticsProperty('blockStore', blockStore)) + ..add(DiagnosticsProperty('network', network)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_VeilidConfig && + (identical(other.programName, programName) || + other.programName == programName) && + (identical(other.namespace, namespace) || + other.namespace == namespace) && + (identical(other.capabilities, capabilities) || + other.capabilities == capabilities) && + (identical(other.protectedStore, protectedStore) || + other.protectedStore == protectedStore) && + (identical(other.tableStore, tableStore) || + other.tableStore == tableStore) && + (identical(other.blockStore, blockStore) || + other.blockStore == blockStore) && + (identical(other.network, network) || other.network == network)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, programName, namespace, + capabilities, protectedStore, tableStore, blockStore, network); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_VeilidConfigCopyWith<_$_VeilidConfig> get copyWith => + __$$_VeilidConfigCopyWithImpl<_$_VeilidConfig>(this, _$identity); + + @override + Map toJson() { + return _$$_VeilidConfigToJson( + this, + ); + } +} + +abstract class _VeilidConfig implements VeilidConfig { + const factory _VeilidConfig( + {required final String programName, + required final String namespace, + required final VeilidConfigCapabilities capabilities, + required final VeilidConfigProtectedStore protectedStore, + required final VeilidConfigTableStore tableStore, + required final VeilidConfigBlockStore blockStore, + required final VeilidConfigNetwork network}) = _$_VeilidConfig; + + factory _VeilidConfig.fromJson(Map json) = + _$_VeilidConfig.fromJson; + + @override + String get programName; + @override + String get namespace; + @override + VeilidConfigCapabilities get capabilities; + @override + VeilidConfigProtectedStore get protectedStore; + @override + VeilidConfigTableStore get tableStore; + @override + VeilidConfigBlockStore get blockStore; + @override + VeilidConfigNetwork get network; + @override + @JsonKey(ignore: true) + _$$_VeilidConfigCopyWith<_$_VeilidConfig> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/veilid-flutter/lib/veilid_config.g.dart b/veilid-flutter/lib/veilid_config.g.dart new file mode 100644 index 00000000..fed9bae0 --- /dev/null +++ b/veilid-flutter/lib/veilid_config.g.dart @@ -0,0 +1,550 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'veilid_config.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$_VeilidFFIConfigLoggingTerminal _$$_VeilidFFIConfigLoggingTerminalFromJson( + Map json) => + _$_VeilidFFIConfigLoggingTerminal( + enabled: json['enabled'] as bool, + level: VeilidConfigLogLevel.fromJson(json['level']), + ); + +Map _$$_VeilidFFIConfigLoggingTerminalToJson( + _$_VeilidFFIConfigLoggingTerminal instance) => + { + 'enabled': instance.enabled, + 'level': instance.level.toJson(), + }; + +_$_VeilidFFIConfigLoggingOtlp _$$_VeilidFFIConfigLoggingOtlpFromJson( + Map json) => + _$_VeilidFFIConfigLoggingOtlp( + enabled: json['enabled'] as bool, + level: VeilidConfigLogLevel.fromJson(json['level']), + grpcEndpoint: json['grpc_endpoint'] as String, + serviceName: json['service_name'] as String, + ); + +Map _$$_VeilidFFIConfigLoggingOtlpToJson( + _$_VeilidFFIConfigLoggingOtlp instance) => + { + 'enabled': instance.enabled, + 'level': instance.level.toJson(), + 'grpc_endpoint': instance.grpcEndpoint, + 'service_name': instance.serviceName, + }; + +_$_VeilidFFIConfigLoggingApi _$$_VeilidFFIConfigLoggingApiFromJson( + Map json) => + _$_VeilidFFIConfigLoggingApi( + enabled: json['enabled'] as bool, + level: VeilidConfigLogLevel.fromJson(json['level']), + ); + +Map _$$_VeilidFFIConfigLoggingApiToJson( + _$_VeilidFFIConfigLoggingApi instance) => + { + 'enabled': instance.enabled, + 'level': instance.level.toJson(), + }; + +_$_VeilidFFIConfigLogging _$$_VeilidFFIConfigLoggingFromJson( + Map json) => + _$_VeilidFFIConfigLogging( + terminal: VeilidFFIConfigLoggingTerminal.fromJson( + json['terminal'] as Map), + otlp: VeilidFFIConfigLoggingOtlp.fromJson( + json['otlp'] as Map), + api: VeilidFFIConfigLoggingApi.fromJson( + json['api'] as Map), + ); + +Map _$$_VeilidFFIConfigLoggingToJson( + _$_VeilidFFIConfigLogging instance) => + { + 'terminal': instance.terminal.toJson(), + 'otlp': instance.otlp.toJson(), + 'api': instance.api.toJson(), + }; + +_$_VeilidFFIConfig _$$_VeilidFFIConfigFromJson(Map json) => + _$_VeilidFFIConfig( + logging: VeilidFFIConfigLogging.fromJson( + json['logging'] as Map), + ); + +Map _$$_VeilidFFIConfigToJson(_$_VeilidFFIConfig instance) => + { + 'logging': instance.logging.toJson(), + }; + +_$_VeilidWASMConfigLoggingPerformance + _$$_VeilidWASMConfigLoggingPerformanceFromJson(Map json) => + _$_VeilidWASMConfigLoggingPerformance( + enabled: json['enabled'] as bool, + level: VeilidConfigLogLevel.fromJson(json['level']), + logsInTimings: json['logs_in_timings'] as bool, + logsInConsole: json['logs_in_console'] as bool, + ); + +Map _$$_VeilidWASMConfigLoggingPerformanceToJson( + _$_VeilidWASMConfigLoggingPerformance instance) => + { + 'enabled': instance.enabled, + 'level': instance.level.toJson(), + 'logs_in_timings': instance.logsInTimings, + 'logs_in_console': instance.logsInConsole, + }; + +_$_VeilidWASMConfigLoggingApi _$$_VeilidWASMConfigLoggingApiFromJson( + Map json) => + _$_VeilidWASMConfigLoggingApi( + enabled: json['enabled'] as bool, + level: VeilidConfigLogLevel.fromJson(json['level']), + ); + +Map _$$_VeilidWASMConfigLoggingApiToJson( + _$_VeilidWASMConfigLoggingApi instance) => + { + 'enabled': instance.enabled, + 'level': instance.level.toJson(), + }; + +_$_VeilidWASMConfigLogging _$$_VeilidWASMConfigLoggingFromJson( + Map json) => + _$_VeilidWASMConfigLogging( + performance: VeilidWASMConfigLoggingPerformance.fromJson( + json['performance'] as Map), + api: VeilidWASMConfigLoggingApi.fromJson( + json['api'] as Map), + ); + +Map _$$_VeilidWASMConfigLoggingToJson( + _$_VeilidWASMConfigLogging instance) => + { + 'performance': instance.performance.toJson(), + 'api': instance.api.toJson(), + }; + +_$_VeilidWASMConfig _$$_VeilidWASMConfigFromJson(Map json) => + _$_VeilidWASMConfig( + logging: VeilidWASMConfigLogging.fromJson( + json['logging'] as Map), + ); + +Map _$$_VeilidWASMConfigToJson(_$_VeilidWASMConfig instance) => + { + 'logging': instance.logging.toJson(), + }; + +_$_VeilidConfigHTTPS _$$_VeilidConfigHTTPSFromJson(Map json) => + _$_VeilidConfigHTTPS( + enabled: json['enabled'] as bool, + listenAddress: json['listen_address'] as String, + path: json['path'] as String, + url: json['url'] as String?, + ); + +Map _$$_VeilidConfigHTTPSToJson( + _$_VeilidConfigHTTPS instance) => + { + 'enabled': instance.enabled, + 'listen_address': instance.listenAddress, + 'path': instance.path, + 'url': instance.url, + }; + +_$_VeilidConfigHTTP _$$_VeilidConfigHTTPFromJson(Map json) => + _$_VeilidConfigHTTP( + enabled: json['enabled'] as bool, + listenAddress: json['listen_address'] as String, + path: json['path'] as String, + url: json['url'] as String?, + ); + +Map _$$_VeilidConfigHTTPToJson(_$_VeilidConfigHTTP instance) => + { + 'enabled': instance.enabled, + 'listen_address': instance.listenAddress, + 'path': instance.path, + 'url': instance.url, + }; + +_$_VeilidConfigApplication _$$_VeilidConfigApplicationFromJson( + Map json) => + _$_VeilidConfigApplication( + https: VeilidConfigHTTPS.fromJson(json['https'] as Map), + http: VeilidConfigHTTP.fromJson(json['http'] as Map), + ); + +Map _$$_VeilidConfigApplicationToJson( + _$_VeilidConfigApplication instance) => + { + 'https': instance.https.toJson(), + 'http': instance.http.toJson(), + }; + +_$_VeilidConfigUDP _$$_VeilidConfigUDPFromJson(Map json) => + _$_VeilidConfigUDP( + enabled: json['enabled'] as bool, + socketPoolSize: json['socket_pool_size'] as int, + listenAddress: json['listen_address'] as String, + publicAddress: json['public_address'] as String?, + ); + +Map _$$_VeilidConfigUDPToJson(_$_VeilidConfigUDP instance) => + { + 'enabled': instance.enabled, + 'socket_pool_size': instance.socketPoolSize, + 'listen_address': instance.listenAddress, + 'public_address': instance.publicAddress, + }; + +_$_VeilidConfigTCP _$$_VeilidConfigTCPFromJson(Map json) => + _$_VeilidConfigTCP( + connect: json['connect'] as bool, + listen: json['listen'] as bool, + maxConnections: json['max_connections'] as int, + listenAddress: json['listen_address'] as String, + publicAddress: json['public_address'] as String?, + ); + +Map _$$_VeilidConfigTCPToJson(_$_VeilidConfigTCP instance) => + { + 'connect': instance.connect, + 'listen': instance.listen, + 'max_connections': instance.maxConnections, + 'listen_address': instance.listenAddress, + 'public_address': instance.publicAddress, + }; + +_$_VeilidConfigWS _$$_VeilidConfigWSFromJson(Map json) => + _$_VeilidConfigWS( + connect: json['connect'] as bool, + listen: json['listen'] as bool, + maxConnections: json['max_connections'] as int, + listenAddress: json['listen_address'] as String, + path: json['path'] as String, + url: json['url'] as String?, + ); + +Map _$$_VeilidConfigWSToJson(_$_VeilidConfigWS instance) => + { + 'connect': instance.connect, + 'listen': instance.listen, + 'max_connections': instance.maxConnections, + 'listen_address': instance.listenAddress, + 'path': instance.path, + 'url': instance.url, + }; + +_$_VeilidConfigWSS _$$_VeilidConfigWSSFromJson(Map json) => + _$_VeilidConfigWSS( + connect: json['connect'] as bool, + listen: json['listen'] as bool, + maxConnections: json['max_connections'] as int, + listenAddress: json['listen_address'] as String, + path: json['path'] as String, + url: json['url'] as String?, + ); + +Map _$$_VeilidConfigWSSToJson(_$_VeilidConfigWSS instance) => + { + 'connect': instance.connect, + 'listen': instance.listen, + 'max_connections': instance.maxConnections, + 'listen_address': instance.listenAddress, + 'path': instance.path, + 'url': instance.url, + }; + +_$_VeilidConfigProtocol _$$_VeilidConfigProtocolFromJson( + Map json) => + _$_VeilidConfigProtocol( + udp: VeilidConfigUDP.fromJson(json['udp'] as Map), + tcp: VeilidConfigTCP.fromJson(json['tcp'] as Map), + ws: VeilidConfigWS.fromJson(json['ws'] as Map), + wss: VeilidConfigWSS.fromJson(json['wss'] as Map), + ); + +Map _$$_VeilidConfigProtocolToJson( + _$_VeilidConfigProtocol instance) => + { + 'udp': instance.udp.toJson(), + 'tcp': instance.tcp.toJson(), + 'ws': instance.ws.toJson(), + 'wss': instance.wss.toJson(), + }; + +_$_VeilidConfigTLS _$$_VeilidConfigTLSFromJson(Map json) => + _$_VeilidConfigTLS( + certificatePath: json['certificate_path'] as String, + privateKeyPath: json['private_key_path'] as String, + connectionInitialTimeoutMs: json['connection_initial_timeout_ms'] as int, + ); + +Map _$$_VeilidConfigTLSToJson(_$_VeilidConfigTLS instance) => + { + 'certificate_path': instance.certificatePath, + 'private_key_path': instance.privateKeyPath, + 'connection_initial_timeout_ms': instance.connectionInitialTimeoutMs, + }; + +_$_VeilidConfigDHT _$$_VeilidConfigDHTFromJson(Map json) => + _$_VeilidConfigDHT( + resolveNodeTimeoutMs: json['resolve_node_timeout_ms'] as int, + resolveNodeCount: json['resolve_node_count'] as int, + resolveNodeFanout: json['resolve_node_fanout'] as int, + maxFindNodeCount: json['max_find_node_count'] as int, + getValueTimeoutMs: json['get_value_timeout_ms'] as int, + getValueCount: json['get_value_count'] as int, + getValueFanout: json['get_value_fanout'] as int, + setValueTimeoutMs: json['set_value_timeout_ms'] as int, + setValueCount: json['set_value_count'] as int, + setValueFanout: json['set_value_fanout'] as int, + minPeerCount: json['min_peer_count'] as int, + minPeerRefreshTimeMs: json['min_peer_refresh_time_ms'] as int, + validateDialInfoReceiptTimeMs: + json['validate_dial_info_receipt_time_ms'] as int, + localSubkeyCacheSize: json['local_subkey_cache_size'] as int, + localMaxSubkeyCacheMemoryMb: + json['local_max_subkey_cache_memory_mb'] as int, + remoteSubkeyCacheSize: json['remote_subkey_cache_size'] as int, + remoteMaxRecords: json['remote_max_records'] as int, + remoteMaxSubkeyCacheMemoryMb: + json['remote_max_subkey_cache_memory_mb'] as int, + remoteMaxStorageSpaceMb: json['remote_max_storage_space_mb'] as int, + ); + +Map _$$_VeilidConfigDHTToJson(_$_VeilidConfigDHT instance) => + { + 'resolve_node_timeout_ms': instance.resolveNodeTimeoutMs, + 'resolve_node_count': instance.resolveNodeCount, + 'resolve_node_fanout': instance.resolveNodeFanout, + 'max_find_node_count': instance.maxFindNodeCount, + 'get_value_timeout_ms': instance.getValueTimeoutMs, + 'get_value_count': instance.getValueCount, + 'get_value_fanout': instance.getValueFanout, + 'set_value_timeout_ms': instance.setValueTimeoutMs, + 'set_value_count': instance.setValueCount, + 'set_value_fanout': instance.setValueFanout, + 'min_peer_count': instance.minPeerCount, + 'min_peer_refresh_time_ms': instance.minPeerRefreshTimeMs, + 'validate_dial_info_receipt_time_ms': + instance.validateDialInfoReceiptTimeMs, + 'local_subkey_cache_size': instance.localSubkeyCacheSize, + 'local_max_subkey_cache_memory_mb': instance.localMaxSubkeyCacheMemoryMb, + 'remote_subkey_cache_size': instance.remoteSubkeyCacheSize, + 'remote_max_records': instance.remoteMaxRecords, + 'remote_max_subkey_cache_memory_mb': + instance.remoteMaxSubkeyCacheMemoryMb, + 'remote_max_storage_space_mb': instance.remoteMaxStorageSpaceMb, + }; + +_$_VeilidConfigRPC _$$_VeilidConfigRPCFromJson(Map json) => + _$_VeilidConfigRPC( + concurrency: json['concurrency'] as int, + queueSize: json['queue_size'] as int, + maxTimestampBehindMs: json['max_timestamp_behind_ms'] as int?, + maxTimestampAheadMs: json['max_timestamp_ahead_ms'] as int?, + timeoutMs: json['timeout_ms'] as int, + maxRouteHopCount: json['max_route_hop_count'] as int, + defaultRouteHopCount: json['default_route_hop_count'] as int, + ); + +Map _$$_VeilidConfigRPCToJson(_$_VeilidConfigRPC instance) => + { + 'concurrency': instance.concurrency, + 'queue_size': instance.queueSize, + 'max_timestamp_behind_ms': instance.maxTimestampBehindMs, + 'max_timestamp_ahead_ms': instance.maxTimestampAheadMs, + 'timeout_ms': instance.timeoutMs, + 'max_route_hop_count': instance.maxRouteHopCount, + 'default_route_hop_count': instance.defaultRouteHopCount, + }; + +_$_VeilidConfigRoutingTable _$$_VeilidConfigRoutingTableFromJson( + Map json) => + _$_VeilidConfigRoutingTable( + nodeId: (json['node_id'] as List) + .map(Typed.fromJson) + .toList(), + nodeIdSecret: (json['node_id_secret'] as List) + .map(Typed.fromJson) + .toList(), + bootstrap: + (json['bootstrap'] as List).map((e) => e as String).toList(), + limitOverAttached: json['limit_over_attached'] as int, + limitFullyAttached: json['limit_fully_attached'] as int, + limitAttachedStrong: json['limit_attached_strong'] as int, + limitAttachedGood: json['limit_attached_good'] as int, + limitAttachedWeak: json['limit_attached_weak'] as int, + ); + +Map _$$_VeilidConfigRoutingTableToJson( + _$_VeilidConfigRoutingTable instance) => + { + 'node_id': instance.nodeId.map((e) => e.toJson()).toList(), + 'node_id_secret': instance.nodeIdSecret.map((e) => e.toJson()).toList(), + 'bootstrap': instance.bootstrap, + 'limit_over_attached': instance.limitOverAttached, + 'limit_fully_attached': instance.limitFullyAttached, + 'limit_attached_strong': instance.limitAttachedStrong, + 'limit_attached_good': instance.limitAttachedGood, + 'limit_attached_weak': instance.limitAttachedWeak, + }; + +_$_VeilidConfigNetwork _$$_VeilidConfigNetworkFromJson( + Map json) => + _$_VeilidConfigNetwork( + connectionInitialTimeoutMs: json['connection_initial_timeout_ms'] as int, + connectionInactivityTimeoutMs: + json['connection_inactivity_timeout_ms'] as int, + maxConnectionsPerIp4: json['max_connections_per_ip4'] as int, + maxConnectionsPerIp6Prefix: json['max_connections_per_ip6_prefix'] as int, + maxConnectionsPerIp6PrefixSize: + json['max_connections_per_ip6_prefix_size'] as int, + maxConnectionFrequencyPerMin: + json['max_connection_frequency_per_min'] as int, + clientWhitelistTimeoutMs: json['client_whitelist_timeout_ms'] as int, + reverseConnectionReceiptTimeMs: + json['reverse_connection_receipt_time_ms'] as int, + holePunchReceiptTimeMs: json['hole_punch_receipt_time_ms'] as int, + networkKeyPassword: json['network_key_password'] as String?, + routingTable: VeilidConfigRoutingTable.fromJson( + json['routing_table'] as Map), + rpc: VeilidConfigRPC.fromJson(json['rpc'] as Map), + dht: VeilidConfigDHT.fromJson(json['dht'] as Map), + upnp: json['upnp'] as bool, + detectAddressChanges: json['detect_address_changes'] as bool, + restrictedNatRetries: json['restricted_nat_retries'] as int, + tls: VeilidConfigTLS.fromJson(json['tls'] as Map), + application: VeilidConfigApplication.fromJson( + json['application'] as Map), + protocol: VeilidConfigProtocol.fromJson( + json['protocol'] as Map), + ); + +Map _$$_VeilidConfigNetworkToJson( + _$_VeilidConfigNetwork instance) => + { + 'connection_initial_timeout_ms': instance.connectionInitialTimeoutMs, + 'connection_inactivity_timeout_ms': + instance.connectionInactivityTimeoutMs, + 'max_connections_per_ip4': instance.maxConnectionsPerIp4, + 'max_connections_per_ip6_prefix': instance.maxConnectionsPerIp6Prefix, + 'max_connections_per_ip6_prefix_size': + instance.maxConnectionsPerIp6PrefixSize, + 'max_connection_frequency_per_min': instance.maxConnectionFrequencyPerMin, + 'client_whitelist_timeout_ms': instance.clientWhitelistTimeoutMs, + 'reverse_connection_receipt_time_ms': + instance.reverseConnectionReceiptTimeMs, + 'hole_punch_receipt_time_ms': instance.holePunchReceiptTimeMs, + 'network_key_password': instance.networkKeyPassword, + 'routing_table': instance.routingTable.toJson(), + 'rpc': instance.rpc.toJson(), + 'dht': instance.dht.toJson(), + 'upnp': instance.upnp, + 'detect_address_changes': instance.detectAddressChanges, + 'restricted_nat_retries': instance.restrictedNatRetries, + 'tls': instance.tls.toJson(), + 'application': instance.application.toJson(), + 'protocol': instance.protocol.toJson(), + }; + +_$_VeilidConfigTableStore _$$_VeilidConfigTableStoreFromJson( + Map json) => + _$_VeilidConfigTableStore( + directory: json['directory'] as String, + delete: json['delete'] as bool, + ); + +Map _$$_VeilidConfigTableStoreToJson( + _$_VeilidConfigTableStore instance) => + { + 'directory': instance.directory, + 'delete': instance.delete, + }; + +_$_VeilidConfigBlockStore _$$_VeilidConfigBlockStoreFromJson( + Map json) => + _$_VeilidConfigBlockStore( + directory: json['directory'] as String, + delete: json['delete'] as bool, + ); + +Map _$$_VeilidConfigBlockStoreToJson( + _$_VeilidConfigBlockStore instance) => + { + 'directory': instance.directory, + 'delete': instance.delete, + }; + +_$_VeilidConfigProtectedStore _$$_VeilidConfigProtectedStoreFromJson( + Map json) => + _$_VeilidConfigProtectedStore( + allowInsecureFallback: json['allow_insecure_fallback'] as bool, + alwaysUseInsecureStorage: json['always_use_insecure_storage'] as bool, + directory: json['directory'] as String, + delete: json['delete'] as bool, + deviceEncryptionKeyPassword: + json['device_encryption_key_password'] as String, + newDeviceEncryptionKeyPassword: + json['new_device_encryption_key_password'] as String?, + ); + +Map _$$_VeilidConfigProtectedStoreToJson( + _$_VeilidConfigProtectedStore instance) => + { + 'allow_insecure_fallback': instance.allowInsecureFallback, + 'always_use_insecure_storage': instance.alwaysUseInsecureStorage, + 'directory': instance.directory, + 'delete': instance.delete, + 'device_encryption_key_password': instance.deviceEncryptionKeyPassword, + 'new_device_encryption_key_password': + instance.newDeviceEncryptionKeyPassword, + }; + +_$_VeilidConfigCapabilities _$$_VeilidConfigCapabilitiesFromJson( + Map json) => + _$_VeilidConfigCapabilities( + disable: + (json['disable'] as List).map((e) => e as String).toList(), + ); + +Map _$$_VeilidConfigCapabilitiesToJson( + _$_VeilidConfigCapabilities instance) => + { + 'disable': instance.disable, + }; + +_$_VeilidConfig _$$_VeilidConfigFromJson(Map json) => + _$_VeilidConfig( + programName: json['program_name'] as String, + namespace: json['namespace'] as String, + capabilities: VeilidConfigCapabilities.fromJson( + json['capabilities'] as Map), + protectedStore: VeilidConfigProtectedStore.fromJson( + json['protected_store'] as Map), + tableStore: VeilidConfigTableStore.fromJson( + json['table_store'] as Map), + blockStore: VeilidConfigBlockStore.fromJson( + json['block_store'] as Map), + network: + VeilidConfigNetwork.fromJson(json['network'] as Map), + ); + +Map _$$_VeilidConfigToJson(_$_VeilidConfig instance) => + { + 'program_name': instance.programName, + 'namespace': instance.namespace, + 'capabilities': instance.capabilities.toJson(), + 'protected_store': instance.protectedStore.toJson(), + 'table_store': instance.tableStore.toJson(), + 'block_store': instance.blockStore.toJson(), + 'network': instance.network.toJson(), + }; diff --git a/veilid-flutter/lib/veilid_crypto.dart b/veilid-flutter/lib/veilid_crypto.dart index 85ce5f80..6801f6e5 100644 --- a/veilid-flutter/lib/veilid_crypto.dart +++ b/veilid-flutter/lib/veilid_crypto.dart @@ -2,6 +2,8 @@ import 'dart:async'; import 'dart:typed_data'; import 'package:charcode/charcode.dart'; +import 'package:equatable/equatable.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; import 'veilid_encoding.dart'; import 'veilid.dart'; @@ -19,6 +21,15 @@ String cryptoKindToString(CryptoKind kind) { return "${String.fromCharCode(kind & 0xFF)}${String.fromCharCode((kind >> 8) & 0xFF)}${String.fromCharCode((kind >> 16) & 0xFF)}${String.fromCharCode((kind >> 24) & 0xFF)}"; } +Uint8List cryptoKindToBytes(CryptoKind kind) { + var b = Uint8List(4); + b[0] = kind & 0xFF; + b[1] = (kind >> 8) & 0xFF; + b[2] = (kind >> 16) & 0xFF; + b[3] = (kind >> 24) & 0xFF; + return b; +} + CryptoKind cryptoKindFromString(String s) { if (s.codeUnits.length != 4) { throw const FormatException("malformed string"); @@ -33,92 +44,102 @@ CryptoKind cryptoKindFromString(String s) { ////////////////////////////////////// /// Types -class Typed { - late CryptoKind kind; - late V value; - Typed({required this.kind, required this.value}); +@immutable +class Typed extends Equatable { + final CryptoKind kind; + final V value; + @override + List get props => [kind, value]; + + const Typed({required this.kind, required this.value}); @override String toString() { return "${cryptoKindToString(kind)}:$value"; } - Typed.fromString(String s) { - var parts = s.split(":"); + factory Typed.fromString(String s) { + final parts = s.split(":"); if (parts.length < 2 || parts[0].codeUnits.length != 4) { throw const FormatException("malformed string"); } - kind = parts[0].codeUnits[0] | - parts[0].codeUnits[1] << 8 | - parts[0].codeUnits[2] << 16 | - parts[0].codeUnits[3] << 24; - value = EncodedString.fromString(parts.sublist(1).join(":")); + final kind = cryptoKindFromString(parts[0]); + final value = EncodedString.fromString(parts.sublist(1).join(":")); + return Typed(kind: kind, value: value); } - String toJson() { - return toString(); + Uint8List decode() { + var b = cryptoKindToBytes(kind); + b.addAll(value.decode()); + return b; } - Typed.fromJson(dynamic json) : this.fromString(json as String); + String toJson() => toString(); + factory Typed.fromJson(dynamic json) => Typed.fromString(json as String); } -class KeyPair { - late PublicKey key; - late PublicKey secret; - KeyPair({required this.key, required this.secret}); +@immutable +class KeyPair extends Equatable { + final PublicKey key; + final PublicKey secret; + @override + List get props => [key, secret]; + + const KeyPair({required this.key, required this.secret}); @override String toString() { return "${key.toString()}:${secret.toString()}"; } - KeyPair.fromString(String s) { - var parts = s.split(":"); + factory KeyPair.fromString(String s) { + final parts = s.split(":"); if (parts.length != 2 || parts[0].codeUnits.length != 43 || parts[1].codeUnits.length != 43) { throw const FormatException("malformed string"); } - key = PublicKey(parts[0]); - secret = PublicKey(parts[1]); + final key = PublicKey.fromString(parts[0]); + final secret = PublicKey.fromString(parts[1]); + return KeyPair(key: key, secret: secret); } - String toJson() { - return toString(); - } - - KeyPair.fromJson(dynamic json) : this.fromString(json as String); + String toJson() => toString(); + factory KeyPair.fromJson(dynamic json) => KeyPair.fromString(json as String); } -class TypedKeyPair { - late CryptoKind kind; - late PublicKey key; - late PublicKey secret; - TypedKeyPair({required this.kind, required this.key, required this.secret}); +@immutable +class TypedKeyPair extends Equatable { + final CryptoKind kind; + final PublicKey key; + final PublicKey secret; + @override + List get props => [kind, key, secret]; + + const TypedKeyPair( + {required this.kind, required this.key, required this.secret}); @override - String toString() { - return "${cryptoKindToString(kind)}:${key.toString()}:${secret.toString()}"; - } + String toString() => + "${cryptoKindToString(kind)}:${key.toString()}:${secret.toString()}"; - TypedKeyPair.fromString(String s) { - var parts = s.split(":"); + factory TypedKeyPair.fromString(String s) { + final parts = s.split(":"); if (parts.length != 3 || parts[0].codeUnits.length != 4 || parts[1].codeUnits.length != 43 || parts[2].codeUnits.length != 43) { throw VeilidAPIExceptionInvalidArgument("malformed string", "s", s); } - kind = cryptoKindFromString(parts[0]); - key = PublicKey(parts[1]); - secret = PublicKey(parts[2]); + final kind = cryptoKindFromString(parts[0]); + final key = PublicKey.fromString(parts[1]); + final secret = PublicKey.fromString(parts[2]); + return TypedKeyPair(kind: kind, key: key, secret: secret); } - String toJson() { - return toString(); - } - - TypedKeyPair.fromJson(dynamic json) : this.fromString(json as String); + String toJson() => toString(); + factory TypedKeyPair.fromJson(dynamic json) => + TypedKeyPair.fromString(json as String); } typedef CryptoKey = FixedEncodedString43; @@ -133,6 +154,7 @@ typedef CryptoKeyDistance = CryptoKey; typedef TypedKey = Typed; typedef TypedSecret = Typed; +typedef TypedHashDigest = Typed; typedef TypedSignature = Typed; diff --git a/veilid-flutter/lib/veilid_encoding.dart b/veilid-flutter/lib/veilid_encoding.dart index 9ef54f14..d6334139 100644 --- a/veilid-flutter/lib/veilid_encoding.dart +++ b/veilid-flutter/lib/veilid_encoding.dart @@ -1,6 +1,9 @@ import 'dart:convert'; import 'dart:typed_data'; +import 'package:equatable/equatable.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; + String base64UrlNoPadEncode(List bytes) { var x = base64Url.encode(bytes); while (x.endsWith('=')) { @@ -20,97 +23,127 @@ Uint8List base64UrlNoPadDecodeDynamic(dynamic source) { return base64.decode(source); } -abstract class EncodedString { - late String contents; - EncodedString(String s) { - validate(s); - contents = s; - } - EncodedString.encode(List b) { - var s = base64UrlNoPadEncode(b); - validate(s); - contents = s; - } +class Uint8ListJsonConverter implements JsonConverter { + const Uint8ListJsonConverter(); - int encodedLength(); - int decodedLength(); - void validate(String s) { - var d = base64UrlNoPadDecode(s); - if (d.length != decodedLength()) { - throw Exception("length ${s.length} should be ${encodedLength()}"); - } - } + @override + Uint8List fromJson(String json) => base64UrlNoPadDecode(json); + @override + String toJson(Uint8List data) => base64UrlNoPadEncode(data); +} + +@immutable +abstract class EncodedString extends Equatable { + final String contents; + @override + List get props => [contents]; + + const EncodedString(String s) : contents = s; Uint8List decode() { return base64UrlNoPadDecode(contents); } @override - String toString() { - return contents; + String toString() => contents; + + static T fromBytes(Uint8List bytes) { + switch (T) { + case FixedEncodedString32: + return FixedEncodedString32.fromBytes(bytes) as T; + case FixedEncodedString43: + return FixedEncodedString43.fromBytes(bytes) as T; + case FixedEncodedString86: + return FixedEncodedString86.fromBytes(bytes) as T; + default: + throw UnimplementedError(); + } } static T fromString(String s) { switch (T) { case FixedEncodedString32: - return FixedEncodedString32(s) as T; + return FixedEncodedString32.fromString(s) as T; case FixedEncodedString43: - return FixedEncodedString43(s) as T; + return FixedEncodedString43.fromString(s) as T; case FixedEncodedString86: - return FixedEncodedString86(s) as T; + return FixedEncodedString86.fromString(s) as T; default: throw UnimplementedError(); } } } +@immutable class FixedEncodedString32 extends EncodedString { - FixedEncodedString32(String s) : super(s); - @override - int encodedLength() { + const FixedEncodedString32._(String s) : super(s); + static int encodedLength() { return 32; } - @override - int decodedLength() { + static int decodedLength() { return 24; } - String toJson() { - return toString(); + factory FixedEncodedString32.fromBytes(Uint8List bytes) { + if (bytes.length != decodedLength()) { + throw Exception("length ${bytes.length} should be ${decodedLength()}"); + } + return FixedEncodedString32._(base64UrlNoPadEncode(bytes)); } - FixedEncodedString32.fromJson(dynamic json) : this(json as String); + factory FixedEncodedString32.fromString(String s) { + var d = base64UrlNoPadDecode(s); + if (d.length != decodedLength()) { + throw Exception("length ${s.length} should be ${encodedLength()}"); + } + return FixedEncodedString32._(s); + } + + String toJson() => toString(); + factory FixedEncodedString32.fromJson(dynamic json) => + FixedEncodedString32.fromString(json as String); } +@immutable class FixedEncodedString43 extends EncodedString { - FixedEncodedString43(String s) : super(s); - @override - int encodedLength() { + const FixedEncodedString43._(String s) : super(s); + static int encodedLength() { return 43; } - @override - int decodedLength() { + static int decodedLength() { return 32; } - String toJson() { - return toString(); + factory FixedEncodedString43.fromBytes(Uint8List bytes) { + if (bytes.length != decodedLength()) { + throw Exception("length ${bytes.length} should be ${decodedLength()}"); + } + return FixedEncodedString43._(base64UrlNoPadEncode(bytes)); } - FixedEncodedString43.fromJson(dynamic json) : this(json as String); + factory FixedEncodedString43.fromString(String s) { + var d = base64UrlNoPadDecode(s); + if (d.length != decodedLength()) { + throw Exception("length ${s.length} should be ${encodedLength()}"); + } + return FixedEncodedString43._(s); + } + + String toJson() => toString(); + factory FixedEncodedString43.fromJson(dynamic json) => + FixedEncodedString43.fromString(json as String); } +@immutable class FixedEncodedString86 extends EncodedString { - FixedEncodedString86(String s) : super(s); - @override - int encodedLength() { + const FixedEncodedString86._(String s) : super(s); + static int encodedLength() { return 86; } - @override - int decodedLength() { + static int decodedLength() { return 64; } @@ -118,5 +151,21 @@ class FixedEncodedString86 extends EncodedString { return toString(); } - FixedEncodedString86.fromJson(dynamic json) : this(json as String); + factory FixedEncodedString86.fromBytes(Uint8List bytes) { + if (bytes.length != decodedLength()) { + throw Exception("length ${bytes.length} should be ${decodedLength()}"); + } + return FixedEncodedString86._(base64UrlNoPadEncode(bytes)); + } + + factory FixedEncodedString86.fromString(String s) { + var d = base64UrlNoPadDecode(s); + if (d.length != decodedLength()) { + throw Exception("length ${s.length} should be ${encodedLength()}"); + } + return FixedEncodedString86._(s); + } + + factory FixedEncodedString86.fromJson(dynamic json) => + FixedEncodedString86.fromString(json as String); } diff --git a/veilid-flutter/lib/veilid_ffi.dart b/veilid-flutter/lib/veilid_ffi.dart index 72b3040e..f3fe37c7 100644 --- a/veilid-flutter/lib/veilid_ffi.dart +++ b/veilid-flutter/lib/veilid_ffi.dart @@ -78,9 +78,9 @@ typedef _RoutingContextAppMessageDart = void Function( int, int, Pointer, Pointer); // fn routing_context_create_dht_record(port: i64, id: u32, kind: u32, schema: FfiStr) typedef _RoutingContextCreateDHTRecordC = Void Function( - Int64, Uint32, Uint32, Pointer); + Int64, Uint32, Pointer, Uint32); typedef _RoutingContextCreateDHTRecordDart = void Function( - int, int, int, Pointer); + int, int, Pointer, int); // fn routing_context_open_dht_record(port: i64, id: u32, key: FfiStr, writer: FfiStr) typedef _RoutingContextOpenDHTRecordC = Void Function( Int64, Uint32, Pointer, Pointer); @@ -367,7 +367,7 @@ Future processFuturePlain(Future future) { } Future processFutureJson( - T Function(dynamic) jsonConstructor, Future future) { + T Function(Map) jsonConstructor, Future future) { return future.then((value) { final list = value as List; switch (list[0] as int) { @@ -634,13 +634,13 @@ class VeilidRoutingContextFFI implements VeilidRoutingContext { } @override - Future createDHTRecord( - CryptoKind kind, DHTSchema schema) async { + Future createDHTRecord(DHTSchema schema, + {CryptoKind kind = 0}) async { final nativeSchema = jsonEncode(schema).toNativeUtf8(); final recvPort = ReceivePort("routing_context_create_dht_record"); final sendPort = recvPort.sendPort; _ctx.ffi._routingContextCreateDHTRecord( - sendPort.nativePort, _ctx.id, kind, nativeSchema); + sendPort.nativePort, _ctx.id, nativeSchema, kind); final dhtRecordDescriptor = await processFutureJson(DHTRecordDescriptor.fromJson, recvPort.first); return dhtRecordDescriptor; diff --git a/veilid-flutter/lib/veilid_js.dart b/veilid-flutter/lib/veilid_js.dart index 32bde035..c9f1ebf3 100644 --- a/veilid-flutter/lib/veilid_js.dart +++ b/veilid-flutter/lib/veilid_js.dart @@ -78,11 +78,11 @@ class VeilidRoutingContextJS implements VeilidRoutingContext { } @override - Future createDHTRecord( - CryptoKind kind, DHTSchema schema) async { + Future createDHTRecord(DHTSchema schema, + {CryptoKind kind = 0}) async { return DHTRecordDescriptor.fromJson(jsonDecode(await _wrapApiPromise(js_util .callMethod(wasm, "routing_context_create_dht_record", - [_ctx.id, kind, jsonEncode(schema)])))); + [_ctx.id, jsonEncode(schema), kind])))); } @override diff --git a/veilid-flutter/lib/veilid_state.dart b/veilid-flutter/lib/veilid_state.dart index 8d90dbff..00927a4d 100644 --- a/veilid-flutter/lib/veilid_state.dart +++ b/veilid-flutter/lib/veilid_state.dart @@ -1,10 +1,13 @@ import 'dart:typed_data'; import 'package:change_case/change_case.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; -import 'veilid_encoding.dart'; import 'veilid.dart'; +part 'veilid_state.freezed.dart'; +part 'veilid_state.g.dart'; + ////////////////////////////////////// /// AttachmentState @@ -18,13 +21,9 @@ enum AttachmentState { overAttached, detaching; - String toJson() { - return name.toPascalCase(); - } - - factory AttachmentState.fromJson(String j) { - return AttachmentState.values.byName(j.toCamelCase()); - } + String toJson() => name.toPascalCase(); + factory AttachmentState.fromJson(String j) => + AttachmentState.values.byName(j.toCamelCase()); } ////////////////////////////////////// @@ -37,514 +36,200 @@ enum VeilidLogLevel { debug, trace; - String toJson() { - return name.toPascalCase(); - } - - factory VeilidLogLevel.fromJson(String j) { - return VeilidLogLevel.values.byName(j.toCamelCase()); - } + String toJson() => name.toPascalCase(); + factory VeilidLogLevel.fromJson(String j) => + VeilidLogLevel.values.byName(j.toCamelCase()); } //////////// -class LatencyStats { - TimestampDuration fastest; - TimestampDuration average; - TimestampDuration slowest; +@freezed +class LatencyStats with _$LatencyStats { + const factory LatencyStats({ + required TimestampDuration fastest, + required TimestampDuration average, + required TimestampDuration slowest, + }) = _LatencyStats; - LatencyStats({ - required this.fastest, - required this.average, - required this.slowest, - }); - - Map toJson() { - return { - 'fastest': fastest.toJson(), - 'average': average.toJson(), - 'slowest': slowest.toJson(), - }; - } - - LatencyStats.fromJson(dynamic json) - : fastest = TimestampDuration.fromJson(json['fastest']), - average = TimestampDuration.fromJson(json['average']), - slowest = TimestampDuration.fromJson(json['slowest']); + factory LatencyStats.fromJson(Map json) => + _$LatencyStatsFromJson(json); } //////////// -class TransferStats { - BigInt total; - BigInt maximum; - BigInt average; - BigInt minimum; +@freezed +class TransferStats with _$TransferStats { + const factory TransferStats({ + required BigInt total, + required BigInt maximum, + required BigInt average, + required BigInt minimum, + }) = _TransferStats; - TransferStats({ - required this.total, - required this.maximum, - required this.average, - required this.minimum, - }); - - Map toJson() { - return { - 'total': total.toString(), - 'maximum': maximum.toString(), - 'average': average.toString(), - 'minimum': minimum.toString(), - }; - } - - TransferStats.fromJson(dynamic json) - : total = BigInt.parse(json['total']), - maximum = BigInt.parse(json['maximum']), - average = BigInt.parse(json['average']), - minimum = BigInt.parse(json['minimum']); + factory TransferStats.fromJson(Map json) => + _$TransferStatsFromJson(json); } //////////// -class TransferStatsDownUp { - TransferStats down; - TransferStats up; +@freezed +class TransferStatsDownUp with _$TransferStatsDownUp { + const factory TransferStatsDownUp({ + required TransferStats down, + required TransferStats up, + }) = _TransferStatsDownUp; - TransferStatsDownUp({ - required this.down, - required this.up, - }); - - Map toJson() { - return { - 'down': down.toJson(), - 'up': up.toJson(), - }; - } - - TransferStatsDownUp.fromJson(dynamic json) - : down = TransferStats.fromJson(json['down']), - up = TransferStats.fromJson(json['up']); + factory TransferStatsDownUp.fromJson(Map json) => + _$TransferStatsDownUpFromJson(json); } //////////// -class RPCStats { - int messagesSent; - int messagesRcvd; - int questionsInFlight; - Timestamp? lastQuestion; - Timestamp? lastSeenTs; - Timestamp? firstConsecutiveSeenTs; - int recentLostAnswers; - int failedToSend; +@freezed +class RPCStats with _$RPCStats { + const factory RPCStats({ + required int messagesSent, + required int messagesRcvd, + required int questionsInFlight, + required Timestamp? lastQuestion, + required Timestamp? lastSeenTs, + required Timestamp? firstConsecutiveSeenTs, + required int recentLostAnswers, + required int failedToSend, + }) = _RPCStats; - RPCStats({ - required this.messagesSent, - required this.messagesRcvd, - required this.questionsInFlight, - required this.lastQuestion, - required this.lastSeenTs, - required this.firstConsecutiveSeenTs, - required this.recentLostAnswers, - required this.failedToSend, - }); - - Map toJson() { - return { - 'messages_sent': messagesSent, - 'messages_rcvd': messagesRcvd, - 'questions_in_flight': questionsInFlight, - 'last_question': lastQuestion?.toJson(), - 'last_seen_ts': lastSeenTs?.toJson(), - 'first_consecutive_seen_ts': firstConsecutiveSeenTs?.toJson(), - 'recent_lost_answers': recentLostAnswers, - 'failed_to_send': failedToSend, - }; - } - - RPCStats.fromJson(dynamic json) - : messagesSent = json['messages_sent'], - messagesRcvd = json['messages_rcvd'], - questionsInFlight = json['questions_in_flight'], - lastQuestion = json['last_question'] != null - ? Timestamp.fromJson(json['last_question']) - : null, - lastSeenTs = json['last_seen_ts'] != null - ? Timestamp.fromJson(json['last_seen_ts']) - : null, - firstConsecutiveSeenTs = json['first_consecutive_seen_ts'] != null - ? Timestamp.fromJson(json['first_consecutive_seen_ts']) - : null, - recentLostAnswers = json['recent_lost_answers'], - failedToSend = json['failed_to_send']; + factory RPCStats.fromJson(Map json) => + _$RPCStatsFromJson(json); } //////////// -class PeerStats { - Timestamp timeAdded; - RPCStats rpcStats; - LatencyStats? latency; - TransferStatsDownUp transfer; +@freezed +class PeerStats with _$PeerStats { + const factory PeerStats({ + required Timestamp timeAdded, + required RPCStats rpcStats, + LatencyStats? latency, + required TransferStatsDownUp transfer, + }) = _PeerStats; - PeerStats({ - required this.timeAdded, - required this.rpcStats, - required this.latency, - required this.transfer, - }); - - Map toJson() { - return { - 'time_added': timeAdded.toJson(), - 'rpc_stats': rpcStats.toJson(), - 'latency': latency?.toJson(), - 'transfer': transfer.toJson(), - }; - } - - PeerStats.fromJson(dynamic json) - : timeAdded = Timestamp.fromJson(json['time_added']), - rpcStats = RPCStats.fromJson(json['rpc_stats']), - latency = json['latency'] != null - ? LatencyStats.fromJson(json['latency']) - : null, - transfer = TransferStatsDownUp.fromJson(json['transfer']); + factory PeerStats.fromJson(Map json) => + _$PeerStatsFromJson(json); } //////////// -class PeerTableData { - List nodeIds; - String peerAddress; - PeerStats peerStats; +@freezed +class PeerTableData with _$PeerTableData { + const factory PeerTableData({ + required List nodeIds, + required String peerAddress, + required PeerStats peerStats, + }) = _PeerTableData; - PeerTableData({ - required this.nodeIds, - required this.peerAddress, - required this.peerStats, - }); - - Map toJson() { - return { - 'node_ids': nodeIds.map((p) => p.toJson()).toList(), - 'peer_address': peerAddress, - 'peer_stats': peerStats.toJson(), - }; - } - - PeerTableData.fromJson(dynamic json) - : nodeIds = List.from( - json['node_ids'].map((j) => TypedKey.fromJson(j))), - peerAddress = json['peer_address'], - peerStats = PeerStats.fromJson(json['peer_stats']); + factory PeerTableData.fromJson(Map json) => + _$PeerTableDataFromJson(json); } ////////////////////////////////////// /// VeilidUpdate -abstract class VeilidUpdate { - factory VeilidUpdate.fromJson(dynamic json) { - switch (json["kind"]) { - case "Log": - { - return VeilidLog( - logLevel: VeilidLogLevel.fromJson(json["log_level"]), - message: json["message"], - backtrace: json["backtrace"]); - } - case "AppMessage": - { - return VeilidAppMessage( - sender: json["sender"], message: json["message"]); - } - case "AppCall": - { - return VeilidAppCall( - sender: json["sender"], - message: json["message"], - callId: json["call_id"]); - } - case "Attachment": - { - return VeilidUpdateAttachment( - state: VeilidStateAttachment.fromJson(json)); - } - case "Network": - { - return VeilidUpdateNetwork(state: VeilidStateNetwork.fromJson(json)); - } - case "Config": - { - return VeilidUpdateConfig(state: VeilidStateConfig.fromJson(json)); - } - case "RouteChange": - { - return VeilidUpdateRouteChange( - deadRoutes: List.from(json['dead_routes'].map((j) => j)), - deadRemoteRoutes: - List.from(json['dead_remote_routes'].map((j) => j))); - } - case "ValueChange": - { - return VeilidUpdateValueChange( - key: TypedKey.fromJson(json['key']), - subkeys: List.from( - json['subkeys'].map((j) => ValueSubkeyRange.fromJson(j))), - count: json['count'], - valueData: ValueData.fromJson(json['value_data'])); - } - default: - { - throw VeilidAPIExceptionInternal( - "Invalid VeilidAPIException type: ${json['kind']}"); - } - } - } - Map toJson(); -} +@Freezed(unionKey: 'kind', unionValueCase: FreezedUnionCase.pascal) +sealed class VeilidUpdate with _$VeilidUpdate { + const factory VeilidUpdate.log({ + required VeilidLogLevel logLevel, + required String message, + String? backtrace, + }) = VeilidLog; + const factory VeilidUpdate.appMessage({ + TypedKey? sender, + @Uint8ListJsonConverter() required Uint8List message, + }) = VeilidAppMessage; + const factory VeilidUpdate.appCall({ + TypedKey? sender, + @Uint8ListJsonConverter() required Uint8List message, + required String callId, + }) = VeilidAppCall; + const factory VeilidUpdate.attachment( + {required AttachmentState state, + required bool publicInternetReady, + required bool localNetworkReady}) = VeilidUpdateAttachment; + const factory VeilidUpdate.network( + {required bool started, + required BigInt bpsDown, + required BigInt bpsUp, + required List peers}) = VeilidUpdateNetwork; + const factory VeilidUpdate.config({ + required VeilidConfig config, + }) = VeilidUpdateConfig; + const factory VeilidUpdate.routeChange({ + required List deadRoutes, + required List deadRemoteRoutes, + }) = VeilidUpdateRouteChange; + const factory VeilidUpdate.valueChange({ + required TypedKey key, + required List subkeys, + required int count, + required ValueData valueData, + }) = VeilidUpdateValueChange; -class VeilidLog implements VeilidUpdate { - final VeilidLogLevel logLevel; - final String message; - final String? backtrace; - // - VeilidLog({ - required this.logLevel, - required this.message, - required this.backtrace, - }); - - @override - Map toJson() { - return { - 'kind': "Log", - 'log_level': logLevel.toJson(), - 'message': message, - 'backtrace': backtrace - }; - } -} - -class VeilidAppMessage implements VeilidUpdate { - final TypedKey? sender; - final Uint8List message; - - // - VeilidAppMessage({ - required this.sender, - required this.message, - }); - - @override - Map toJson() { - return { - 'kind': "AppMessage", - 'sender': sender, - 'message': base64UrlNoPadEncode(message) - }; - } -} - -class VeilidAppCall implements VeilidUpdate { - final String? sender; - final Uint8List message; - final String callId; - - // - VeilidAppCall({ - required this.sender, - required this.message, - required this.callId, - }); - - @override - Map toJson() { - return { - 'kind': "AppCall", - 'sender': sender, - 'message': base64UrlNoPadEncode(message), - 'call_id': callId, - }; - } -} - -class VeilidUpdateAttachment implements VeilidUpdate { - final VeilidStateAttachment state; - // - VeilidUpdateAttachment({required this.state}); - - @override - Map toJson() { - var jsonRep = state.toJson(); - jsonRep['kind'] = "Attachment"; - return jsonRep; - } -} - -class VeilidUpdateNetwork implements VeilidUpdate { - final VeilidStateNetwork state; - // - VeilidUpdateNetwork({required this.state}); - - @override - Map toJson() { - var jsonRep = state.toJson(); - jsonRep['kind'] = "Network"; - return jsonRep; - } -} - -class VeilidUpdateConfig implements VeilidUpdate { - final VeilidStateConfig state; - // - VeilidUpdateConfig({required this.state}); - - @override - Map toJson() { - var jsonRep = state.toJson(); - jsonRep['kind'] = "Config"; - return jsonRep; - } -} - -class VeilidUpdateRouteChange implements VeilidUpdate { - final List deadRoutes; - final List deadRemoteRoutes; - // - VeilidUpdateRouteChange({ - required this.deadRoutes, - required this.deadRemoteRoutes, - }); - - @override - Map toJson() { - return { - 'dead_routes': deadRoutes.map((p) => p).toList(), - 'dead_remote_routes': deadRemoteRoutes.map((p) => p).toList() - }; - } -} - -class VeilidUpdateValueChange implements VeilidUpdate { - final TypedKey key; - final List subkeys; - final int count; - final ValueData valueData; - - // - VeilidUpdateValueChange({ - required this.key, - required this.subkeys, - required this.count, - required this.valueData, - }); - - @override - Map toJson() { - return { - 'key': key.toJson(), - 'subkeys': subkeys.map((p) => p.toJson()).toList(), - 'count': count, - 'value_data': valueData.toJson(), - }; - } + factory VeilidUpdate.fromJson(Map json) => + _$VeilidUpdateFromJson(json); } ////////////////////////////////////// /// VeilidStateAttachment -class VeilidStateAttachment { - final AttachmentState state; - final bool publicInternetReady; - final bool localNetworkReady; +@freezed +class VeilidStateAttachment with _$VeilidStateAttachment { + const factory VeilidStateAttachment( + {required AttachmentState state, + required bool publicInternetReady, + required bool localNetworkReady}) = _VeilidStateAttachment; - VeilidStateAttachment( - this.state, this.publicInternetReady, this.localNetworkReady); - - VeilidStateAttachment.fromJson(dynamic json) - : state = AttachmentState.fromJson(json['state']), - publicInternetReady = json['public_internet_ready'], - localNetworkReady = json['local_network_ready']; - - Map toJson() { - return { - 'state': state.toJson(), - 'public_internet_ready': publicInternetReady, - 'local_network_ready': localNetworkReady, - }; - } + factory VeilidStateAttachment.fromJson(Map json) => + _$VeilidStateAttachmentFromJson(json); } ////////////////////////////////////// /// VeilidStateNetwork -class VeilidStateNetwork { - final bool started; - final BigInt bpsDown; - final BigInt bpsUp; - final List peers; +@freezed +class VeilidStateNetwork with _$VeilidStateNetwork { + const factory VeilidStateNetwork( + {required bool started, + required BigInt bpsDown, + required BigInt bpsUp, + required List peers}) = _VeilidStateNetwork; - VeilidStateNetwork( - {required this.started, - required this.bpsDown, - required this.bpsUp, - required this.peers}); - - VeilidStateNetwork.fromJson(dynamic json) - : started = json['started'], - bpsDown = BigInt.parse(json['bps_down']), - bpsUp = BigInt.parse(json['bps_up']), - peers = List.from( - json['peers'].map((j) => PeerTableData.fromJson(j))); - - Map toJson() { - return { - 'started': started, - 'bps_down': bpsDown.toString(), - 'bps_up': bpsUp.toString(), - 'peers': peers.map((p) => p.toJson()).toList(), - }; - } + factory VeilidStateNetwork.fromJson(Map json) => + _$VeilidStateNetworkFromJson(json); } ////////////////////////////////////// /// VeilidStateConfig -class VeilidStateConfig { - final VeilidConfig config; +@freezed +class VeilidStateConfig with _$VeilidStateConfig { + const factory VeilidStateConfig({ + required VeilidConfig config, + }) = _VeilidStateConfig; - VeilidStateConfig({ - required this.config, - }); - - VeilidStateConfig.fromJson(dynamic json) - : config = VeilidConfig.fromJson(json['config']); - - Map toJson() { - return {'config': config.toJson()}; - } + factory VeilidStateConfig.fromJson(Map json) => + _$VeilidStateConfigFromJson(json); } ////////////////////////////////////// /// VeilidState -class VeilidState { - final VeilidStateAttachment attachment; - final VeilidStateNetwork network; - final VeilidStateConfig config; +@freezed +class VeilidState with _$VeilidState { + const factory VeilidState({ + required VeilidStateAttachment attachment, + required VeilidStateNetwork network, + required VeilidStateConfig config, + }) = _VeilidState; - VeilidState.fromJson(dynamic json) - : attachment = VeilidStateAttachment.fromJson(json['attachment']), - network = VeilidStateNetwork.fromJson(json['network']), - config = VeilidStateConfig.fromJson(json['config']); - - Map toJson() { - return { - 'attachment': attachment.toJson(), - 'network': network.toJson(), - 'config': config.toJson() - }; - } + factory VeilidState.fromJson(Map json) => + _$VeilidStateFromJson(json); } diff --git a/veilid-flutter/lib/veilid_state.freezed.dart b/veilid-flutter/lib/veilid_state.freezed.dart new file mode 100644 index 00000000..6e7bf3f3 --- /dev/null +++ b/veilid-flutter/lib/veilid_state.freezed.dart @@ -0,0 +1,4296 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'veilid_state.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +LatencyStats _$LatencyStatsFromJson(Map json) { + return _LatencyStats.fromJson(json); +} + +/// @nodoc +mixin _$LatencyStats { + TimestampDuration get fastest => throw _privateConstructorUsedError; + TimestampDuration get average => throw _privateConstructorUsedError; + TimestampDuration get slowest => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $LatencyStatsCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $LatencyStatsCopyWith<$Res> { + factory $LatencyStatsCopyWith( + LatencyStats value, $Res Function(LatencyStats) then) = + _$LatencyStatsCopyWithImpl<$Res, LatencyStats>; + @useResult + $Res call( + {TimestampDuration fastest, + TimestampDuration average, + TimestampDuration slowest}); +} + +/// @nodoc +class _$LatencyStatsCopyWithImpl<$Res, $Val extends LatencyStats> + implements $LatencyStatsCopyWith<$Res> { + _$LatencyStatsCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? fastest = null, + Object? average = null, + Object? slowest = null, + }) { + return _then(_value.copyWith( + fastest: null == fastest + ? _value.fastest + : fastest // ignore: cast_nullable_to_non_nullable + as TimestampDuration, + average: null == average + ? _value.average + : average // ignore: cast_nullable_to_non_nullable + as TimestampDuration, + slowest: null == slowest + ? _value.slowest + : slowest // ignore: cast_nullable_to_non_nullable + as TimestampDuration, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_LatencyStatsCopyWith<$Res> + implements $LatencyStatsCopyWith<$Res> { + factory _$$_LatencyStatsCopyWith( + _$_LatencyStats value, $Res Function(_$_LatencyStats) then) = + __$$_LatencyStatsCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {TimestampDuration fastest, + TimestampDuration average, + TimestampDuration slowest}); +} + +/// @nodoc +class __$$_LatencyStatsCopyWithImpl<$Res> + extends _$LatencyStatsCopyWithImpl<$Res, _$_LatencyStats> + implements _$$_LatencyStatsCopyWith<$Res> { + __$$_LatencyStatsCopyWithImpl( + _$_LatencyStats _value, $Res Function(_$_LatencyStats) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? fastest = null, + Object? average = null, + Object? slowest = null, + }) { + return _then(_$_LatencyStats( + fastest: null == fastest + ? _value.fastest + : fastest // ignore: cast_nullable_to_non_nullable + as TimestampDuration, + average: null == average + ? _value.average + : average // ignore: cast_nullable_to_non_nullable + as TimestampDuration, + slowest: null == slowest + ? _value.slowest + : slowest // ignore: cast_nullable_to_non_nullable + as TimestampDuration, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_LatencyStats implements _LatencyStats { + const _$_LatencyStats( + {required this.fastest, required this.average, required this.slowest}); + + factory _$_LatencyStats.fromJson(Map json) => + _$$_LatencyStatsFromJson(json); + + @override + final TimestampDuration fastest; + @override + final TimestampDuration average; + @override + final TimestampDuration slowest; + + @override + String toString() { + return 'LatencyStats(fastest: $fastest, average: $average, slowest: $slowest)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_LatencyStats && + (identical(other.fastest, fastest) || other.fastest == fastest) && + (identical(other.average, average) || other.average == average) && + (identical(other.slowest, slowest) || other.slowest == slowest)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, fastest, average, slowest); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_LatencyStatsCopyWith<_$_LatencyStats> get copyWith => + __$$_LatencyStatsCopyWithImpl<_$_LatencyStats>(this, _$identity); + + @override + Map toJson() { + return _$$_LatencyStatsToJson( + this, + ); + } +} + +abstract class _LatencyStats implements LatencyStats { + const factory _LatencyStats( + {required final TimestampDuration fastest, + required final TimestampDuration average, + required final TimestampDuration slowest}) = _$_LatencyStats; + + factory _LatencyStats.fromJson(Map json) = + _$_LatencyStats.fromJson; + + @override + TimestampDuration get fastest; + @override + TimestampDuration get average; + @override + TimestampDuration get slowest; + @override + @JsonKey(ignore: true) + _$$_LatencyStatsCopyWith<_$_LatencyStats> get copyWith => + throw _privateConstructorUsedError; +} + +TransferStats _$TransferStatsFromJson(Map json) { + return _TransferStats.fromJson(json); +} + +/// @nodoc +mixin _$TransferStats { + BigInt get total => throw _privateConstructorUsedError; + BigInt get maximum => throw _privateConstructorUsedError; + BigInt get average => throw _privateConstructorUsedError; + BigInt get minimum => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $TransferStatsCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $TransferStatsCopyWith<$Res> { + factory $TransferStatsCopyWith( + TransferStats value, $Res Function(TransferStats) then) = + _$TransferStatsCopyWithImpl<$Res, TransferStats>; + @useResult + $Res call({BigInt total, BigInt maximum, BigInt average, BigInt minimum}); +} + +/// @nodoc +class _$TransferStatsCopyWithImpl<$Res, $Val extends TransferStats> + implements $TransferStatsCopyWith<$Res> { + _$TransferStatsCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? total = null, + Object? maximum = null, + Object? average = null, + Object? minimum = null, + }) { + return _then(_value.copyWith( + total: null == total + ? _value.total + : total // ignore: cast_nullable_to_non_nullable + as BigInt, + maximum: null == maximum + ? _value.maximum + : maximum // ignore: cast_nullable_to_non_nullable + as BigInt, + average: null == average + ? _value.average + : average // ignore: cast_nullable_to_non_nullable + as BigInt, + minimum: null == minimum + ? _value.minimum + : minimum // ignore: cast_nullable_to_non_nullable + as BigInt, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_TransferStatsCopyWith<$Res> + implements $TransferStatsCopyWith<$Res> { + factory _$$_TransferStatsCopyWith( + _$_TransferStats value, $Res Function(_$_TransferStats) then) = + __$$_TransferStatsCopyWithImpl<$Res>; + @override + @useResult + $Res call({BigInt total, BigInt maximum, BigInt average, BigInt minimum}); +} + +/// @nodoc +class __$$_TransferStatsCopyWithImpl<$Res> + extends _$TransferStatsCopyWithImpl<$Res, _$_TransferStats> + implements _$$_TransferStatsCopyWith<$Res> { + __$$_TransferStatsCopyWithImpl( + _$_TransferStats _value, $Res Function(_$_TransferStats) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? total = null, + Object? maximum = null, + Object? average = null, + Object? minimum = null, + }) { + return _then(_$_TransferStats( + total: null == total + ? _value.total + : total // ignore: cast_nullable_to_non_nullable + as BigInt, + maximum: null == maximum + ? _value.maximum + : maximum // ignore: cast_nullable_to_non_nullable + as BigInt, + average: null == average + ? _value.average + : average // ignore: cast_nullable_to_non_nullable + as BigInt, + minimum: null == minimum + ? _value.minimum + : minimum // ignore: cast_nullable_to_non_nullable + as BigInt, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_TransferStats implements _TransferStats { + const _$_TransferStats( + {required this.total, + required this.maximum, + required this.average, + required this.minimum}); + + factory _$_TransferStats.fromJson(Map json) => + _$$_TransferStatsFromJson(json); + + @override + final BigInt total; + @override + final BigInt maximum; + @override + final BigInt average; + @override + final BigInt minimum; + + @override + String toString() { + return 'TransferStats(total: $total, maximum: $maximum, average: $average, minimum: $minimum)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_TransferStats && + (identical(other.total, total) || other.total == total) && + (identical(other.maximum, maximum) || other.maximum == maximum) && + (identical(other.average, average) || other.average == average) && + (identical(other.minimum, minimum) || other.minimum == minimum)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => + Object.hash(runtimeType, total, maximum, average, minimum); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_TransferStatsCopyWith<_$_TransferStats> get copyWith => + __$$_TransferStatsCopyWithImpl<_$_TransferStats>(this, _$identity); + + @override + Map toJson() { + return _$$_TransferStatsToJson( + this, + ); + } +} + +abstract class _TransferStats implements TransferStats { + const factory _TransferStats( + {required final BigInt total, + required final BigInt maximum, + required final BigInt average, + required final BigInt minimum}) = _$_TransferStats; + + factory _TransferStats.fromJson(Map json) = + _$_TransferStats.fromJson; + + @override + BigInt get total; + @override + BigInt get maximum; + @override + BigInt get average; + @override + BigInt get minimum; + @override + @JsonKey(ignore: true) + _$$_TransferStatsCopyWith<_$_TransferStats> get copyWith => + throw _privateConstructorUsedError; +} + +TransferStatsDownUp _$TransferStatsDownUpFromJson(Map json) { + return _TransferStatsDownUp.fromJson(json); +} + +/// @nodoc +mixin _$TransferStatsDownUp { + TransferStats get down => throw _privateConstructorUsedError; + TransferStats get up => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $TransferStatsDownUpCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $TransferStatsDownUpCopyWith<$Res> { + factory $TransferStatsDownUpCopyWith( + TransferStatsDownUp value, $Res Function(TransferStatsDownUp) then) = + _$TransferStatsDownUpCopyWithImpl<$Res, TransferStatsDownUp>; + @useResult + $Res call({TransferStats down, TransferStats up}); + + $TransferStatsCopyWith<$Res> get down; + $TransferStatsCopyWith<$Res> get up; +} + +/// @nodoc +class _$TransferStatsDownUpCopyWithImpl<$Res, $Val extends TransferStatsDownUp> + implements $TransferStatsDownUpCopyWith<$Res> { + _$TransferStatsDownUpCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? down = null, + Object? up = null, + }) { + return _then(_value.copyWith( + down: null == down + ? _value.down + : down // ignore: cast_nullable_to_non_nullable + as TransferStats, + up: null == up + ? _value.up + : up // ignore: cast_nullable_to_non_nullable + as TransferStats, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $TransferStatsCopyWith<$Res> get down { + return $TransferStatsCopyWith<$Res>(_value.down, (value) { + return _then(_value.copyWith(down: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $TransferStatsCopyWith<$Res> get up { + return $TransferStatsCopyWith<$Res>(_value.up, (value) { + return _then(_value.copyWith(up: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$_TransferStatsDownUpCopyWith<$Res> + implements $TransferStatsDownUpCopyWith<$Res> { + factory _$$_TransferStatsDownUpCopyWith(_$_TransferStatsDownUp value, + $Res Function(_$_TransferStatsDownUp) then) = + __$$_TransferStatsDownUpCopyWithImpl<$Res>; + @override + @useResult + $Res call({TransferStats down, TransferStats up}); + + @override + $TransferStatsCopyWith<$Res> get down; + @override + $TransferStatsCopyWith<$Res> get up; +} + +/// @nodoc +class __$$_TransferStatsDownUpCopyWithImpl<$Res> + extends _$TransferStatsDownUpCopyWithImpl<$Res, _$_TransferStatsDownUp> + implements _$$_TransferStatsDownUpCopyWith<$Res> { + __$$_TransferStatsDownUpCopyWithImpl(_$_TransferStatsDownUp _value, + $Res Function(_$_TransferStatsDownUp) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? down = null, + Object? up = null, + }) { + return _then(_$_TransferStatsDownUp( + down: null == down + ? _value.down + : down // ignore: cast_nullable_to_non_nullable + as TransferStats, + up: null == up + ? _value.up + : up // ignore: cast_nullable_to_non_nullable + as TransferStats, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_TransferStatsDownUp implements _TransferStatsDownUp { + const _$_TransferStatsDownUp({required this.down, required this.up}); + + factory _$_TransferStatsDownUp.fromJson(Map json) => + _$$_TransferStatsDownUpFromJson(json); + + @override + final TransferStats down; + @override + final TransferStats up; + + @override + String toString() { + return 'TransferStatsDownUp(down: $down, up: $up)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_TransferStatsDownUp && + (identical(other.down, down) || other.down == down) && + (identical(other.up, up) || other.up == up)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, down, up); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_TransferStatsDownUpCopyWith<_$_TransferStatsDownUp> get copyWith => + __$$_TransferStatsDownUpCopyWithImpl<_$_TransferStatsDownUp>( + this, _$identity); + + @override + Map toJson() { + return _$$_TransferStatsDownUpToJson( + this, + ); + } +} + +abstract class _TransferStatsDownUp implements TransferStatsDownUp { + const factory _TransferStatsDownUp( + {required final TransferStats down, + required final TransferStats up}) = _$_TransferStatsDownUp; + + factory _TransferStatsDownUp.fromJson(Map json) = + _$_TransferStatsDownUp.fromJson; + + @override + TransferStats get down; + @override + TransferStats get up; + @override + @JsonKey(ignore: true) + _$$_TransferStatsDownUpCopyWith<_$_TransferStatsDownUp> get copyWith => + throw _privateConstructorUsedError; +} + +RPCStats _$RPCStatsFromJson(Map json) { + return _RPCStats.fromJson(json); +} + +/// @nodoc +mixin _$RPCStats { + int get messagesSent => throw _privateConstructorUsedError; + int get messagesRcvd => throw _privateConstructorUsedError; + int get questionsInFlight => throw _privateConstructorUsedError; + Timestamp? get lastQuestion => throw _privateConstructorUsedError; + Timestamp? get lastSeenTs => throw _privateConstructorUsedError; + Timestamp? get firstConsecutiveSeenTs => throw _privateConstructorUsedError; + int get recentLostAnswers => throw _privateConstructorUsedError; + int get failedToSend => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $RPCStatsCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $RPCStatsCopyWith<$Res> { + factory $RPCStatsCopyWith(RPCStats value, $Res Function(RPCStats) then) = + _$RPCStatsCopyWithImpl<$Res, RPCStats>; + @useResult + $Res call( + {int messagesSent, + int messagesRcvd, + int questionsInFlight, + Timestamp? lastQuestion, + Timestamp? lastSeenTs, + Timestamp? firstConsecutiveSeenTs, + int recentLostAnswers, + int failedToSend}); +} + +/// @nodoc +class _$RPCStatsCopyWithImpl<$Res, $Val extends RPCStats> + implements $RPCStatsCopyWith<$Res> { + _$RPCStatsCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? messagesSent = null, + Object? messagesRcvd = null, + Object? questionsInFlight = null, + Object? lastQuestion = freezed, + Object? lastSeenTs = freezed, + Object? firstConsecutiveSeenTs = freezed, + Object? recentLostAnswers = null, + Object? failedToSend = null, + }) { + return _then(_value.copyWith( + messagesSent: null == messagesSent + ? _value.messagesSent + : messagesSent // ignore: cast_nullable_to_non_nullable + as int, + messagesRcvd: null == messagesRcvd + ? _value.messagesRcvd + : messagesRcvd // ignore: cast_nullable_to_non_nullable + as int, + questionsInFlight: null == questionsInFlight + ? _value.questionsInFlight + : questionsInFlight // ignore: cast_nullable_to_non_nullable + as int, + lastQuestion: freezed == lastQuestion + ? _value.lastQuestion + : lastQuestion // ignore: cast_nullable_to_non_nullable + as Timestamp?, + lastSeenTs: freezed == lastSeenTs + ? _value.lastSeenTs + : lastSeenTs // ignore: cast_nullable_to_non_nullable + as Timestamp?, + firstConsecutiveSeenTs: freezed == firstConsecutiveSeenTs + ? _value.firstConsecutiveSeenTs + : firstConsecutiveSeenTs // ignore: cast_nullable_to_non_nullable + as Timestamp?, + recentLostAnswers: null == recentLostAnswers + ? _value.recentLostAnswers + : recentLostAnswers // ignore: cast_nullable_to_non_nullable + as int, + failedToSend: null == failedToSend + ? _value.failedToSend + : failedToSend // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_RPCStatsCopyWith<$Res> implements $RPCStatsCopyWith<$Res> { + factory _$$_RPCStatsCopyWith( + _$_RPCStats value, $Res Function(_$_RPCStats) then) = + __$$_RPCStatsCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {int messagesSent, + int messagesRcvd, + int questionsInFlight, + Timestamp? lastQuestion, + Timestamp? lastSeenTs, + Timestamp? firstConsecutiveSeenTs, + int recentLostAnswers, + int failedToSend}); +} + +/// @nodoc +class __$$_RPCStatsCopyWithImpl<$Res> + extends _$RPCStatsCopyWithImpl<$Res, _$_RPCStats> + implements _$$_RPCStatsCopyWith<$Res> { + __$$_RPCStatsCopyWithImpl( + _$_RPCStats _value, $Res Function(_$_RPCStats) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? messagesSent = null, + Object? messagesRcvd = null, + Object? questionsInFlight = null, + Object? lastQuestion = freezed, + Object? lastSeenTs = freezed, + Object? firstConsecutiveSeenTs = freezed, + Object? recentLostAnswers = null, + Object? failedToSend = null, + }) { + return _then(_$_RPCStats( + messagesSent: null == messagesSent + ? _value.messagesSent + : messagesSent // ignore: cast_nullable_to_non_nullable + as int, + messagesRcvd: null == messagesRcvd + ? _value.messagesRcvd + : messagesRcvd // ignore: cast_nullable_to_non_nullable + as int, + questionsInFlight: null == questionsInFlight + ? _value.questionsInFlight + : questionsInFlight // ignore: cast_nullable_to_non_nullable + as int, + lastQuestion: freezed == lastQuestion + ? _value.lastQuestion + : lastQuestion // ignore: cast_nullable_to_non_nullable + as Timestamp?, + lastSeenTs: freezed == lastSeenTs + ? _value.lastSeenTs + : lastSeenTs // ignore: cast_nullable_to_non_nullable + as Timestamp?, + firstConsecutiveSeenTs: freezed == firstConsecutiveSeenTs + ? _value.firstConsecutiveSeenTs + : firstConsecutiveSeenTs // ignore: cast_nullable_to_non_nullable + as Timestamp?, + recentLostAnswers: null == recentLostAnswers + ? _value.recentLostAnswers + : recentLostAnswers // ignore: cast_nullable_to_non_nullable + as int, + failedToSend: null == failedToSend + ? _value.failedToSend + : failedToSend // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_RPCStats implements _RPCStats { + const _$_RPCStats( + {required this.messagesSent, + required this.messagesRcvd, + required this.questionsInFlight, + required this.lastQuestion, + required this.lastSeenTs, + required this.firstConsecutiveSeenTs, + required this.recentLostAnswers, + required this.failedToSend}); + + factory _$_RPCStats.fromJson(Map json) => + _$$_RPCStatsFromJson(json); + + @override + final int messagesSent; + @override + final int messagesRcvd; + @override + final int questionsInFlight; + @override + final Timestamp? lastQuestion; + @override + final Timestamp? lastSeenTs; + @override + final Timestamp? firstConsecutiveSeenTs; + @override + final int recentLostAnswers; + @override + final int failedToSend; + + @override + String toString() { + return 'RPCStats(messagesSent: $messagesSent, messagesRcvd: $messagesRcvd, questionsInFlight: $questionsInFlight, lastQuestion: $lastQuestion, lastSeenTs: $lastSeenTs, firstConsecutiveSeenTs: $firstConsecutiveSeenTs, recentLostAnswers: $recentLostAnswers, failedToSend: $failedToSend)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_RPCStats && + (identical(other.messagesSent, messagesSent) || + other.messagesSent == messagesSent) && + (identical(other.messagesRcvd, messagesRcvd) || + other.messagesRcvd == messagesRcvd) && + (identical(other.questionsInFlight, questionsInFlight) || + other.questionsInFlight == questionsInFlight) && + (identical(other.lastQuestion, lastQuestion) || + other.lastQuestion == lastQuestion) && + (identical(other.lastSeenTs, lastSeenTs) || + other.lastSeenTs == lastSeenTs) && + (identical(other.firstConsecutiveSeenTs, firstConsecutiveSeenTs) || + other.firstConsecutiveSeenTs == firstConsecutiveSeenTs) && + (identical(other.recentLostAnswers, recentLostAnswers) || + other.recentLostAnswers == recentLostAnswers) && + (identical(other.failedToSend, failedToSend) || + other.failedToSend == failedToSend)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, + messagesSent, + messagesRcvd, + questionsInFlight, + lastQuestion, + lastSeenTs, + firstConsecutiveSeenTs, + recentLostAnswers, + failedToSend); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_RPCStatsCopyWith<_$_RPCStats> get copyWith => + __$$_RPCStatsCopyWithImpl<_$_RPCStats>(this, _$identity); + + @override + Map toJson() { + return _$$_RPCStatsToJson( + this, + ); + } +} + +abstract class _RPCStats implements RPCStats { + const factory _RPCStats( + {required final int messagesSent, + required final int messagesRcvd, + required final int questionsInFlight, + required final Timestamp? lastQuestion, + required final Timestamp? lastSeenTs, + required final Timestamp? firstConsecutiveSeenTs, + required final int recentLostAnswers, + required final int failedToSend}) = _$_RPCStats; + + factory _RPCStats.fromJson(Map json) = _$_RPCStats.fromJson; + + @override + int get messagesSent; + @override + int get messagesRcvd; + @override + int get questionsInFlight; + @override + Timestamp? get lastQuestion; + @override + Timestamp? get lastSeenTs; + @override + Timestamp? get firstConsecutiveSeenTs; + @override + int get recentLostAnswers; + @override + int get failedToSend; + @override + @JsonKey(ignore: true) + _$$_RPCStatsCopyWith<_$_RPCStats> get copyWith => + throw _privateConstructorUsedError; +} + +PeerStats _$PeerStatsFromJson(Map json) { + return _PeerStats.fromJson(json); +} + +/// @nodoc +mixin _$PeerStats { + Timestamp get timeAdded => throw _privateConstructorUsedError; + RPCStats get rpcStats => throw _privateConstructorUsedError; + LatencyStats? get latency => throw _privateConstructorUsedError; + TransferStatsDownUp get transfer => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $PeerStatsCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $PeerStatsCopyWith<$Res> { + factory $PeerStatsCopyWith(PeerStats value, $Res Function(PeerStats) then) = + _$PeerStatsCopyWithImpl<$Res, PeerStats>; + @useResult + $Res call( + {Timestamp timeAdded, + RPCStats rpcStats, + LatencyStats? latency, + TransferStatsDownUp transfer}); + + $RPCStatsCopyWith<$Res> get rpcStats; + $LatencyStatsCopyWith<$Res>? get latency; + $TransferStatsDownUpCopyWith<$Res> get transfer; +} + +/// @nodoc +class _$PeerStatsCopyWithImpl<$Res, $Val extends PeerStats> + implements $PeerStatsCopyWith<$Res> { + _$PeerStatsCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? timeAdded = null, + Object? rpcStats = null, + Object? latency = freezed, + Object? transfer = null, + }) { + return _then(_value.copyWith( + timeAdded: null == timeAdded + ? _value.timeAdded + : timeAdded // ignore: cast_nullable_to_non_nullable + as Timestamp, + rpcStats: null == rpcStats + ? _value.rpcStats + : rpcStats // ignore: cast_nullable_to_non_nullable + as RPCStats, + latency: freezed == latency + ? _value.latency + : latency // ignore: cast_nullable_to_non_nullable + as LatencyStats?, + transfer: null == transfer + ? _value.transfer + : transfer // ignore: cast_nullable_to_non_nullable + as TransferStatsDownUp, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $RPCStatsCopyWith<$Res> get rpcStats { + return $RPCStatsCopyWith<$Res>(_value.rpcStats, (value) { + return _then(_value.copyWith(rpcStats: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $LatencyStatsCopyWith<$Res>? get latency { + if (_value.latency == null) { + return null; + } + + return $LatencyStatsCopyWith<$Res>(_value.latency!, (value) { + return _then(_value.copyWith(latency: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $TransferStatsDownUpCopyWith<$Res> get transfer { + return $TransferStatsDownUpCopyWith<$Res>(_value.transfer, (value) { + return _then(_value.copyWith(transfer: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$_PeerStatsCopyWith<$Res> implements $PeerStatsCopyWith<$Res> { + factory _$$_PeerStatsCopyWith( + _$_PeerStats value, $Res Function(_$_PeerStats) then) = + __$$_PeerStatsCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {Timestamp timeAdded, + RPCStats rpcStats, + LatencyStats? latency, + TransferStatsDownUp transfer}); + + @override + $RPCStatsCopyWith<$Res> get rpcStats; + @override + $LatencyStatsCopyWith<$Res>? get latency; + @override + $TransferStatsDownUpCopyWith<$Res> get transfer; +} + +/// @nodoc +class __$$_PeerStatsCopyWithImpl<$Res> + extends _$PeerStatsCopyWithImpl<$Res, _$_PeerStats> + implements _$$_PeerStatsCopyWith<$Res> { + __$$_PeerStatsCopyWithImpl( + _$_PeerStats _value, $Res Function(_$_PeerStats) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? timeAdded = null, + Object? rpcStats = null, + Object? latency = freezed, + Object? transfer = null, + }) { + return _then(_$_PeerStats( + timeAdded: null == timeAdded + ? _value.timeAdded + : timeAdded // ignore: cast_nullable_to_non_nullable + as Timestamp, + rpcStats: null == rpcStats + ? _value.rpcStats + : rpcStats // ignore: cast_nullable_to_non_nullable + as RPCStats, + latency: freezed == latency + ? _value.latency + : latency // ignore: cast_nullable_to_non_nullable + as LatencyStats?, + transfer: null == transfer + ? _value.transfer + : transfer // ignore: cast_nullable_to_non_nullable + as TransferStatsDownUp, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_PeerStats implements _PeerStats { + const _$_PeerStats( + {required this.timeAdded, + required this.rpcStats, + this.latency, + required this.transfer}); + + factory _$_PeerStats.fromJson(Map json) => + _$$_PeerStatsFromJson(json); + + @override + final Timestamp timeAdded; + @override + final RPCStats rpcStats; + @override + final LatencyStats? latency; + @override + final TransferStatsDownUp transfer; + + @override + String toString() { + return 'PeerStats(timeAdded: $timeAdded, rpcStats: $rpcStats, latency: $latency, transfer: $transfer)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_PeerStats && + (identical(other.timeAdded, timeAdded) || + other.timeAdded == timeAdded) && + (identical(other.rpcStats, rpcStats) || + other.rpcStats == rpcStats) && + (identical(other.latency, latency) || other.latency == latency) && + (identical(other.transfer, transfer) || + other.transfer == transfer)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => + Object.hash(runtimeType, timeAdded, rpcStats, latency, transfer); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_PeerStatsCopyWith<_$_PeerStats> get copyWith => + __$$_PeerStatsCopyWithImpl<_$_PeerStats>(this, _$identity); + + @override + Map toJson() { + return _$$_PeerStatsToJson( + this, + ); + } +} + +abstract class _PeerStats implements PeerStats { + const factory _PeerStats( + {required final Timestamp timeAdded, + required final RPCStats rpcStats, + final LatencyStats? latency, + required final TransferStatsDownUp transfer}) = _$_PeerStats; + + factory _PeerStats.fromJson(Map json) = + _$_PeerStats.fromJson; + + @override + Timestamp get timeAdded; + @override + RPCStats get rpcStats; + @override + LatencyStats? get latency; + @override + TransferStatsDownUp get transfer; + @override + @JsonKey(ignore: true) + _$$_PeerStatsCopyWith<_$_PeerStats> get copyWith => + throw _privateConstructorUsedError; +} + +PeerTableData _$PeerTableDataFromJson(Map json) { + return _PeerTableData.fromJson(json); +} + +/// @nodoc +mixin _$PeerTableData { + List> get nodeIds => + throw _privateConstructorUsedError; + String get peerAddress => throw _privateConstructorUsedError; + PeerStats get peerStats => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $PeerTableDataCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $PeerTableDataCopyWith<$Res> { + factory $PeerTableDataCopyWith( + PeerTableData value, $Res Function(PeerTableData) then) = + _$PeerTableDataCopyWithImpl<$Res, PeerTableData>; + @useResult + $Res call( + {List> nodeIds, + String peerAddress, + PeerStats peerStats}); + + $PeerStatsCopyWith<$Res> get peerStats; +} + +/// @nodoc +class _$PeerTableDataCopyWithImpl<$Res, $Val extends PeerTableData> + implements $PeerTableDataCopyWith<$Res> { + _$PeerTableDataCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? nodeIds = null, + Object? peerAddress = null, + Object? peerStats = null, + }) { + return _then(_value.copyWith( + nodeIds: null == nodeIds + ? _value.nodeIds + : nodeIds // ignore: cast_nullable_to_non_nullable + as List>, + peerAddress: null == peerAddress + ? _value.peerAddress + : peerAddress // ignore: cast_nullable_to_non_nullable + as String, + peerStats: null == peerStats + ? _value.peerStats + : peerStats // ignore: cast_nullable_to_non_nullable + as PeerStats, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $PeerStatsCopyWith<$Res> get peerStats { + return $PeerStatsCopyWith<$Res>(_value.peerStats, (value) { + return _then(_value.copyWith(peerStats: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$_PeerTableDataCopyWith<$Res> + implements $PeerTableDataCopyWith<$Res> { + factory _$$_PeerTableDataCopyWith( + _$_PeerTableData value, $Res Function(_$_PeerTableData) then) = + __$$_PeerTableDataCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {List> nodeIds, + String peerAddress, + PeerStats peerStats}); + + @override + $PeerStatsCopyWith<$Res> get peerStats; +} + +/// @nodoc +class __$$_PeerTableDataCopyWithImpl<$Res> + extends _$PeerTableDataCopyWithImpl<$Res, _$_PeerTableData> + implements _$$_PeerTableDataCopyWith<$Res> { + __$$_PeerTableDataCopyWithImpl( + _$_PeerTableData _value, $Res Function(_$_PeerTableData) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? nodeIds = null, + Object? peerAddress = null, + Object? peerStats = null, + }) { + return _then(_$_PeerTableData( + nodeIds: null == nodeIds + ? _value._nodeIds + : nodeIds // ignore: cast_nullable_to_non_nullable + as List>, + peerAddress: null == peerAddress + ? _value.peerAddress + : peerAddress // ignore: cast_nullable_to_non_nullable + as String, + peerStats: null == peerStats + ? _value.peerStats + : peerStats // ignore: cast_nullable_to_non_nullable + as PeerStats, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_PeerTableData implements _PeerTableData { + const _$_PeerTableData( + {required final List> nodeIds, + required this.peerAddress, + required this.peerStats}) + : _nodeIds = nodeIds; + + factory _$_PeerTableData.fromJson(Map json) => + _$$_PeerTableDataFromJson(json); + + final List> _nodeIds; + @override + List> get nodeIds { + if (_nodeIds is EqualUnmodifiableListView) return _nodeIds; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_nodeIds); + } + + @override + final String peerAddress; + @override + final PeerStats peerStats; + + @override + String toString() { + return 'PeerTableData(nodeIds: $nodeIds, peerAddress: $peerAddress, peerStats: $peerStats)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_PeerTableData && + const DeepCollectionEquality().equals(other._nodeIds, _nodeIds) && + (identical(other.peerAddress, peerAddress) || + other.peerAddress == peerAddress) && + (identical(other.peerStats, peerStats) || + other.peerStats == peerStats)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, + const DeepCollectionEquality().hash(_nodeIds), peerAddress, peerStats); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_PeerTableDataCopyWith<_$_PeerTableData> get copyWith => + __$$_PeerTableDataCopyWithImpl<_$_PeerTableData>(this, _$identity); + + @override + Map toJson() { + return _$$_PeerTableDataToJson( + this, + ); + } +} + +abstract class _PeerTableData implements PeerTableData { + const factory _PeerTableData( + {required final List> nodeIds, + required final String peerAddress, + required final PeerStats peerStats}) = _$_PeerTableData; + + factory _PeerTableData.fromJson(Map json) = + _$_PeerTableData.fromJson; + + @override + List> get nodeIds; + @override + String get peerAddress; + @override + PeerStats get peerStats; + @override + @JsonKey(ignore: true) + _$$_PeerTableDataCopyWith<_$_PeerTableData> get copyWith => + throw _privateConstructorUsedError; +} + +VeilidUpdate _$VeilidUpdateFromJson(Map json) { + switch (json['kind']) { + case 'Log': + return VeilidLog.fromJson(json); + case 'AppMessage': + return VeilidAppMessage.fromJson(json); + case 'AppCall': + return VeilidAppCall.fromJson(json); + case 'Attachment': + return VeilidUpdateAttachment.fromJson(json); + case 'Network': + return VeilidUpdateNetwork.fromJson(json); + case 'Config': + return VeilidUpdateConfig.fromJson(json); + case 'RouteChange': + return VeilidUpdateRouteChange.fromJson(json); + case 'ValueChange': + return VeilidUpdateValueChange.fromJson(json); + + default: + throw CheckedFromJsonException(json, 'kind', 'VeilidUpdate', + 'Invalid union type "${json['kind']}"!'); + } +} + +/// @nodoc +mixin _$VeilidUpdate { + @optionalTypeArgs + TResult when({ + required TResult Function( + VeilidLogLevel logLevel, String message, String? backtrace) + log, + required TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message) + appMessage, + required TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message, String callId) + appCall, + required TResult Function(AttachmentState state, bool publicInternetReady, + bool localNetworkReady) + attachment, + required TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, + List peers) + network, + required TResult Function(VeilidConfig config) config, + required TResult Function( + List deadRoutes, List deadRemoteRoutes) + routeChange, + required TResult Function(Typed key, + List subkeys, int count, ValueData valueData) + valueChange, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + VeilidLogLevel logLevel, String message, String? backtrace)? + log, + TResult? Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message)? + appMessage, + TResult? Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message, String callId)? + appCall, + TResult? Function(AttachmentState state, bool publicInternetReady, + bool localNetworkReady)? + attachment, + TResult? Function(bool started, BigInt bpsDown, BigInt bpsUp, + List peers)? + network, + TResult? Function(VeilidConfig config)? config, + TResult? Function(List deadRoutes, List deadRemoteRoutes)? + routeChange, + TResult? Function(Typed key, + List subkeys, int count, ValueData valueData)? + valueChange, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + VeilidLogLevel logLevel, String message, String? backtrace)? + log, + TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message)? + appMessage, + TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message, String callId)? + appCall, + TResult Function(AttachmentState state, bool publicInternetReady, + bool localNetworkReady)? + attachment, + TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, + List peers)? + network, + TResult Function(VeilidConfig config)? config, + TResult Function(List deadRoutes, List deadRemoteRoutes)? + routeChange, + TResult Function(Typed key, + List subkeys, int count, ValueData valueData)? + valueChange, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(VeilidLog value) log, + required TResult Function(VeilidAppMessage value) appMessage, + required TResult Function(VeilidAppCall value) appCall, + required TResult Function(VeilidUpdateAttachment value) attachment, + required TResult Function(VeilidUpdateNetwork value) network, + required TResult Function(VeilidUpdateConfig value) config, + required TResult Function(VeilidUpdateRouteChange value) routeChange, + required TResult Function(VeilidUpdateValueChange value) valueChange, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(VeilidLog value)? log, + TResult? Function(VeilidAppMessage value)? appMessage, + TResult? Function(VeilidAppCall value)? appCall, + TResult? Function(VeilidUpdateAttachment value)? attachment, + TResult? Function(VeilidUpdateNetwork value)? network, + TResult? Function(VeilidUpdateConfig value)? config, + TResult? Function(VeilidUpdateRouteChange value)? routeChange, + TResult? Function(VeilidUpdateValueChange value)? valueChange, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(VeilidLog value)? log, + TResult Function(VeilidAppMessage value)? appMessage, + TResult Function(VeilidAppCall value)? appCall, + TResult Function(VeilidUpdateAttachment value)? attachment, + TResult Function(VeilidUpdateNetwork value)? network, + TResult Function(VeilidUpdateConfig value)? config, + TResult Function(VeilidUpdateRouteChange value)? routeChange, + TResult Function(VeilidUpdateValueChange value)? valueChange, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + Map toJson() => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VeilidUpdateCopyWith<$Res> { + factory $VeilidUpdateCopyWith( + VeilidUpdate value, $Res Function(VeilidUpdate) then) = + _$VeilidUpdateCopyWithImpl<$Res, VeilidUpdate>; +} + +/// @nodoc +class _$VeilidUpdateCopyWithImpl<$Res, $Val extends VeilidUpdate> + implements $VeilidUpdateCopyWith<$Res> { + _$VeilidUpdateCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; +} + +/// @nodoc +abstract class _$$VeilidLogCopyWith<$Res> { + factory _$$VeilidLogCopyWith( + _$VeilidLog value, $Res Function(_$VeilidLog) then) = + __$$VeilidLogCopyWithImpl<$Res>; + @useResult + $Res call({VeilidLogLevel logLevel, String message, String? backtrace}); +} + +/// @nodoc +class __$$VeilidLogCopyWithImpl<$Res> + extends _$VeilidUpdateCopyWithImpl<$Res, _$VeilidLog> + implements _$$VeilidLogCopyWith<$Res> { + __$$VeilidLogCopyWithImpl( + _$VeilidLog _value, $Res Function(_$VeilidLog) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? logLevel = null, + Object? message = null, + Object? backtrace = freezed, + }) { + return _then(_$VeilidLog( + logLevel: null == logLevel + ? _value.logLevel + : logLevel // ignore: cast_nullable_to_non_nullable + as VeilidLogLevel, + message: null == message + ? _value.message + : message // ignore: cast_nullable_to_non_nullable + as String, + backtrace: freezed == backtrace + ? _value.backtrace + : backtrace // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$VeilidLog implements VeilidLog { + const _$VeilidLog( + {required this.logLevel, + required this.message, + this.backtrace, + final String? $type}) + : $type = $type ?? 'Log'; + + factory _$VeilidLog.fromJson(Map json) => + _$$VeilidLogFromJson(json); + + @override + final VeilidLogLevel logLevel; + @override + final String message; + @override + final String? backtrace; + + @JsonKey(name: 'kind') + final String $type; + + @override + String toString() { + return 'VeilidUpdate.log(logLevel: $logLevel, message: $message, backtrace: $backtrace)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$VeilidLog && + (identical(other.logLevel, logLevel) || + other.logLevel == logLevel) && + (identical(other.message, message) || other.message == message) && + (identical(other.backtrace, backtrace) || + other.backtrace == backtrace)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, logLevel, message, backtrace); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$VeilidLogCopyWith<_$VeilidLog> get copyWith => + __$$VeilidLogCopyWithImpl<_$VeilidLog>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + VeilidLogLevel logLevel, String message, String? backtrace) + log, + required TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message) + appMessage, + required TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message, String callId) + appCall, + required TResult Function(AttachmentState state, bool publicInternetReady, + bool localNetworkReady) + attachment, + required TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, + List peers) + network, + required TResult Function(VeilidConfig config) config, + required TResult Function( + List deadRoutes, List deadRemoteRoutes) + routeChange, + required TResult Function(Typed key, + List subkeys, int count, ValueData valueData) + valueChange, + }) { + return log(logLevel, message, backtrace); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + VeilidLogLevel logLevel, String message, String? backtrace)? + log, + TResult? Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message)? + appMessage, + TResult? Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message, String callId)? + appCall, + TResult? Function(AttachmentState state, bool publicInternetReady, + bool localNetworkReady)? + attachment, + TResult? Function(bool started, BigInt bpsDown, BigInt bpsUp, + List peers)? + network, + TResult? Function(VeilidConfig config)? config, + TResult? Function(List deadRoutes, List deadRemoteRoutes)? + routeChange, + TResult? Function(Typed key, + List subkeys, int count, ValueData valueData)? + valueChange, + }) { + return log?.call(logLevel, message, backtrace); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + VeilidLogLevel logLevel, String message, String? backtrace)? + log, + TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message)? + appMessage, + TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message, String callId)? + appCall, + TResult Function(AttachmentState state, bool publicInternetReady, + bool localNetworkReady)? + attachment, + TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, + List peers)? + network, + TResult Function(VeilidConfig config)? config, + TResult Function(List deadRoutes, List deadRemoteRoutes)? + routeChange, + TResult Function(Typed key, + List subkeys, int count, ValueData valueData)? + valueChange, + required TResult orElse(), + }) { + if (log != null) { + return log(logLevel, message, backtrace); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(VeilidLog value) log, + required TResult Function(VeilidAppMessage value) appMessage, + required TResult Function(VeilidAppCall value) appCall, + required TResult Function(VeilidUpdateAttachment value) attachment, + required TResult Function(VeilidUpdateNetwork value) network, + required TResult Function(VeilidUpdateConfig value) config, + required TResult Function(VeilidUpdateRouteChange value) routeChange, + required TResult Function(VeilidUpdateValueChange value) valueChange, + }) { + return log(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(VeilidLog value)? log, + TResult? Function(VeilidAppMessage value)? appMessage, + TResult? Function(VeilidAppCall value)? appCall, + TResult? Function(VeilidUpdateAttachment value)? attachment, + TResult? Function(VeilidUpdateNetwork value)? network, + TResult? Function(VeilidUpdateConfig value)? config, + TResult? Function(VeilidUpdateRouteChange value)? routeChange, + TResult? Function(VeilidUpdateValueChange value)? valueChange, + }) { + return log?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(VeilidLog value)? log, + TResult Function(VeilidAppMessage value)? appMessage, + TResult Function(VeilidAppCall value)? appCall, + TResult Function(VeilidUpdateAttachment value)? attachment, + TResult Function(VeilidUpdateNetwork value)? network, + TResult Function(VeilidUpdateConfig value)? config, + TResult Function(VeilidUpdateRouteChange value)? routeChange, + TResult Function(VeilidUpdateValueChange value)? valueChange, + required TResult orElse(), + }) { + if (log != null) { + return log(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$VeilidLogToJson( + this, + ); + } +} + +abstract class VeilidLog implements VeilidUpdate { + const factory VeilidLog( + {required final VeilidLogLevel logLevel, + required final String message, + final String? backtrace}) = _$VeilidLog; + + factory VeilidLog.fromJson(Map json) = _$VeilidLog.fromJson; + + VeilidLogLevel get logLevel; + String get message; + String? get backtrace; + @JsonKey(ignore: true) + _$$VeilidLogCopyWith<_$VeilidLog> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$VeilidAppMessageCopyWith<$Res> { + factory _$$VeilidAppMessageCopyWith( + _$VeilidAppMessage value, $Res Function(_$VeilidAppMessage) then) = + __$$VeilidAppMessageCopyWithImpl<$Res>; + @useResult + $Res call( + {Typed? sender, + @Uint8ListJsonConverter() Uint8List message}); +} + +/// @nodoc +class __$$VeilidAppMessageCopyWithImpl<$Res> + extends _$VeilidUpdateCopyWithImpl<$Res, _$VeilidAppMessage> + implements _$$VeilidAppMessageCopyWith<$Res> { + __$$VeilidAppMessageCopyWithImpl( + _$VeilidAppMessage _value, $Res Function(_$VeilidAppMessage) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? sender = freezed, + Object? message = null, + }) { + return _then(_$VeilidAppMessage( + sender: freezed == sender + ? _value.sender + : sender // ignore: cast_nullable_to_non_nullable + as Typed?, + message: null == message + ? _value.message + : message // ignore: cast_nullable_to_non_nullable + as Uint8List, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$VeilidAppMessage implements VeilidAppMessage { + const _$VeilidAppMessage( + {this.sender, + @Uint8ListJsonConverter() required this.message, + final String? $type}) + : $type = $type ?? 'AppMessage'; + + factory _$VeilidAppMessage.fromJson(Map json) => + _$$VeilidAppMessageFromJson(json); + + @override + final Typed? sender; + @override + @Uint8ListJsonConverter() + final Uint8List message; + + @JsonKey(name: 'kind') + final String $type; + + @override + String toString() { + return 'VeilidUpdate.appMessage(sender: $sender, message: $message)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$VeilidAppMessage && + (identical(other.sender, sender) || other.sender == sender) && + const DeepCollectionEquality().equals(other.message, message)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, sender, const DeepCollectionEquality().hash(message)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$VeilidAppMessageCopyWith<_$VeilidAppMessage> get copyWith => + __$$VeilidAppMessageCopyWithImpl<_$VeilidAppMessage>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + VeilidLogLevel logLevel, String message, String? backtrace) + log, + required TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message) + appMessage, + required TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message, String callId) + appCall, + required TResult Function(AttachmentState state, bool publicInternetReady, + bool localNetworkReady) + attachment, + required TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, + List peers) + network, + required TResult Function(VeilidConfig config) config, + required TResult Function( + List deadRoutes, List deadRemoteRoutes) + routeChange, + required TResult Function(Typed key, + List subkeys, int count, ValueData valueData) + valueChange, + }) { + return appMessage(sender, message); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + VeilidLogLevel logLevel, String message, String? backtrace)? + log, + TResult? Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message)? + appMessage, + TResult? Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message, String callId)? + appCall, + TResult? Function(AttachmentState state, bool publicInternetReady, + bool localNetworkReady)? + attachment, + TResult? Function(bool started, BigInt bpsDown, BigInt bpsUp, + List peers)? + network, + TResult? Function(VeilidConfig config)? config, + TResult? Function(List deadRoutes, List deadRemoteRoutes)? + routeChange, + TResult? Function(Typed key, + List subkeys, int count, ValueData valueData)? + valueChange, + }) { + return appMessage?.call(sender, message); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + VeilidLogLevel logLevel, String message, String? backtrace)? + log, + TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message)? + appMessage, + TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message, String callId)? + appCall, + TResult Function(AttachmentState state, bool publicInternetReady, + bool localNetworkReady)? + attachment, + TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, + List peers)? + network, + TResult Function(VeilidConfig config)? config, + TResult Function(List deadRoutes, List deadRemoteRoutes)? + routeChange, + TResult Function(Typed key, + List subkeys, int count, ValueData valueData)? + valueChange, + required TResult orElse(), + }) { + if (appMessage != null) { + return appMessage(sender, message); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(VeilidLog value) log, + required TResult Function(VeilidAppMessage value) appMessage, + required TResult Function(VeilidAppCall value) appCall, + required TResult Function(VeilidUpdateAttachment value) attachment, + required TResult Function(VeilidUpdateNetwork value) network, + required TResult Function(VeilidUpdateConfig value) config, + required TResult Function(VeilidUpdateRouteChange value) routeChange, + required TResult Function(VeilidUpdateValueChange value) valueChange, + }) { + return appMessage(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(VeilidLog value)? log, + TResult? Function(VeilidAppMessage value)? appMessage, + TResult? Function(VeilidAppCall value)? appCall, + TResult? Function(VeilidUpdateAttachment value)? attachment, + TResult? Function(VeilidUpdateNetwork value)? network, + TResult? Function(VeilidUpdateConfig value)? config, + TResult? Function(VeilidUpdateRouteChange value)? routeChange, + TResult? Function(VeilidUpdateValueChange value)? valueChange, + }) { + return appMessage?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(VeilidLog value)? log, + TResult Function(VeilidAppMessage value)? appMessage, + TResult Function(VeilidAppCall value)? appCall, + TResult Function(VeilidUpdateAttachment value)? attachment, + TResult Function(VeilidUpdateNetwork value)? network, + TResult Function(VeilidUpdateConfig value)? config, + TResult Function(VeilidUpdateRouteChange value)? routeChange, + TResult Function(VeilidUpdateValueChange value)? valueChange, + required TResult orElse(), + }) { + if (appMessage != null) { + return appMessage(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$VeilidAppMessageToJson( + this, + ); + } +} + +abstract class VeilidAppMessage implements VeilidUpdate { + const factory VeilidAppMessage( + {final Typed? sender, + @Uint8ListJsonConverter() required final Uint8List message}) = + _$VeilidAppMessage; + + factory VeilidAppMessage.fromJson(Map json) = + _$VeilidAppMessage.fromJson; + + Typed? get sender; + @Uint8ListJsonConverter() + Uint8List get message; + @JsonKey(ignore: true) + _$$VeilidAppMessageCopyWith<_$VeilidAppMessage> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$VeilidAppCallCopyWith<$Res> { + factory _$$VeilidAppCallCopyWith( + _$VeilidAppCall value, $Res Function(_$VeilidAppCall) then) = + __$$VeilidAppCallCopyWithImpl<$Res>; + @useResult + $Res call( + {Typed? sender, + @Uint8ListJsonConverter() Uint8List message, + String callId}); +} + +/// @nodoc +class __$$VeilidAppCallCopyWithImpl<$Res> + extends _$VeilidUpdateCopyWithImpl<$Res, _$VeilidAppCall> + implements _$$VeilidAppCallCopyWith<$Res> { + __$$VeilidAppCallCopyWithImpl( + _$VeilidAppCall _value, $Res Function(_$VeilidAppCall) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? sender = freezed, + Object? message = null, + Object? callId = null, + }) { + return _then(_$VeilidAppCall( + sender: freezed == sender + ? _value.sender + : sender // ignore: cast_nullable_to_non_nullable + as Typed?, + message: null == message + ? _value.message + : message // ignore: cast_nullable_to_non_nullable + as Uint8List, + callId: null == callId + ? _value.callId + : callId // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$VeilidAppCall implements VeilidAppCall { + const _$VeilidAppCall( + {this.sender, + @Uint8ListJsonConverter() required this.message, + required this.callId, + final String? $type}) + : $type = $type ?? 'AppCall'; + + factory _$VeilidAppCall.fromJson(Map json) => + _$$VeilidAppCallFromJson(json); + + @override + final Typed? sender; + @override + @Uint8ListJsonConverter() + final Uint8List message; + @override + final String callId; + + @JsonKey(name: 'kind') + final String $type; + + @override + String toString() { + return 'VeilidUpdate.appCall(sender: $sender, message: $message, callId: $callId)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$VeilidAppCall && + (identical(other.sender, sender) || other.sender == sender) && + const DeepCollectionEquality().equals(other.message, message) && + (identical(other.callId, callId) || other.callId == callId)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, sender, + const DeepCollectionEquality().hash(message), callId); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$VeilidAppCallCopyWith<_$VeilidAppCall> get copyWith => + __$$VeilidAppCallCopyWithImpl<_$VeilidAppCall>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + VeilidLogLevel logLevel, String message, String? backtrace) + log, + required TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message) + appMessage, + required TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message, String callId) + appCall, + required TResult Function(AttachmentState state, bool publicInternetReady, + bool localNetworkReady) + attachment, + required TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, + List peers) + network, + required TResult Function(VeilidConfig config) config, + required TResult Function( + List deadRoutes, List deadRemoteRoutes) + routeChange, + required TResult Function(Typed key, + List subkeys, int count, ValueData valueData) + valueChange, + }) { + return appCall(sender, message, callId); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + VeilidLogLevel logLevel, String message, String? backtrace)? + log, + TResult? Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message)? + appMessage, + TResult? Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message, String callId)? + appCall, + TResult? Function(AttachmentState state, bool publicInternetReady, + bool localNetworkReady)? + attachment, + TResult? Function(bool started, BigInt bpsDown, BigInt bpsUp, + List peers)? + network, + TResult? Function(VeilidConfig config)? config, + TResult? Function(List deadRoutes, List deadRemoteRoutes)? + routeChange, + TResult? Function(Typed key, + List subkeys, int count, ValueData valueData)? + valueChange, + }) { + return appCall?.call(sender, message, callId); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + VeilidLogLevel logLevel, String message, String? backtrace)? + log, + TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message)? + appMessage, + TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message, String callId)? + appCall, + TResult Function(AttachmentState state, bool publicInternetReady, + bool localNetworkReady)? + attachment, + TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, + List peers)? + network, + TResult Function(VeilidConfig config)? config, + TResult Function(List deadRoutes, List deadRemoteRoutes)? + routeChange, + TResult Function(Typed key, + List subkeys, int count, ValueData valueData)? + valueChange, + required TResult orElse(), + }) { + if (appCall != null) { + return appCall(sender, message, callId); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(VeilidLog value) log, + required TResult Function(VeilidAppMessage value) appMessage, + required TResult Function(VeilidAppCall value) appCall, + required TResult Function(VeilidUpdateAttachment value) attachment, + required TResult Function(VeilidUpdateNetwork value) network, + required TResult Function(VeilidUpdateConfig value) config, + required TResult Function(VeilidUpdateRouteChange value) routeChange, + required TResult Function(VeilidUpdateValueChange value) valueChange, + }) { + return appCall(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(VeilidLog value)? log, + TResult? Function(VeilidAppMessage value)? appMessage, + TResult? Function(VeilidAppCall value)? appCall, + TResult? Function(VeilidUpdateAttachment value)? attachment, + TResult? Function(VeilidUpdateNetwork value)? network, + TResult? Function(VeilidUpdateConfig value)? config, + TResult? Function(VeilidUpdateRouteChange value)? routeChange, + TResult? Function(VeilidUpdateValueChange value)? valueChange, + }) { + return appCall?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(VeilidLog value)? log, + TResult Function(VeilidAppMessage value)? appMessage, + TResult Function(VeilidAppCall value)? appCall, + TResult Function(VeilidUpdateAttachment value)? attachment, + TResult Function(VeilidUpdateNetwork value)? network, + TResult Function(VeilidUpdateConfig value)? config, + TResult Function(VeilidUpdateRouteChange value)? routeChange, + TResult Function(VeilidUpdateValueChange value)? valueChange, + required TResult orElse(), + }) { + if (appCall != null) { + return appCall(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$VeilidAppCallToJson( + this, + ); + } +} + +abstract class VeilidAppCall implements VeilidUpdate { + const factory VeilidAppCall( + {final Typed? sender, + @Uint8ListJsonConverter() required final Uint8List message, + required final String callId}) = _$VeilidAppCall; + + factory VeilidAppCall.fromJson(Map json) = + _$VeilidAppCall.fromJson; + + Typed? get sender; + @Uint8ListJsonConverter() + Uint8List get message; + String get callId; + @JsonKey(ignore: true) + _$$VeilidAppCallCopyWith<_$VeilidAppCall> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$VeilidUpdateAttachmentCopyWith<$Res> { + factory _$$VeilidUpdateAttachmentCopyWith(_$VeilidUpdateAttachment value, + $Res Function(_$VeilidUpdateAttachment) then) = + __$$VeilidUpdateAttachmentCopyWithImpl<$Res>; + @useResult + $Res call( + {AttachmentState state, + bool publicInternetReady, + bool localNetworkReady}); +} + +/// @nodoc +class __$$VeilidUpdateAttachmentCopyWithImpl<$Res> + extends _$VeilidUpdateCopyWithImpl<$Res, _$VeilidUpdateAttachment> + implements _$$VeilidUpdateAttachmentCopyWith<$Res> { + __$$VeilidUpdateAttachmentCopyWithImpl(_$VeilidUpdateAttachment _value, + $Res Function(_$VeilidUpdateAttachment) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? state = null, + Object? publicInternetReady = null, + Object? localNetworkReady = null, + }) { + return _then(_$VeilidUpdateAttachment( + state: null == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as AttachmentState, + publicInternetReady: null == publicInternetReady + ? _value.publicInternetReady + : publicInternetReady // ignore: cast_nullable_to_non_nullable + as bool, + localNetworkReady: null == localNetworkReady + ? _value.localNetworkReady + : localNetworkReady // ignore: cast_nullable_to_non_nullable + as bool, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$VeilidUpdateAttachment implements VeilidUpdateAttachment { + const _$VeilidUpdateAttachment( + {required this.state, + required this.publicInternetReady, + required this.localNetworkReady, + final String? $type}) + : $type = $type ?? 'Attachment'; + + factory _$VeilidUpdateAttachment.fromJson(Map json) => + _$$VeilidUpdateAttachmentFromJson(json); + + @override + final AttachmentState state; + @override + final bool publicInternetReady; + @override + final bool localNetworkReady; + + @JsonKey(name: 'kind') + final String $type; + + @override + String toString() { + return 'VeilidUpdate.attachment(state: $state, publicInternetReady: $publicInternetReady, localNetworkReady: $localNetworkReady)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$VeilidUpdateAttachment && + (identical(other.state, state) || other.state == state) && + (identical(other.publicInternetReady, publicInternetReady) || + other.publicInternetReady == publicInternetReady) && + (identical(other.localNetworkReady, localNetworkReady) || + other.localNetworkReady == localNetworkReady)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => + Object.hash(runtimeType, state, publicInternetReady, localNetworkReady); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$VeilidUpdateAttachmentCopyWith<_$VeilidUpdateAttachment> get copyWith => + __$$VeilidUpdateAttachmentCopyWithImpl<_$VeilidUpdateAttachment>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + VeilidLogLevel logLevel, String message, String? backtrace) + log, + required TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message) + appMessage, + required TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message, String callId) + appCall, + required TResult Function(AttachmentState state, bool publicInternetReady, + bool localNetworkReady) + attachment, + required TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, + List peers) + network, + required TResult Function(VeilidConfig config) config, + required TResult Function( + List deadRoutes, List deadRemoteRoutes) + routeChange, + required TResult Function(Typed key, + List subkeys, int count, ValueData valueData) + valueChange, + }) { + return attachment(state, publicInternetReady, localNetworkReady); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + VeilidLogLevel logLevel, String message, String? backtrace)? + log, + TResult? Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message)? + appMessage, + TResult? Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message, String callId)? + appCall, + TResult? Function(AttachmentState state, bool publicInternetReady, + bool localNetworkReady)? + attachment, + TResult? Function(bool started, BigInt bpsDown, BigInt bpsUp, + List peers)? + network, + TResult? Function(VeilidConfig config)? config, + TResult? Function(List deadRoutes, List deadRemoteRoutes)? + routeChange, + TResult? Function(Typed key, + List subkeys, int count, ValueData valueData)? + valueChange, + }) { + return attachment?.call(state, publicInternetReady, localNetworkReady); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + VeilidLogLevel logLevel, String message, String? backtrace)? + log, + TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message)? + appMessage, + TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message, String callId)? + appCall, + TResult Function(AttachmentState state, bool publicInternetReady, + bool localNetworkReady)? + attachment, + TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, + List peers)? + network, + TResult Function(VeilidConfig config)? config, + TResult Function(List deadRoutes, List deadRemoteRoutes)? + routeChange, + TResult Function(Typed key, + List subkeys, int count, ValueData valueData)? + valueChange, + required TResult orElse(), + }) { + if (attachment != null) { + return attachment(state, publicInternetReady, localNetworkReady); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(VeilidLog value) log, + required TResult Function(VeilidAppMessage value) appMessage, + required TResult Function(VeilidAppCall value) appCall, + required TResult Function(VeilidUpdateAttachment value) attachment, + required TResult Function(VeilidUpdateNetwork value) network, + required TResult Function(VeilidUpdateConfig value) config, + required TResult Function(VeilidUpdateRouteChange value) routeChange, + required TResult Function(VeilidUpdateValueChange value) valueChange, + }) { + return attachment(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(VeilidLog value)? log, + TResult? Function(VeilidAppMessage value)? appMessage, + TResult? Function(VeilidAppCall value)? appCall, + TResult? Function(VeilidUpdateAttachment value)? attachment, + TResult? Function(VeilidUpdateNetwork value)? network, + TResult? Function(VeilidUpdateConfig value)? config, + TResult? Function(VeilidUpdateRouteChange value)? routeChange, + TResult? Function(VeilidUpdateValueChange value)? valueChange, + }) { + return attachment?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(VeilidLog value)? log, + TResult Function(VeilidAppMessage value)? appMessage, + TResult Function(VeilidAppCall value)? appCall, + TResult Function(VeilidUpdateAttachment value)? attachment, + TResult Function(VeilidUpdateNetwork value)? network, + TResult Function(VeilidUpdateConfig value)? config, + TResult Function(VeilidUpdateRouteChange value)? routeChange, + TResult Function(VeilidUpdateValueChange value)? valueChange, + required TResult orElse(), + }) { + if (attachment != null) { + return attachment(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$VeilidUpdateAttachmentToJson( + this, + ); + } +} + +abstract class VeilidUpdateAttachment implements VeilidUpdate { + const factory VeilidUpdateAttachment( + {required final AttachmentState state, + required final bool publicInternetReady, + required final bool localNetworkReady}) = _$VeilidUpdateAttachment; + + factory VeilidUpdateAttachment.fromJson(Map json) = + _$VeilidUpdateAttachment.fromJson; + + AttachmentState get state; + bool get publicInternetReady; + bool get localNetworkReady; + @JsonKey(ignore: true) + _$$VeilidUpdateAttachmentCopyWith<_$VeilidUpdateAttachment> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$VeilidUpdateNetworkCopyWith<$Res> { + factory _$$VeilidUpdateNetworkCopyWith(_$VeilidUpdateNetwork value, + $Res Function(_$VeilidUpdateNetwork) then) = + __$$VeilidUpdateNetworkCopyWithImpl<$Res>; + @useResult + $Res call( + {bool started, BigInt bpsDown, BigInt bpsUp, List peers}); +} + +/// @nodoc +class __$$VeilidUpdateNetworkCopyWithImpl<$Res> + extends _$VeilidUpdateCopyWithImpl<$Res, _$VeilidUpdateNetwork> + implements _$$VeilidUpdateNetworkCopyWith<$Res> { + __$$VeilidUpdateNetworkCopyWithImpl( + _$VeilidUpdateNetwork _value, $Res Function(_$VeilidUpdateNetwork) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? started = null, + Object? bpsDown = null, + Object? bpsUp = null, + Object? peers = null, + }) { + return _then(_$VeilidUpdateNetwork( + started: null == started + ? _value.started + : started // ignore: cast_nullable_to_non_nullable + as bool, + bpsDown: null == bpsDown + ? _value.bpsDown + : bpsDown // ignore: cast_nullable_to_non_nullable + as BigInt, + bpsUp: null == bpsUp + ? _value.bpsUp + : bpsUp // ignore: cast_nullable_to_non_nullable + as BigInt, + peers: null == peers + ? _value._peers + : peers // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$VeilidUpdateNetwork implements VeilidUpdateNetwork { + const _$VeilidUpdateNetwork( + {required this.started, + required this.bpsDown, + required this.bpsUp, + required final List peers, + final String? $type}) + : _peers = peers, + $type = $type ?? 'Network'; + + factory _$VeilidUpdateNetwork.fromJson(Map json) => + _$$VeilidUpdateNetworkFromJson(json); + + @override + final bool started; + @override + final BigInt bpsDown; + @override + final BigInt bpsUp; + final List _peers; + @override + List get peers { + if (_peers is EqualUnmodifiableListView) return _peers; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_peers); + } + + @JsonKey(name: 'kind') + final String $type; + + @override + String toString() { + return 'VeilidUpdate.network(started: $started, bpsDown: $bpsDown, bpsUp: $bpsUp, peers: $peers)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$VeilidUpdateNetwork && + (identical(other.started, started) || other.started == started) && + (identical(other.bpsDown, bpsDown) || other.bpsDown == bpsDown) && + (identical(other.bpsUp, bpsUp) || other.bpsUp == bpsUp) && + const DeepCollectionEquality().equals(other._peers, _peers)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, started, bpsDown, bpsUp, + const DeepCollectionEquality().hash(_peers)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$VeilidUpdateNetworkCopyWith<_$VeilidUpdateNetwork> get copyWith => + __$$VeilidUpdateNetworkCopyWithImpl<_$VeilidUpdateNetwork>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + VeilidLogLevel logLevel, String message, String? backtrace) + log, + required TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message) + appMessage, + required TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message, String callId) + appCall, + required TResult Function(AttachmentState state, bool publicInternetReady, + bool localNetworkReady) + attachment, + required TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, + List peers) + network, + required TResult Function(VeilidConfig config) config, + required TResult Function( + List deadRoutes, List deadRemoteRoutes) + routeChange, + required TResult Function(Typed key, + List subkeys, int count, ValueData valueData) + valueChange, + }) { + return network(started, bpsDown, bpsUp, peers); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + VeilidLogLevel logLevel, String message, String? backtrace)? + log, + TResult? Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message)? + appMessage, + TResult? Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message, String callId)? + appCall, + TResult? Function(AttachmentState state, bool publicInternetReady, + bool localNetworkReady)? + attachment, + TResult? Function(bool started, BigInt bpsDown, BigInt bpsUp, + List peers)? + network, + TResult? Function(VeilidConfig config)? config, + TResult? Function(List deadRoutes, List deadRemoteRoutes)? + routeChange, + TResult? Function(Typed key, + List subkeys, int count, ValueData valueData)? + valueChange, + }) { + return network?.call(started, bpsDown, bpsUp, peers); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + VeilidLogLevel logLevel, String message, String? backtrace)? + log, + TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message)? + appMessage, + TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message, String callId)? + appCall, + TResult Function(AttachmentState state, bool publicInternetReady, + bool localNetworkReady)? + attachment, + TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, + List peers)? + network, + TResult Function(VeilidConfig config)? config, + TResult Function(List deadRoutes, List deadRemoteRoutes)? + routeChange, + TResult Function(Typed key, + List subkeys, int count, ValueData valueData)? + valueChange, + required TResult orElse(), + }) { + if (network != null) { + return network(started, bpsDown, bpsUp, peers); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(VeilidLog value) log, + required TResult Function(VeilidAppMessage value) appMessage, + required TResult Function(VeilidAppCall value) appCall, + required TResult Function(VeilidUpdateAttachment value) attachment, + required TResult Function(VeilidUpdateNetwork value) network, + required TResult Function(VeilidUpdateConfig value) config, + required TResult Function(VeilidUpdateRouteChange value) routeChange, + required TResult Function(VeilidUpdateValueChange value) valueChange, + }) { + return network(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(VeilidLog value)? log, + TResult? Function(VeilidAppMessage value)? appMessage, + TResult? Function(VeilidAppCall value)? appCall, + TResult? Function(VeilidUpdateAttachment value)? attachment, + TResult? Function(VeilidUpdateNetwork value)? network, + TResult? Function(VeilidUpdateConfig value)? config, + TResult? Function(VeilidUpdateRouteChange value)? routeChange, + TResult? Function(VeilidUpdateValueChange value)? valueChange, + }) { + return network?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(VeilidLog value)? log, + TResult Function(VeilidAppMessage value)? appMessage, + TResult Function(VeilidAppCall value)? appCall, + TResult Function(VeilidUpdateAttachment value)? attachment, + TResult Function(VeilidUpdateNetwork value)? network, + TResult Function(VeilidUpdateConfig value)? config, + TResult Function(VeilidUpdateRouteChange value)? routeChange, + TResult Function(VeilidUpdateValueChange value)? valueChange, + required TResult orElse(), + }) { + if (network != null) { + return network(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$VeilidUpdateNetworkToJson( + this, + ); + } +} + +abstract class VeilidUpdateNetwork implements VeilidUpdate { + const factory VeilidUpdateNetwork( + {required final bool started, + required final BigInt bpsDown, + required final BigInt bpsUp, + required final List peers}) = _$VeilidUpdateNetwork; + + factory VeilidUpdateNetwork.fromJson(Map json) = + _$VeilidUpdateNetwork.fromJson; + + bool get started; + BigInt get bpsDown; + BigInt get bpsUp; + List get peers; + @JsonKey(ignore: true) + _$$VeilidUpdateNetworkCopyWith<_$VeilidUpdateNetwork> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$VeilidUpdateConfigCopyWith<$Res> { + factory _$$VeilidUpdateConfigCopyWith(_$VeilidUpdateConfig value, + $Res Function(_$VeilidUpdateConfig) then) = + __$$VeilidUpdateConfigCopyWithImpl<$Res>; + @useResult + $Res call({VeilidConfig config}); + + $VeilidConfigCopyWith<$Res> get config; +} + +/// @nodoc +class __$$VeilidUpdateConfigCopyWithImpl<$Res> + extends _$VeilidUpdateCopyWithImpl<$Res, _$VeilidUpdateConfig> + implements _$$VeilidUpdateConfigCopyWith<$Res> { + __$$VeilidUpdateConfigCopyWithImpl( + _$VeilidUpdateConfig _value, $Res Function(_$VeilidUpdateConfig) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? config = null, + }) { + return _then(_$VeilidUpdateConfig( + config: null == config + ? _value.config + : config // ignore: cast_nullable_to_non_nullable + as VeilidConfig, + )); + } + + @override + @pragma('vm:prefer-inline') + $VeilidConfigCopyWith<$Res> get config { + return $VeilidConfigCopyWith<$Res>(_value.config, (value) { + return _then(_value.copyWith(config: value)); + }); + } +} + +/// @nodoc +@JsonSerializable() +class _$VeilidUpdateConfig implements VeilidUpdateConfig { + const _$VeilidUpdateConfig({required this.config, final String? $type}) + : $type = $type ?? 'Config'; + + factory _$VeilidUpdateConfig.fromJson(Map json) => + _$$VeilidUpdateConfigFromJson(json); + + @override + final VeilidConfig config; + + @JsonKey(name: 'kind') + final String $type; + + @override + String toString() { + return 'VeilidUpdate.config(config: $config)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$VeilidUpdateConfig && + (identical(other.config, config) || other.config == config)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, config); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$VeilidUpdateConfigCopyWith<_$VeilidUpdateConfig> get copyWith => + __$$VeilidUpdateConfigCopyWithImpl<_$VeilidUpdateConfig>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + VeilidLogLevel logLevel, String message, String? backtrace) + log, + required TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message) + appMessage, + required TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message, String callId) + appCall, + required TResult Function(AttachmentState state, bool publicInternetReady, + bool localNetworkReady) + attachment, + required TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, + List peers) + network, + required TResult Function(VeilidConfig config) config, + required TResult Function( + List deadRoutes, List deadRemoteRoutes) + routeChange, + required TResult Function(Typed key, + List subkeys, int count, ValueData valueData) + valueChange, + }) { + return config(this.config); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + VeilidLogLevel logLevel, String message, String? backtrace)? + log, + TResult? Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message)? + appMessage, + TResult? Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message, String callId)? + appCall, + TResult? Function(AttachmentState state, bool publicInternetReady, + bool localNetworkReady)? + attachment, + TResult? Function(bool started, BigInt bpsDown, BigInt bpsUp, + List peers)? + network, + TResult? Function(VeilidConfig config)? config, + TResult? Function(List deadRoutes, List deadRemoteRoutes)? + routeChange, + TResult? Function(Typed key, + List subkeys, int count, ValueData valueData)? + valueChange, + }) { + return config?.call(this.config); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + VeilidLogLevel logLevel, String message, String? backtrace)? + log, + TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message)? + appMessage, + TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message, String callId)? + appCall, + TResult Function(AttachmentState state, bool publicInternetReady, + bool localNetworkReady)? + attachment, + TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, + List peers)? + network, + TResult Function(VeilidConfig config)? config, + TResult Function(List deadRoutes, List deadRemoteRoutes)? + routeChange, + TResult Function(Typed key, + List subkeys, int count, ValueData valueData)? + valueChange, + required TResult orElse(), + }) { + if (config != null) { + return config(this.config); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(VeilidLog value) log, + required TResult Function(VeilidAppMessage value) appMessage, + required TResult Function(VeilidAppCall value) appCall, + required TResult Function(VeilidUpdateAttachment value) attachment, + required TResult Function(VeilidUpdateNetwork value) network, + required TResult Function(VeilidUpdateConfig value) config, + required TResult Function(VeilidUpdateRouteChange value) routeChange, + required TResult Function(VeilidUpdateValueChange value) valueChange, + }) { + return config(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(VeilidLog value)? log, + TResult? Function(VeilidAppMessage value)? appMessage, + TResult? Function(VeilidAppCall value)? appCall, + TResult? Function(VeilidUpdateAttachment value)? attachment, + TResult? Function(VeilidUpdateNetwork value)? network, + TResult? Function(VeilidUpdateConfig value)? config, + TResult? Function(VeilidUpdateRouteChange value)? routeChange, + TResult? Function(VeilidUpdateValueChange value)? valueChange, + }) { + return config?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(VeilidLog value)? log, + TResult Function(VeilidAppMessage value)? appMessage, + TResult Function(VeilidAppCall value)? appCall, + TResult Function(VeilidUpdateAttachment value)? attachment, + TResult Function(VeilidUpdateNetwork value)? network, + TResult Function(VeilidUpdateConfig value)? config, + TResult Function(VeilidUpdateRouteChange value)? routeChange, + TResult Function(VeilidUpdateValueChange value)? valueChange, + required TResult orElse(), + }) { + if (config != null) { + return config(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$VeilidUpdateConfigToJson( + this, + ); + } +} + +abstract class VeilidUpdateConfig implements VeilidUpdate { + const factory VeilidUpdateConfig({required final VeilidConfig config}) = + _$VeilidUpdateConfig; + + factory VeilidUpdateConfig.fromJson(Map json) = + _$VeilidUpdateConfig.fromJson; + + VeilidConfig get config; + @JsonKey(ignore: true) + _$$VeilidUpdateConfigCopyWith<_$VeilidUpdateConfig> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$VeilidUpdateRouteChangeCopyWith<$Res> { + factory _$$VeilidUpdateRouteChangeCopyWith(_$VeilidUpdateRouteChange value, + $Res Function(_$VeilidUpdateRouteChange) then) = + __$$VeilidUpdateRouteChangeCopyWithImpl<$Res>; + @useResult + $Res call({List deadRoutes, List deadRemoteRoutes}); +} + +/// @nodoc +class __$$VeilidUpdateRouteChangeCopyWithImpl<$Res> + extends _$VeilidUpdateCopyWithImpl<$Res, _$VeilidUpdateRouteChange> + implements _$$VeilidUpdateRouteChangeCopyWith<$Res> { + __$$VeilidUpdateRouteChangeCopyWithImpl(_$VeilidUpdateRouteChange _value, + $Res Function(_$VeilidUpdateRouteChange) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? deadRoutes = null, + Object? deadRemoteRoutes = null, + }) { + return _then(_$VeilidUpdateRouteChange( + deadRoutes: null == deadRoutes + ? _value._deadRoutes + : deadRoutes // ignore: cast_nullable_to_non_nullable + as List, + deadRemoteRoutes: null == deadRemoteRoutes + ? _value._deadRemoteRoutes + : deadRemoteRoutes // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$VeilidUpdateRouteChange implements VeilidUpdateRouteChange { + const _$VeilidUpdateRouteChange( + {required final List deadRoutes, + required final List deadRemoteRoutes, + final String? $type}) + : _deadRoutes = deadRoutes, + _deadRemoteRoutes = deadRemoteRoutes, + $type = $type ?? 'RouteChange'; + + factory _$VeilidUpdateRouteChange.fromJson(Map json) => + _$$VeilidUpdateRouteChangeFromJson(json); + + final List _deadRoutes; + @override + List get deadRoutes { + if (_deadRoutes is EqualUnmodifiableListView) return _deadRoutes; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_deadRoutes); + } + + final List _deadRemoteRoutes; + @override + List get deadRemoteRoutes { + if (_deadRemoteRoutes is EqualUnmodifiableListView) + return _deadRemoteRoutes; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_deadRemoteRoutes); + } + + @JsonKey(name: 'kind') + final String $type; + + @override + String toString() { + return 'VeilidUpdate.routeChange(deadRoutes: $deadRoutes, deadRemoteRoutes: $deadRemoteRoutes)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$VeilidUpdateRouteChange && + const DeepCollectionEquality() + .equals(other._deadRoutes, _deadRoutes) && + const DeepCollectionEquality() + .equals(other._deadRemoteRoutes, _deadRemoteRoutes)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(_deadRoutes), + const DeepCollectionEquality().hash(_deadRemoteRoutes)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$VeilidUpdateRouteChangeCopyWith<_$VeilidUpdateRouteChange> get copyWith => + __$$VeilidUpdateRouteChangeCopyWithImpl<_$VeilidUpdateRouteChange>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + VeilidLogLevel logLevel, String message, String? backtrace) + log, + required TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message) + appMessage, + required TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message, String callId) + appCall, + required TResult Function(AttachmentState state, bool publicInternetReady, + bool localNetworkReady) + attachment, + required TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, + List peers) + network, + required TResult Function(VeilidConfig config) config, + required TResult Function( + List deadRoutes, List deadRemoteRoutes) + routeChange, + required TResult Function(Typed key, + List subkeys, int count, ValueData valueData) + valueChange, + }) { + return routeChange(deadRoutes, deadRemoteRoutes); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + VeilidLogLevel logLevel, String message, String? backtrace)? + log, + TResult? Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message)? + appMessage, + TResult? Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message, String callId)? + appCall, + TResult? Function(AttachmentState state, bool publicInternetReady, + bool localNetworkReady)? + attachment, + TResult? Function(bool started, BigInt bpsDown, BigInt bpsUp, + List peers)? + network, + TResult? Function(VeilidConfig config)? config, + TResult? Function(List deadRoutes, List deadRemoteRoutes)? + routeChange, + TResult? Function(Typed key, + List subkeys, int count, ValueData valueData)? + valueChange, + }) { + return routeChange?.call(deadRoutes, deadRemoteRoutes); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + VeilidLogLevel logLevel, String message, String? backtrace)? + log, + TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message)? + appMessage, + TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message, String callId)? + appCall, + TResult Function(AttachmentState state, bool publicInternetReady, + bool localNetworkReady)? + attachment, + TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, + List peers)? + network, + TResult Function(VeilidConfig config)? config, + TResult Function(List deadRoutes, List deadRemoteRoutes)? + routeChange, + TResult Function(Typed key, + List subkeys, int count, ValueData valueData)? + valueChange, + required TResult orElse(), + }) { + if (routeChange != null) { + return routeChange(deadRoutes, deadRemoteRoutes); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(VeilidLog value) log, + required TResult Function(VeilidAppMessage value) appMessage, + required TResult Function(VeilidAppCall value) appCall, + required TResult Function(VeilidUpdateAttachment value) attachment, + required TResult Function(VeilidUpdateNetwork value) network, + required TResult Function(VeilidUpdateConfig value) config, + required TResult Function(VeilidUpdateRouteChange value) routeChange, + required TResult Function(VeilidUpdateValueChange value) valueChange, + }) { + return routeChange(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(VeilidLog value)? log, + TResult? Function(VeilidAppMessage value)? appMessage, + TResult? Function(VeilidAppCall value)? appCall, + TResult? Function(VeilidUpdateAttachment value)? attachment, + TResult? Function(VeilidUpdateNetwork value)? network, + TResult? Function(VeilidUpdateConfig value)? config, + TResult? Function(VeilidUpdateRouteChange value)? routeChange, + TResult? Function(VeilidUpdateValueChange value)? valueChange, + }) { + return routeChange?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(VeilidLog value)? log, + TResult Function(VeilidAppMessage value)? appMessage, + TResult Function(VeilidAppCall value)? appCall, + TResult Function(VeilidUpdateAttachment value)? attachment, + TResult Function(VeilidUpdateNetwork value)? network, + TResult Function(VeilidUpdateConfig value)? config, + TResult Function(VeilidUpdateRouteChange value)? routeChange, + TResult Function(VeilidUpdateValueChange value)? valueChange, + required TResult orElse(), + }) { + if (routeChange != null) { + return routeChange(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$VeilidUpdateRouteChangeToJson( + this, + ); + } +} + +abstract class VeilidUpdateRouteChange implements VeilidUpdate { + const factory VeilidUpdateRouteChange( + {required final List deadRoutes, + required final List deadRemoteRoutes}) = + _$VeilidUpdateRouteChange; + + factory VeilidUpdateRouteChange.fromJson(Map json) = + _$VeilidUpdateRouteChange.fromJson; + + List get deadRoutes; + List get deadRemoteRoutes; + @JsonKey(ignore: true) + _$$VeilidUpdateRouteChangeCopyWith<_$VeilidUpdateRouteChange> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$VeilidUpdateValueChangeCopyWith<$Res> { + factory _$$VeilidUpdateValueChangeCopyWith(_$VeilidUpdateValueChange value, + $Res Function(_$VeilidUpdateValueChange) then) = + __$$VeilidUpdateValueChangeCopyWithImpl<$Res>; + @useResult + $Res call( + {Typed key, + List subkeys, + int count, + ValueData valueData}); + + $ValueDataCopyWith<$Res> get valueData; +} + +/// @nodoc +class __$$VeilidUpdateValueChangeCopyWithImpl<$Res> + extends _$VeilidUpdateCopyWithImpl<$Res, _$VeilidUpdateValueChange> + implements _$$VeilidUpdateValueChangeCopyWith<$Res> { + __$$VeilidUpdateValueChangeCopyWithImpl(_$VeilidUpdateValueChange _value, + $Res Function(_$VeilidUpdateValueChange) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? key = null, + Object? subkeys = null, + Object? count = null, + Object? valueData = null, + }) { + return _then(_$VeilidUpdateValueChange( + key: null == key + ? _value.key + : key // ignore: cast_nullable_to_non_nullable + as Typed, + subkeys: null == subkeys + ? _value._subkeys + : subkeys // ignore: cast_nullable_to_non_nullable + as List, + count: null == count + ? _value.count + : count // ignore: cast_nullable_to_non_nullable + as int, + valueData: null == valueData + ? _value.valueData + : valueData // ignore: cast_nullable_to_non_nullable + as ValueData, + )); + } + + @override + @pragma('vm:prefer-inline') + $ValueDataCopyWith<$Res> get valueData { + return $ValueDataCopyWith<$Res>(_value.valueData, (value) { + return _then(_value.copyWith(valueData: value)); + }); + } +} + +/// @nodoc +@JsonSerializable() +class _$VeilidUpdateValueChange implements VeilidUpdateValueChange { + const _$VeilidUpdateValueChange( + {required this.key, + required final List subkeys, + required this.count, + required this.valueData, + final String? $type}) + : _subkeys = subkeys, + $type = $type ?? 'ValueChange'; + + factory _$VeilidUpdateValueChange.fromJson(Map json) => + _$$VeilidUpdateValueChangeFromJson(json); + + @override + final Typed key; + final List _subkeys; + @override + List get subkeys { + if (_subkeys is EqualUnmodifiableListView) return _subkeys; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_subkeys); + } + + @override + final int count; + @override + final ValueData valueData; + + @JsonKey(name: 'kind') + final String $type; + + @override + String toString() { + return 'VeilidUpdate.valueChange(key: $key, subkeys: $subkeys, count: $count, valueData: $valueData)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$VeilidUpdateValueChange && + (identical(other.key, key) || other.key == key) && + const DeepCollectionEquality().equals(other._subkeys, _subkeys) && + (identical(other.count, count) || other.count == count) && + (identical(other.valueData, valueData) || + other.valueData == valueData)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, key, + const DeepCollectionEquality().hash(_subkeys), count, valueData); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$VeilidUpdateValueChangeCopyWith<_$VeilidUpdateValueChange> get copyWith => + __$$VeilidUpdateValueChangeCopyWithImpl<_$VeilidUpdateValueChange>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + VeilidLogLevel logLevel, String message, String? backtrace) + log, + required TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message) + appMessage, + required TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message, String callId) + appCall, + required TResult Function(AttachmentState state, bool publicInternetReady, + bool localNetworkReady) + attachment, + required TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, + List peers) + network, + required TResult Function(VeilidConfig config) config, + required TResult Function( + List deadRoutes, List deadRemoteRoutes) + routeChange, + required TResult Function(Typed key, + List subkeys, int count, ValueData valueData) + valueChange, + }) { + return valueChange(key, subkeys, count, valueData); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + VeilidLogLevel logLevel, String message, String? backtrace)? + log, + TResult? Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message)? + appMessage, + TResult? Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message, String callId)? + appCall, + TResult? Function(AttachmentState state, bool publicInternetReady, + bool localNetworkReady)? + attachment, + TResult? Function(bool started, BigInt bpsDown, BigInt bpsUp, + List peers)? + network, + TResult? Function(VeilidConfig config)? config, + TResult? Function(List deadRoutes, List deadRemoteRoutes)? + routeChange, + TResult? Function(Typed key, + List subkeys, int count, ValueData valueData)? + valueChange, + }) { + return valueChange?.call(key, subkeys, count, valueData); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + VeilidLogLevel logLevel, String message, String? backtrace)? + log, + TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message)? + appMessage, + TResult Function(Typed? sender, + @Uint8ListJsonConverter() Uint8List message, String callId)? + appCall, + TResult Function(AttachmentState state, bool publicInternetReady, + bool localNetworkReady)? + attachment, + TResult Function(bool started, BigInt bpsDown, BigInt bpsUp, + List peers)? + network, + TResult Function(VeilidConfig config)? config, + TResult Function(List deadRoutes, List deadRemoteRoutes)? + routeChange, + TResult Function(Typed key, + List subkeys, int count, ValueData valueData)? + valueChange, + required TResult orElse(), + }) { + if (valueChange != null) { + return valueChange(key, subkeys, count, valueData); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(VeilidLog value) log, + required TResult Function(VeilidAppMessage value) appMessage, + required TResult Function(VeilidAppCall value) appCall, + required TResult Function(VeilidUpdateAttachment value) attachment, + required TResult Function(VeilidUpdateNetwork value) network, + required TResult Function(VeilidUpdateConfig value) config, + required TResult Function(VeilidUpdateRouteChange value) routeChange, + required TResult Function(VeilidUpdateValueChange value) valueChange, + }) { + return valueChange(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(VeilidLog value)? log, + TResult? Function(VeilidAppMessage value)? appMessage, + TResult? Function(VeilidAppCall value)? appCall, + TResult? Function(VeilidUpdateAttachment value)? attachment, + TResult? Function(VeilidUpdateNetwork value)? network, + TResult? Function(VeilidUpdateConfig value)? config, + TResult? Function(VeilidUpdateRouteChange value)? routeChange, + TResult? Function(VeilidUpdateValueChange value)? valueChange, + }) { + return valueChange?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(VeilidLog value)? log, + TResult Function(VeilidAppMessage value)? appMessage, + TResult Function(VeilidAppCall value)? appCall, + TResult Function(VeilidUpdateAttachment value)? attachment, + TResult Function(VeilidUpdateNetwork value)? network, + TResult Function(VeilidUpdateConfig value)? config, + TResult Function(VeilidUpdateRouteChange value)? routeChange, + TResult Function(VeilidUpdateValueChange value)? valueChange, + required TResult orElse(), + }) { + if (valueChange != null) { + return valueChange(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$VeilidUpdateValueChangeToJson( + this, + ); + } +} + +abstract class VeilidUpdateValueChange implements VeilidUpdate { + const factory VeilidUpdateValueChange( + {required final Typed key, + required final List subkeys, + required final int count, + required final ValueData valueData}) = _$VeilidUpdateValueChange; + + factory VeilidUpdateValueChange.fromJson(Map json) = + _$VeilidUpdateValueChange.fromJson; + + Typed get key; + List get subkeys; + int get count; + ValueData get valueData; + @JsonKey(ignore: true) + _$$VeilidUpdateValueChangeCopyWith<_$VeilidUpdateValueChange> get copyWith => + throw _privateConstructorUsedError; +} + +VeilidStateAttachment _$VeilidStateAttachmentFromJson( + Map json) { + return _VeilidStateAttachment.fromJson(json); +} + +/// @nodoc +mixin _$VeilidStateAttachment { + AttachmentState get state => throw _privateConstructorUsedError; + bool get publicInternetReady => throw _privateConstructorUsedError; + bool get localNetworkReady => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $VeilidStateAttachmentCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VeilidStateAttachmentCopyWith<$Res> { + factory $VeilidStateAttachmentCopyWith(VeilidStateAttachment value, + $Res Function(VeilidStateAttachment) then) = + _$VeilidStateAttachmentCopyWithImpl<$Res, VeilidStateAttachment>; + @useResult + $Res call( + {AttachmentState state, + bool publicInternetReady, + bool localNetworkReady}); +} + +/// @nodoc +class _$VeilidStateAttachmentCopyWithImpl<$Res, + $Val extends VeilidStateAttachment> + implements $VeilidStateAttachmentCopyWith<$Res> { + _$VeilidStateAttachmentCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? state = null, + Object? publicInternetReady = null, + Object? localNetworkReady = null, + }) { + return _then(_value.copyWith( + state: null == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as AttachmentState, + publicInternetReady: null == publicInternetReady + ? _value.publicInternetReady + : publicInternetReady // ignore: cast_nullable_to_non_nullable + as bool, + localNetworkReady: null == localNetworkReady + ? _value.localNetworkReady + : localNetworkReady // ignore: cast_nullable_to_non_nullable + as bool, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_VeilidStateAttachmentCopyWith<$Res> + implements $VeilidStateAttachmentCopyWith<$Res> { + factory _$$_VeilidStateAttachmentCopyWith(_$_VeilidStateAttachment value, + $Res Function(_$_VeilidStateAttachment) then) = + __$$_VeilidStateAttachmentCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {AttachmentState state, + bool publicInternetReady, + bool localNetworkReady}); +} + +/// @nodoc +class __$$_VeilidStateAttachmentCopyWithImpl<$Res> + extends _$VeilidStateAttachmentCopyWithImpl<$Res, _$_VeilidStateAttachment> + implements _$$_VeilidStateAttachmentCopyWith<$Res> { + __$$_VeilidStateAttachmentCopyWithImpl(_$_VeilidStateAttachment _value, + $Res Function(_$_VeilidStateAttachment) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? state = null, + Object? publicInternetReady = null, + Object? localNetworkReady = null, + }) { + return _then(_$_VeilidStateAttachment( + state: null == state + ? _value.state + : state // ignore: cast_nullable_to_non_nullable + as AttachmentState, + publicInternetReady: null == publicInternetReady + ? _value.publicInternetReady + : publicInternetReady // ignore: cast_nullable_to_non_nullable + as bool, + localNetworkReady: null == localNetworkReady + ? _value.localNetworkReady + : localNetworkReady // ignore: cast_nullable_to_non_nullable + as bool, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_VeilidStateAttachment implements _VeilidStateAttachment { + const _$_VeilidStateAttachment( + {required this.state, + required this.publicInternetReady, + required this.localNetworkReady}); + + factory _$_VeilidStateAttachment.fromJson(Map json) => + _$$_VeilidStateAttachmentFromJson(json); + + @override + final AttachmentState state; + @override + final bool publicInternetReady; + @override + final bool localNetworkReady; + + @override + String toString() { + return 'VeilidStateAttachment(state: $state, publicInternetReady: $publicInternetReady, localNetworkReady: $localNetworkReady)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_VeilidStateAttachment && + (identical(other.state, state) || other.state == state) && + (identical(other.publicInternetReady, publicInternetReady) || + other.publicInternetReady == publicInternetReady) && + (identical(other.localNetworkReady, localNetworkReady) || + other.localNetworkReady == localNetworkReady)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => + Object.hash(runtimeType, state, publicInternetReady, localNetworkReady); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_VeilidStateAttachmentCopyWith<_$_VeilidStateAttachment> get copyWith => + __$$_VeilidStateAttachmentCopyWithImpl<_$_VeilidStateAttachment>( + this, _$identity); + + @override + Map toJson() { + return _$$_VeilidStateAttachmentToJson( + this, + ); + } +} + +abstract class _VeilidStateAttachment implements VeilidStateAttachment { + const factory _VeilidStateAttachment( + {required final AttachmentState state, + required final bool publicInternetReady, + required final bool localNetworkReady}) = _$_VeilidStateAttachment; + + factory _VeilidStateAttachment.fromJson(Map json) = + _$_VeilidStateAttachment.fromJson; + + @override + AttachmentState get state; + @override + bool get publicInternetReady; + @override + bool get localNetworkReady; + @override + @JsonKey(ignore: true) + _$$_VeilidStateAttachmentCopyWith<_$_VeilidStateAttachment> get copyWith => + throw _privateConstructorUsedError; +} + +VeilidStateNetwork _$VeilidStateNetworkFromJson(Map json) { + return _VeilidStateNetwork.fromJson(json); +} + +/// @nodoc +mixin _$VeilidStateNetwork { + bool get started => throw _privateConstructorUsedError; + BigInt get bpsDown => throw _privateConstructorUsedError; + BigInt get bpsUp => throw _privateConstructorUsedError; + List get peers => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $VeilidStateNetworkCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VeilidStateNetworkCopyWith<$Res> { + factory $VeilidStateNetworkCopyWith( + VeilidStateNetwork value, $Res Function(VeilidStateNetwork) then) = + _$VeilidStateNetworkCopyWithImpl<$Res, VeilidStateNetwork>; + @useResult + $Res call( + {bool started, BigInt bpsDown, BigInt bpsUp, List peers}); +} + +/// @nodoc +class _$VeilidStateNetworkCopyWithImpl<$Res, $Val extends VeilidStateNetwork> + implements $VeilidStateNetworkCopyWith<$Res> { + _$VeilidStateNetworkCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? started = null, + Object? bpsDown = null, + Object? bpsUp = null, + Object? peers = null, + }) { + return _then(_value.copyWith( + started: null == started + ? _value.started + : started // ignore: cast_nullable_to_non_nullable + as bool, + bpsDown: null == bpsDown + ? _value.bpsDown + : bpsDown // ignore: cast_nullable_to_non_nullable + as BigInt, + bpsUp: null == bpsUp + ? _value.bpsUp + : bpsUp // ignore: cast_nullable_to_non_nullable + as BigInt, + peers: null == peers + ? _value.peers + : peers // ignore: cast_nullable_to_non_nullable + as List, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_VeilidStateNetworkCopyWith<$Res> + implements $VeilidStateNetworkCopyWith<$Res> { + factory _$$_VeilidStateNetworkCopyWith(_$_VeilidStateNetwork value, + $Res Function(_$_VeilidStateNetwork) then) = + __$$_VeilidStateNetworkCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {bool started, BigInt bpsDown, BigInt bpsUp, List peers}); +} + +/// @nodoc +class __$$_VeilidStateNetworkCopyWithImpl<$Res> + extends _$VeilidStateNetworkCopyWithImpl<$Res, _$_VeilidStateNetwork> + implements _$$_VeilidStateNetworkCopyWith<$Res> { + __$$_VeilidStateNetworkCopyWithImpl( + _$_VeilidStateNetwork _value, $Res Function(_$_VeilidStateNetwork) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? started = null, + Object? bpsDown = null, + Object? bpsUp = null, + Object? peers = null, + }) { + return _then(_$_VeilidStateNetwork( + started: null == started + ? _value.started + : started // ignore: cast_nullable_to_non_nullable + as bool, + bpsDown: null == bpsDown + ? _value.bpsDown + : bpsDown // ignore: cast_nullable_to_non_nullable + as BigInt, + bpsUp: null == bpsUp + ? _value.bpsUp + : bpsUp // ignore: cast_nullable_to_non_nullable + as BigInt, + peers: null == peers + ? _value._peers + : peers // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_VeilidStateNetwork implements _VeilidStateNetwork { + const _$_VeilidStateNetwork( + {required this.started, + required this.bpsDown, + required this.bpsUp, + required final List peers}) + : _peers = peers; + + factory _$_VeilidStateNetwork.fromJson(Map json) => + _$$_VeilidStateNetworkFromJson(json); + + @override + final bool started; + @override + final BigInt bpsDown; + @override + final BigInt bpsUp; + final List _peers; + @override + List get peers { + if (_peers is EqualUnmodifiableListView) return _peers; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_peers); + } + + @override + String toString() { + return 'VeilidStateNetwork(started: $started, bpsDown: $bpsDown, bpsUp: $bpsUp, peers: $peers)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_VeilidStateNetwork && + (identical(other.started, started) || other.started == started) && + (identical(other.bpsDown, bpsDown) || other.bpsDown == bpsDown) && + (identical(other.bpsUp, bpsUp) || other.bpsUp == bpsUp) && + const DeepCollectionEquality().equals(other._peers, _peers)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, started, bpsDown, bpsUp, + const DeepCollectionEquality().hash(_peers)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_VeilidStateNetworkCopyWith<_$_VeilidStateNetwork> get copyWith => + __$$_VeilidStateNetworkCopyWithImpl<_$_VeilidStateNetwork>( + this, _$identity); + + @override + Map toJson() { + return _$$_VeilidStateNetworkToJson( + this, + ); + } +} + +abstract class _VeilidStateNetwork implements VeilidStateNetwork { + const factory _VeilidStateNetwork( + {required final bool started, + required final BigInt bpsDown, + required final BigInt bpsUp, + required final List peers}) = _$_VeilidStateNetwork; + + factory _VeilidStateNetwork.fromJson(Map json) = + _$_VeilidStateNetwork.fromJson; + + @override + bool get started; + @override + BigInt get bpsDown; + @override + BigInt get bpsUp; + @override + List get peers; + @override + @JsonKey(ignore: true) + _$$_VeilidStateNetworkCopyWith<_$_VeilidStateNetwork> get copyWith => + throw _privateConstructorUsedError; +} + +VeilidStateConfig _$VeilidStateConfigFromJson(Map json) { + return _VeilidStateConfig.fromJson(json); +} + +/// @nodoc +mixin _$VeilidStateConfig { + VeilidConfig get config => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $VeilidStateConfigCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VeilidStateConfigCopyWith<$Res> { + factory $VeilidStateConfigCopyWith( + VeilidStateConfig value, $Res Function(VeilidStateConfig) then) = + _$VeilidStateConfigCopyWithImpl<$Res, VeilidStateConfig>; + @useResult + $Res call({VeilidConfig config}); + + $VeilidConfigCopyWith<$Res> get config; +} + +/// @nodoc +class _$VeilidStateConfigCopyWithImpl<$Res, $Val extends VeilidStateConfig> + implements $VeilidStateConfigCopyWith<$Res> { + _$VeilidStateConfigCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? config = null, + }) { + return _then(_value.copyWith( + config: null == config + ? _value.config + : config // ignore: cast_nullable_to_non_nullable + as VeilidConfig, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $VeilidConfigCopyWith<$Res> get config { + return $VeilidConfigCopyWith<$Res>(_value.config, (value) { + return _then(_value.copyWith(config: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$_VeilidStateConfigCopyWith<$Res> + implements $VeilidStateConfigCopyWith<$Res> { + factory _$$_VeilidStateConfigCopyWith(_$_VeilidStateConfig value, + $Res Function(_$_VeilidStateConfig) then) = + __$$_VeilidStateConfigCopyWithImpl<$Res>; + @override + @useResult + $Res call({VeilidConfig config}); + + @override + $VeilidConfigCopyWith<$Res> get config; +} + +/// @nodoc +class __$$_VeilidStateConfigCopyWithImpl<$Res> + extends _$VeilidStateConfigCopyWithImpl<$Res, _$_VeilidStateConfig> + implements _$$_VeilidStateConfigCopyWith<$Res> { + __$$_VeilidStateConfigCopyWithImpl( + _$_VeilidStateConfig _value, $Res Function(_$_VeilidStateConfig) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? config = null, + }) { + return _then(_$_VeilidStateConfig( + config: null == config + ? _value.config + : config // ignore: cast_nullable_to_non_nullable + as VeilidConfig, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_VeilidStateConfig implements _VeilidStateConfig { + const _$_VeilidStateConfig({required this.config}); + + factory _$_VeilidStateConfig.fromJson(Map json) => + _$$_VeilidStateConfigFromJson(json); + + @override + final VeilidConfig config; + + @override + String toString() { + return 'VeilidStateConfig(config: $config)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_VeilidStateConfig && + (identical(other.config, config) || other.config == config)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, config); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_VeilidStateConfigCopyWith<_$_VeilidStateConfig> get copyWith => + __$$_VeilidStateConfigCopyWithImpl<_$_VeilidStateConfig>( + this, _$identity); + + @override + Map toJson() { + return _$$_VeilidStateConfigToJson( + this, + ); + } +} + +abstract class _VeilidStateConfig implements VeilidStateConfig { + const factory _VeilidStateConfig({required final VeilidConfig config}) = + _$_VeilidStateConfig; + + factory _VeilidStateConfig.fromJson(Map json) = + _$_VeilidStateConfig.fromJson; + + @override + VeilidConfig get config; + @override + @JsonKey(ignore: true) + _$$_VeilidStateConfigCopyWith<_$_VeilidStateConfig> get copyWith => + throw _privateConstructorUsedError; +} + +VeilidState _$VeilidStateFromJson(Map json) { + return _VeilidState.fromJson(json); +} + +/// @nodoc +mixin _$VeilidState { + VeilidStateAttachment get attachment => throw _privateConstructorUsedError; + VeilidStateNetwork get network => throw _privateConstructorUsedError; + VeilidStateConfig get config => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $VeilidStateCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VeilidStateCopyWith<$Res> { + factory $VeilidStateCopyWith( + VeilidState value, $Res Function(VeilidState) then) = + _$VeilidStateCopyWithImpl<$Res, VeilidState>; + @useResult + $Res call( + {VeilidStateAttachment attachment, + VeilidStateNetwork network, + VeilidStateConfig config}); + + $VeilidStateAttachmentCopyWith<$Res> get attachment; + $VeilidStateNetworkCopyWith<$Res> get network; + $VeilidStateConfigCopyWith<$Res> get config; +} + +/// @nodoc +class _$VeilidStateCopyWithImpl<$Res, $Val extends VeilidState> + implements $VeilidStateCopyWith<$Res> { + _$VeilidStateCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? attachment = null, + Object? network = null, + Object? config = null, + }) { + return _then(_value.copyWith( + attachment: null == attachment + ? _value.attachment + : attachment // ignore: cast_nullable_to_non_nullable + as VeilidStateAttachment, + network: null == network + ? _value.network + : network // ignore: cast_nullable_to_non_nullable + as VeilidStateNetwork, + config: null == config + ? _value.config + : config // ignore: cast_nullable_to_non_nullable + as VeilidStateConfig, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $VeilidStateAttachmentCopyWith<$Res> get attachment { + return $VeilidStateAttachmentCopyWith<$Res>(_value.attachment, (value) { + return _then(_value.copyWith(attachment: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $VeilidStateNetworkCopyWith<$Res> get network { + return $VeilidStateNetworkCopyWith<$Res>(_value.network, (value) { + return _then(_value.copyWith(network: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $VeilidStateConfigCopyWith<$Res> get config { + return $VeilidStateConfigCopyWith<$Res>(_value.config, (value) { + return _then(_value.copyWith(config: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$_VeilidStateCopyWith<$Res> + implements $VeilidStateCopyWith<$Res> { + factory _$$_VeilidStateCopyWith( + _$_VeilidState value, $Res Function(_$_VeilidState) then) = + __$$_VeilidStateCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {VeilidStateAttachment attachment, + VeilidStateNetwork network, + VeilidStateConfig config}); + + @override + $VeilidStateAttachmentCopyWith<$Res> get attachment; + @override + $VeilidStateNetworkCopyWith<$Res> get network; + @override + $VeilidStateConfigCopyWith<$Res> get config; +} + +/// @nodoc +class __$$_VeilidStateCopyWithImpl<$Res> + extends _$VeilidStateCopyWithImpl<$Res, _$_VeilidState> + implements _$$_VeilidStateCopyWith<$Res> { + __$$_VeilidStateCopyWithImpl( + _$_VeilidState _value, $Res Function(_$_VeilidState) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? attachment = null, + Object? network = null, + Object? config = null, + }) { + return _then(_$_VeilidState( + attachment: null == attachment + ? _value.attachment + : attachment // ignore: cast_nullable_to_non_nullable + as VeilidStateAttachment, + network: null == network + ? _value.network + : network // ignore: cast_nullable_to_non_nullable + as VeilidStateNetwork, + config: null == config + ? _value.config + : config // ignore: cast_nullable_to_non_nullable + as VeilidStateConfig, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_VeilidState implements _VeilidState { + const _$_VeilidState( + {required this.attachment, required this.network, required this.config}); + + factory _$_VeilidState.fromJson(Map json) => + _$$_VeilidStateFromJson(json); + + @override + final VeilidStateAttachment attachment; + @override + final VeilidStateNetwork network; + @override + final VeilidStateConfig config; + + @override + String toString() { + return 'VeilidState(attachment: $attachment, network: $network, config: $config)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_VeilidState && + (identical(other.attachment, attachment) || + other.attachment == attachment) && + (identical(other.network, network) || other.network == network) && + (identical(other.config, config) || other.config == config)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, attachment, network, config); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_VeilidStateCopyWith<_$_VeilidState> get copyWith => + __$$_VeilidStateCopyWithImpl<_$_VeilidState>(this, _$identity); + + @override + Map toJson() { + return _$$_VeilidStateToJson( + this, + ); + } +} + +abstract class _VeilidState implements VeilidState { + const factory _VeilidState( + {required final VeilidStateAttachment attachment, + required final VeilidStateNetwork network, + required final VeilidStateConfig config}) = _$_VeilidState; + + factory _VeilidState.fromJson(Map json) = + _$_VeilidState.fromJson; + + @override + VeilidStateAttachment get attachment; + @override + VeilidStateNetwork get network; + @override + VeilidStateConfig get config; + @override + @JsonKey(ignore: true) + _$$_VeilidStateCopyWith<_$_VeilidState> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/veilid-flutter/lib/veilid_state.g.dart b/veilid-flutter/lib/veilid_state.g.dart new file mode 100644 index 00000000..9acc648d --- /dev/null +++ b/veilid-flutter/lib/veilid_state.g.dart @@ -0,0 +1,324 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'veilid_state.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$_LatencyStats _$$_LatencyStatsFromJson(Map json) => + _$_LatencyStats( + fastest: TimestampDuration.fromJson(json['fastest']), + average: TimestampDuration.fromJson(json['average']), + slowest: TimestampDuration.fromJson(json['slowest']), + ); + +Map _$$_LatencyStatsToJson(_$_LatencyStats instance) => + { + 'fastest': instance.fastest.toJson(), + 'average': instance.average.toJson(), + 'slowest': instance.slowest.toJson(), + }; + +_$_TransferStats _$$_TransferStatsFromJson(Map json) => + _$_TransferStats( + total: BigInt.parse(json['total'] as String), + maximum: BigInt.parse(json['maximum'] as String), + average: BigInt.parse(json['average'] as String), + minimum: BigInt.parse(json['minimum'] as String), + ); + +Map _$$_TransferStatsToJson(_$_TransferStats instance) => + { + 'total': instance.total.toString(), + 'maximum': instance.maximum.toString(), + 'average': instance.average.toString(), + 'minimum': instance.minimum.toString(), + }; + +_$_TransferStatsDownUp _$$_TransferStatsDownUpFromJson( + Map json) => + _$_TransferStatsDownUp( + down: TransferStats.fromJson(json['down'] as Map), + up: TransferStats.fromJson(json['up'] as Map), + ); + +Map _$$_TransferStatsDownUpToJson( + _$_TransferStatsDownUp instance) => + { + 'down': instance.down.toJson(), + 'up': instance.up.toJson(), + }; + +_$_RPCStats _$$_RPCStatsFromJson(Map json) => _$_RPCStats( + messagesSent: json['messages_sent'] as int, + messagesRcvd: json['messages_rcvd'] as int, + questionsInFlight: json['questions_in_flight'] as int, + lastQuestion: json['last_question'] == null + ? null + : Timestamp.fromJson(json['last_question']), + lastSeenTs: json['last_seen_ts'] == null + ? null + : Timestamp.fromJson(json['last_seen_ts']), + firstConsecutiveSeenTs: json['first_consecutive_seen_ts'] == null + ? null + : Timestamp.fromJson(json['first_consecutive_seen_ts']), + recentLostAnswers: json['recent_lost_answers'] as int, + failedToSend: json['failed_to_send'] as int, + ); + +Map _$$_RPCStatsToJson(_$_RPCStats instance) => + { + 'messages_sent': instance.messagesSent, + 'messages_rcvd': instance.messagesRcvd, + 'questions_in_flight': instance.questionsInFlight, + 'last_question': instance.lastQuestion?.toJson(), + 'last_seen_ts': instance.lastSeenTs?.toJson(), + 'first_consecutive_seen_ts': instance.firstConsecutiveSeenTs?.toJson(), + 'recent_lost_answers': instance.recentLostAnswers, + 'failed_to_send': instance.failedToSend, + }; + +_$_PeerStats _$$_PeerStatsFromJson(Map json) => _$_PeerStats( + timeAdded: Timestamp.fromJson(json['time_added']), + rpcStats: RPCStats.fromJson(json['rpc_stats'] as Map), + latency: json['latency'] == null + ? null + : LatencyStats.fromJson(json['latency'] as Map), + transfer: TransferStatsDownUp.fromJson( + json['transfer'] as Map), + ); + +Map _$$_PeerStatsToJson(_$_PeerStats instance) => + { + 'time_added': instance.timeAdded.toJson(), + 'rpc_stats': instance.rpcStats.toJson(), + 'latency': instance.latency?.toJson(), + 'transfer': instance.transfer.toJson(), + }; + +_$_PeerTableData _$$_PeerTableDataFromJson(Map json) => + _$_PeerTableData( + nodeIds: (json['node_ids'] as List) + .map(Typed.fromJson) + .toList(), + peerAddress: json['peer_address'] as String, + peerStats: PeerStats.fromJson(json['peer_stats'] as Map), + ); + +Map _$$_PeerTableDataToJson(_$_PeerTableData instance) => + { + 'node_ids': instance.nodeIds.map((e) => e.toJson()).toList(), + 'peer_address': instance.peerAddress, + 'peer_stats': instance.peerStats.toJson(), + }; + +_$VeilidLog _$$VeilidLogFromJson(Map json) => _$VeilidLog( + logLevel: VeilidLogLevel.fromJson(json['log_level'] as String), + message: json['message'] as String, + backtrace: json['backtrace'] as String?, + $type: json['kind'] as String?, + ); + +Map _$$VeilidLogToJson(_$VeilidLog instance) => + { + 'log_level': instance.logLevel.toJson(), + 'message': instance.message, + 'backtrace': instance.backtrace, + 'kind': instance.$type, + }; + +_$VeilidAppMessage _$$VeilidAppMessageFromJson(Map json) => + _$VeilidAppMessage( + sender: json['sender'] == null + ? null + : Typed.fromJson(json['sender']), + message: + const Uint8ListJsonConverter().fromJson(json['message'] as String), + $type: json['kind'] as String?, + ); + +Map _$$VeilidAppMessageToJson(_$VeilidAppMessage instance) => + { + 'sender': instance.sender?.toJson(), + 'message': const Uint8ListJsonConverter().toJson(instance.message), + 'kind': instance.$type, + }; + +_$VeilidAppCall _$$VeilidAppCallFromJson(Map json) => + _$VeilidAppCall( + sender: json['sender'] == null + ? null + : Typed.fromJson(json['sender']), + message: + const Uint8ListJsonConverter().fromJson(json['message'] as String), + callId: json['call_id'] as String, + $type: json['kind'] as String?, + ); + +Map _$$VeilidAppCallToJson(_$VeilidAppCall instance) => + { + 'sender': instance.sender?.toJson(), + 'message': const Uint8ListJsonConverter().toJson(instance.message), + 'call_id': instance.callId, + 'kind': instance.$type, + }; + +_$VeilidUpdateAttachment _$$VeilidUpdateAttachmentFromJson( + Map json) => + _$VeilidUpdateAttachment( + state: AttachmentState.fromJson(json['state'] as String), + publicInternetReady: json['public_internet_ready'] as bool, + localNetworkReady: json['local_network_ready'] as bool, + $type: json['kind'] as String?, + ); + +Map _$$VeilidUpdateAttachmentToJson( + _$VeilidUpdateAttachment instance) => + { + 'state': instance.state.toJson(), + 'public_internet_ready': instance.publicInternetReady, + 'local_network_ready': instance.localNetworkReady, + 'kind': instance.$type, + }; + +_$VeilidUpdateNetwork _$$VeilidUpdateNetworkFromJson( + Map json) => + _$VeilidUpdateNetwork( + started: json['started'] as bool, + bpsDown: BigInt.parse(json['bps_down'] as String), + bpsUp: BigInt.parse(json['bps_up'] as String), + peers: (json['peers'] as List) + .map((e) => PeerTableData.fromJson(e as Map)) + .toList(), + $type: json['kind'] as String?, + ); + +Map _$$VeilidUpdateNetworkToJson( + _$VeilidUpdateNetwork instance) => + { + 'started': instance.started, + 'bps_down': instance.bpsDown.toString(), + 'bps_up': instance.bpsUp.toString(), + 'peers': instance.peers.map((e) => e.toJson()).toList(), + 'kind': instance.$type, + }; + +_$VeilidUpdateConfig _$$VeilidUpdateConfigFromJson(Map json) => + _$VeilidUpdateConfig( + config: VeilidConfig.fromJson(json['config'] as Map), + $type: json['kind'] as String?, + ); + +Map _$$VeilidUpdateConfigToJson( + _$VeilidUpdateConfig instance) => + { + 'config': instance.config.toJson(), + 'kind': instance.$type, + }; + +_$VeilidUpdateRouteChange _$$VeilidUpdateRouteChangeFromJson( + Map json) => + _$VeilidUpdateRouteChange( + deadRoutes: (json['dead_routes'] as List) + .map((e) => e as String) + .toList(), + deadRemoteRoutes: (json['dead_remote_routes'] as List) + .map((e) => e as String) + .toList(), + $type: json['kind'] as String?, + ); + +Map _$$VeilidUpdateRouteChangeToJson( + _$VeilidUpdateRouteChange instance) => + { + 'dead_routes': instance.deadRoutes, + 'dead_remote_routes': instance.deadRemoteRoutes, + 'kind': instance.$type, + }; + +_$VeilidUpdateValueChange _$$VeilidUpdateValueChangeFromJson( + Map json) => + _$VeilidUpdateValueChange( + key: Typed.fromJson(json['key']), + subkeys: (json['subkeys'] as List) + .map((e) => ValueSubkeyRange.fromJson(e as Map)) + .toList(), + count: json['count'] as int, + valueData: ValueData.fromJson(json['value_data'] as Map), + $type: json['kind'] as String?, + ); + +Map _$$VeilidUpdateValueChangeToJson( + _$VeilidUpdateValueChange instance) => + { + 'key': instance.key.toJson(), + 'subkeys': instance.subkeys.map((e) => e.toJson()).toList(), + 'count': instance.count, + 'value_data': instance.valueData.toJson(), + 'kind': instance.$type, + }; + +_$_VeilidStateAttachment _$$_VeilidStateAttachmentFromJson( + Map json) => + _$_VeilidStateAttachment( + state: AttachmentState.fromJson(json['state'] as String), + publicInternetReady: json['public_internet_ready'] as bool, + localNetworkReady: json['local_network_ready'] as bool, + ); + +Map _$$_VeilidStateAttachmentToJson( + _$_VeilidStateAttachment instance) => + { + 'state': instance.state.toJson(), + 'public_internet_ready': instance.publicInternetReady, + 'local_network_ready': instance.localNetworkReady, + }; + +_$_VeilidStateNetwork _$$_VeilidStateNetworkFromJson( + Map json) => + _$_VeilidStateNetwork( + started: json['started'] as bool, + bpsDown: BigInt.parse(json['bps_down'] as String), + bpsUp: BigInt.parse(json['bps_up'] as String), + peers: (json['peers'] as List) + .map((e) => PeerTableData.fromJson(e as Map)) + .toList(), + ); + +Map _$$_VeilidStateNetworkToJson( + _$_VeilidStateNetwork instance) => + { + 'started': instance.started, + 'bps_down': instance.bpsDown.toString(), + 'bps_up': instance.bpsUp.toString(), + 'peers': instance.peers.map((e) => e.toJson()).toList(), + }; + +_$_VeilidStateConfig _$$_VeilidStateConfigFromJson(Map json) => + _$_VeilidStateConfig( + config: VeilidConfig.fromJson(json['config'] as Map), + ); + +Map _$$_VeilidStateConfigToJson( + _$_VeilidStateConfig instance) => + { + 'config': instance.config.toJson(), + }; + +_$_VeilidState _$$_VeilidStateFromJson(Map json) => + _$_VeilidState( + attachment: VeilidStateAttachment.fromJson( + json['attachment'] as Map), + network: + VeilidStateNetwork.fromJson(json['network'] as Map), + config: + VeilidStateConfig.fromJson(json['config'] as Map), + ); + +Map _$$_VeilidStateToJson(_$_VeilidState instance) => + { + 'attachment': instance.attachment.toJson(), + 'network': instance.network.toJson(), + 'config': instance.config.toJson(), + }; diff --git a/veilid-flutter/pubspec.yaml b/veilid-flutter/pubspec.yaml index 04dbdad0..a7611f81 100644 --- a/veilid-flutter/pubspec.yaml +++ b/veilid-flutter/pubspec.yaml @@ -1,6 +1,6 @@ name: veilid description: Veilid Network -version: 0.0.1 +version: 0.1.1 homepage: https://veilid.com publish_to: "none" # Remove this line if you wish to publish to pub.dev @@ -18,11 +18,17 @@ dependencies: path: ^1.8.0 system_info2: ^3.0.2 charcode: ^1.3.1 + freezed_annotation: ^2.2.0 + json_annotation: ^4.8.1 + equatable: ^2.0.5 dev_dependencies: flutter_test: sdk: flutter flutter_lints: ^2.0.1 + build_runner: ^2.4.6 + freezed: ^2.3.5 + json_serializable: ^6.7.1 # The following section is specific to Flutter. flutter: diff --git a/veilid-flutter/rust/Cargo.toml b/veilid-flutter/rust/Cargo.toml index 002db7da..3c4acd8c 100644 --- a/veilid-flutter/rust/Cargo.toml +++ b/veilid-flutter/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "veilid-flutter" -version = "0.1.0" +version = "0.1.1" edition = "2021" [lib] diff --git a/veilid-flutter/rust/src/dart_ffi.rs b/veilid-flutter/rust/src/dart_ffi.rs index 79419af3..b7c6111f 100644 --- a/veilid-flutter/rust/src/dart_ffi.rs +++ b/veilid-flutter/rust/src/dart_ffi.rs @@ -119,7 +119,7 @@ pub struct VeilidFFIConfig { #[derive(Debug, Deserialize, Serialize)] pub struct VeilidFFIRouteBlob { pub route_id: veilid_core::RouteId, - #[serde(with = "veilid_core::json_as_base64")] + #[serde(with = "veilid_core::as_human_base64")] pub blob: Vec, } @@ -492,8 +492,12 @@ pub extern "C" fn routing_context_app_message(port: i64, id: u32, target: FfiStr } #[no_mangle] -pub extern "C" fn routing_context_create_dht_record(port: i64, id: u32, kind: u32, schema: FfiStr) { - let crypto_kind: veilid_core::CryptoKind = veilid_core::FourCC::from(kind); +pub extern "C" fn routing_context_create_dht_record(port: i64, id: u32, schema: FfiStr, kind: u32) { + let crypto_kind = if kind == 0 { + None + } else { + Some(veilid_core::FourCC::from(kind)) + }; let schema: veilid_core::DHTSchema = veilid_core::deserialize_opt_json(schema.into_opt_string()).unwrap(); DartIsolateWrapper::new(port).spawn_result_json(async move { @@ -505,7 +509,7 @@ pub extern "C" fn routing_context_create_dht_record(port: i64, id: u32, kind: u3 routing_context.clone() }; - let dht_record_descriptor = routing_context.create_dht_record(crypto_kind, schema).await?; + let dht_record_descriptor = routing_context.create_dht_record(schema, crypto_kind).await?; APIResult::Ok(dht_record_descriptor) }); } diff --git a/veilid-python/pyproject.toml b/veilid-python/pyproject.toml index 7b59ddd4..8f193362 100644 --- a/veilid-python/pyproject.toml +++ b/veilid-python/pyproject.toml @@ -1,8 +1,8 @@ [tool.poetry] -name = "veilid-python" -version = "0.1.0" +name = "veilid" +version = "0.1.1" description = "" -authors = ["Christien Rioux "] +authors = ["Veilid Team "] readme = "README.md" packages = [{include = "veilid"}] diff --git a/veilid-python/tests/test_dht.py b/veilid-python/tests/test_dht.py index 79dc9bd1..8faae302 100644 --- a/veilid-python/tests/test_dht.py +++ b/veilid-python/tests/test_dht.py @@ -42,7 +42,7 @@ async def test_delete_dht_record_nonexistent(api_connection: veilid.VeilidAPI): async def test_create_delete_dht_record_simple(api_connection: veilid.VeilidAPI): rc = await api_connection.new_routing_context() async with rc: - rec = await rc.create_dht_record(veilid.CryptoKind.CRYPTO_KIND_VLD0, veilid.DHTSchema.dflt(1)) + rec = await rc.create_dht_record(veilid.DHTSchema.dflt(1), veilid.CryptoKind.CRYPTO_KIND_VLD0) await rc.close_dht_record(rec.key) await rc.delete_dht_record(rec.key) @@ -50,7 +50,7 @@ async def test_create_delete_dht_record_simple(api_connection: veilid.VeilidAPI) async def test_get_dht_value_nonexistent(api_connection: veilid.VeilidAPI): rc = await api_connection.new_routing_context() async with rc: - rec = await rc.create_dht_record(veilid.CryptoKind.CRYPTO_KIND_VLD0, veilid.DHTSchema.dflt(1)) + rec = await rc.create_dht_record(veilid.DHTSchema.dflt(1)) assert await rc.get_dht_value(rec.key, 0, False) == None await rc.close_dht_record(rec.key) await rc.delete_dht_record(rec.key) @@ -59,7 +59,7 @@ async def test_get_dht_value_nonexistent(api_connection: veilid.VeilidAPI): async def test_set_get_dht_value(api_connection: veilid.VeilidAPI): rc = await api_connection.new_routing_context() async with rc: - rec = await rc.create_dht_record(veilid.CryptoKind.CRYPTO_KIND_VLD0, veilid.DHTSchema.dflt(2)) + rec = await rc.create_dht_record(veilid.DHTSchema.dflt(2)) vd = await rc.set_dht_value(rec.key, 0, b"BLAH BLAH BLAH") assert vd != None @@ -87,13 +87,13 @@ async def test_set_get_dht_value(api_connection: veilid.VeilidAPI): async def test_open_writer_dht_value(api_connection: veilid.VeilidAPI): rc = await api_connection.new_routing_context() async with rc: - rec = await rc.create_dht_record(veilid.CryptoKind.CRYPTO_KIND_VLD0, veilid.DHTSchema.dflt(2)) + rec = await rc.create_dht_record(veilid.DHTSchema.dflt(2)) key = rec.key owner = rec.owner secret = rec.owner_secret print(f"key:{key}") - cs = await api_connection.get_crypto_system(veilid.CryptoKind.CRYPTO_KIND_VLD0) + cs = await api_connection.get_crypto_system(rec.key.kind()) async with cs: assert await cs.validate_key_pair(owner, secret) other_keypair = await cs.generate_key_pair() diff --git a/veilid-python/veilid/api.py b/veilid-python/veilid/api.py index 4a17804f..b8d824cf 100644 --- a/veilid-python/veilid/api.py +++ b/veilid-python/veilid/api.py @@ -46,7 +46,7 @@ class RoutingContext(ABC): @abstractmethod async def create_dht_record( - self, kind: types.CryptoKind, schema: types.DHTSchema + self, schema: types.DHTSchema, kind: Optional[types.CryptoKind] = None ) -> types.DHTRecordDescriptor: pass diff --git a/veilid-python/veilid/json_api.py b/veilid-python/veilid/json_api.py index 8138cf57..6b1dd72f 100644 --- a/veilid-python/veilid/json_api.py +++ b/veilid-python/veilid/json_api.py @@ -514,7 +514,7 @@ class _JsonRoutingContext(RoutingContext): ) async def create_dht_record( - self, kind: CryptoKind, schema: DHTSchema + self, schema: DHTSchema, kind: Optional[CryptoKind] = None ) -> DHTRecordDescriptor: return DHTRecordDescriptor.from_json( raise_api_result( diff --git a/veilid-python/veilid/schema/Request.json b/veilid-python/veilid/schema/Request.json index d087d1cc..9d78ceac 100644 --- a/veilid-python/veilid/schema/Request.json +++ b/veilid-python/veilid/schema/Request.json @@ -303,13 +303,15 @@ { "type": "object", "required": [ - "kind", "rc_op", "schema" ], "properties": { "kind": { - "type": "string" + "type": [ + "string", + "null" + ] }, "rc_op": { "type": "string", diff --git a/veilid-server/Cargo.toml b/veilid-server/Cargo.toml index a2193b74..619adda2 100644 --- a/veilid-server/Cargo.toml +++ b/veilid-server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "veilid-server" -version = "0.1.0" +version = "0.1.1" authors = ["John Smith "] edition = "2021" license = "LGPL-2.0-or-later OR MPL-2.0 OR (MIT AND BSD-3-Clause)" diff --git a/veilid-tools/Cargo.toml b/veilid-tools/Cargo.toml index 4b3875da..0232e04d 100644 --- a/veilid-tools/Cargo.toml +++ b/veilid-tools/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "veilid-tools" -version = "0.1.0" +version = "0.1.1" authors = ["John Smith "] edition = "2021" license = "LGPL-2.0-or-later OR MPL-2.0 OR (MIT AND BSD-3-Clause)" @@ -46,7 +46,6 @@ flume = { version = "^0", features = ["async"] } async-std = { version = "^1", features = ["unstable"], optional = true} tokio = { version = "^1", features = ["full"], optional = true} tokio-util = { version = "^0", features = ["compat"], optional = true} -maplit = "^1" futures-util = { version = "^0", default-features = false, features = ["async-await", "sink", "std", "io"] } chrono = "^0" diff --git a/veilid-wasm/Cargo.toml b/veilid-wasm/Cargo.toml index dfe6820c..757e93f2 100644 --- a/veilid-wasm/Cargo.toml +++ b/veilid-wasm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "veilid-wasm" -version = "0.1.0" +version = "0.1.1" authors = ["John Smith "] edition = "2021" license = "LGPL-2.0-or-later OR MPL-2.0 OR (MIT AND BSD-3-Clause)" diff --git a/veilid-wasm/src/lib.rs b/veilid-wasm/src/lib.rs index 80455917..48e4f7d0 100644 --- a/veilid-wasm/src/lib.rs +++ b/veilid-wasm/src/lib.rs @@ -425,8 +425,12 @@ pub fn routing_context_app_message(id: u32, target: String, message: String) -> } #[wasm_bindgen()] -pub fn routing_context_create_dht_record(id: u32, kind: u32, schema: String) -> Promise { - let crypto_kind: veilid_core::CryptoKind = veilid_core::FourCC::from(kind); +pub fn routing_context_create_dht_record(id: u32, schema: String, kind: u32) -> Promise { + let crypto_kind = if kind == 0 { + None + } else { + Some(veilid_core::FourCC::from(kind)) + }; let schema: veilid_core::DHTSchema = veilid_core::deserialize_json(&schema).unwrap(); wrap_api_future_json(async move { diff --git a/version_bump.sh b/version_bump.sh new file mode 100755 index 00000000..aaccf339 --- /dev/null +++ b/version_bump.sh @@ -0,0 +1,19 @@ +#!/bin/sh +set -e + +if [ "$1" == "patch" ]; then + echo Bumping patch version + PART=patch +elif [ "$1" == "minor" ]; then + echo Bumping minor version + PART=minor +elif [ "$1" == "major" ]; then + echo Bumping major version + PART=major +else + echo Unsupported part! Specify 'patch', 'minor', or 'major' + exit 1 +fi + +bumpversion $PART +