wasm fixes

This commit is contained in:
John Smith 2022-11-29 22:51:51 -05:00
parent 5c0a500971
commit 672d750f8f
14 changed files with 166 additions and 112 deletions

View File

@ -1,14 +1,2 @@
[build] [build]
rustflags = ["--cfg", "tokio_unstable"] rustflags = ["--cfg", "tokio_unstable"]
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
[target.aarch64-linux-android]
linker = "/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android30-clang"
[target.armv7-linux-androideabi]
linker = "/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi30-clang"
[target.x86_64-linux-android]
linker = "/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android30-clang"
[target.i686-linux-android]
linker = "/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android30-clang"

142
Cargo.lock generated
View File

@ -195,11 +195,11 @@ dependencies = [
[[package]] [[package]]
name = "async-channel" name = "async-channel"
version = "1.7.1" version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e14485364214912d3b19cc3435dde4df66065127f05fa0d75c712f36f12c2f28" checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833"
dependencies = [ dependencies = [
"concurrent-queue 1.2.4", "concurrent-queue",
"event-listener", "event-listener",
"futures-core", "futures-core",
] ]
@ -212,7 +212,7 @@ checksum = "17adb73da160dfb475c183343c8cccd80721ea5a605d3eb57125f0a7b7a92d0b"
dependencies = [ dependencies = [
"async-lock", "async-lock",
"async-task", "async-task",
"concurrent-queue 2.0.0", "concurrent-queue",
"fastrand", "fastrand",
"futures-lite", "futures-lite",
"slab", "slab",
@ -235,13 +235,13 @@ dependencies = [
[[package]] [[package]]
name = "async-io" name = "async-io"
version = "1.11.0" version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6fe557ebe0829511ddff4ad3011d159c0e6f144e05e3e8c3ab5095a131900a7b" checksum = "8c374dda1ed3e7d8f0d9ba58715f924862c63eae6849c92d3a18e7fbde9e2794"
dependencies = [ dependencies = [
"async-lock", "async-lock",
"autocfg", "autocfg",
"concurrent-queue 2.0.0", "concurrent-queue",
"futures-lite", "futures-lite",
"libc", "libc",
"log", "log",
@ -250,7 +250,7 @@ dependencies = [
"slab", "slab",
"socket2", "socket2",
"waker-fn", "waker-fn",
"winapi 0.3.9", "windows-sys 0.42.0",
] ]
[[package]] [[package]]
@ -265,20 +265,20 @@ dependencies = [
[[package]] [[package]]
name = "async-process" name = "async-process"
version = "1.5.0" version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02111fd8655a613c25069ea89fc8d9bb89331fa77486eb3bc059ee757cfa481c" checksum = "6381ead98388605d0d9ff86371043b5aa922a3905824244de40dc263a14fcba4"
dependencies = [ dependencies = [
"async-io", "async-io",
"async-lock",
"autocfg", "autocfg",
"blocking", "blocking",
"cfg-if 1.0.0", "cfg-if 1.0.0",
"event-listener", "event-listener",
"futures-lite", "futures-lite",
"libc", "libc",
"once_cell",
"signal-hook", "signal-hook",
"winapi 0.3.9", "windows-sys 0.42.0",
] ]
[[package]] [[package]]
@ -366,9 +366,9 @@ dependencies = [
[[package]] [[package]]
name = "async-trait" name = "async-trait"
version = "0.1.58" version = "0.1.59"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e805d94e6b5001b651426cf4cd446b1ab5f319d27bab5c644f61de0a804360c" checksum = "31e6e93155431f3931513b243d371981bb2770112b370c82745a1d19d2f99364"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -477,9 +477,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]] [[package]]
name = "axum" name = "axum"
version = "0.5.17" version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acee9fd5073ab6b045a275b3e709c163dd36c90685219cb21804a147b58dba43" checksum = "08b108ad2665fa3f6e6a517c3d80ec3e77d224c47d605167aefaa5d7ef97fa48"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"axum-core", "axum-core",
@ -495,9 +495,9 @@ dependencies = [
"mime", "mime",
"percent-encoding", "percent-encoding",
"pin-project-lite 0.2.9", "pin-project-lite 0.2.9",
"rustversion",
"serde", "serde",
"sync_wrapper", "sync_wrapper",
"tokio 1.22.0",
"tower", "tower",
"tower-http", "tower-http",
"tower-layer", "tower-layer",
@ -506,9 +506,9 @@ dependencies = [
[[package]] [[package]]
name = "axum-core" name = "axum-core"
version = "0.2.9" version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37e5939e02c56fecd5c017c37df4238c0a839fa76b7f97acdd7efb804fd181cc" checksum = "79b8558f5a0581152dc94dcd289132a1d377494bdeafcd41869b3258e3e2ad92"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"bytes 1.3.0", "bytes 1.3.0",
@ -516,6 +516,7 @@ dependencies = [
"http", "http",
"http-body", "http-body",
"mime", "mime",
"rustversion",
"tower-layer", "tower-layer",
"tower-service", "tower-service",
] ]
@ -734,12 +735,6 @@ version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c"
[[package]]
name = "cache-padded"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c"
[[package]] [[package]]
name = "capnp" name = "capnp"
version = "0.15.1" version = "0.15.1"
@ -989,15 +984,6 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "concurrent-queue"
version = "1.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af4780a44ab5696ea9e28294517f1fffb421a83a25af521333c838635509db9c"
dependencies = [
"cache-padded",
]
[[package]] [[package]]
name = "concurrent-queue" name = "concurrent-queue"
version = "2.0.0" version = "2.0.0"
@ -1534,7 +1520,7 @@ dependencies = [
"hashbrown", "hashbrown",
"lock_api", "lock_api",
"once_cell", "once_cell",
"parking_lot_core 0.9.4", "parking_lot_core 0.9.5",
] ]
[[package]] [[package]]
@ -1757,9 +1743,9 @@ dependencies = [
[[package]] [[package]]
name = "ethereum-types" name = "ethereum-types"
version = "0.14.0" version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81224dc661606574f5a0f28c9947d0ee1d93ff11c5f1c4e7272f52e8c0b5483c" checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee"
dependencies = [ dependencies = [
"ethbloom", "ethbloom",
"fixed-hash", "fixed-hash",
@ -2106,9 +2092,9 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
[[package]] [[package]]
name = "gloo-timers" name = "gloo-timers"
version = "0.2.4" version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5fb7d06c1c8cc2a29bee7ec961009a0b2caa0793ee4900c2ffb348734ba1c8f9" checksum = "98c4a8d6391675c6b2ee1a6c8d06e8e2d03605c44cec1270675985a4c2a5500b"
dependencies = [ dependencies = [
"futures-channel", "futures-channel",
"futures-core", "futures-core",
@ -2118,9 +2104,9 @@ dependencies = [
[[package]] [[package]]
name = "gloo-utils" name = "gloo-utils"
version = "0.1.5" version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40913a05c8297adca04392f707b1e73b12ba7b8eab7244a4961580b1fd34063c" checksum = "a8e8fc851e9c7b9852508bc6e3f690f452f474417e8545ec9857b7f7377036b5"
dependencies = [ dependencies = [
"js-sys", "js-sys",
"serde", "serde",
@ -2868,9 +2854,9 @@ checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
[[package]] [[package]]
name = "matchit" name = "matchit"
version = "0.5.0" version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73cbba799671b762df5a175adf59ce145165747bb891505c43d09aefbbf38beb" checksum = "b87248edafb776e59e6ee64a79086f65890d3510f2c656c000bf2a7e8a0aea40"
[[package]] [[package]]
name = "memchr" name = "memchr"
@ -3204,8 +3190,20 @@ dependencies = [
"bitflags", "bitflags",
"cfg-if 1.0.0", "cfg-if 1.0.0",
"libc", "libc",
"memoffset 0.6.5", ]
[[package]]
name = "nix"
version = "0.26.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46a58d1d356c6597d08cde02c2f09d785b09e28711837b1ed667dc652c08a694"
dependencies = [
"bitflags",
"cfg-if 1.0.0",
"libc",
"memoffset 0.7.1",
"pin-utils", "pin-utils",
"static_assertions",
] ]
[[package]] [[package]]
@ -3580,7 +3578,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
dependencies = [ dependencies = [
"lock_api", "lock_api",
"parking_lot_core 0.9.4", "parking_lot_core 0.9.5",
] ]
[[package]] [[package]]
@ -3599,9 +3597,9 @@ dependencies = [
[[package]] [[package]]
name = "parking_lot_core" name = "parking_lot_core"
version = "0.9.4" version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"libc", "libc",
@ -3792,16 +3790,16 @@ dependencies = [
[[package]] [[package]]
name = "polling" name = "polling"
version = "2.4.0" version = "2.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab4609a838d88b73d8238967b60dd115cc08d38e2bbaf51ee1e4b695f89122e2" checksum = "166ca89eb77fd403230b9c156612965a81e094ec6ec3aa13663d4c8b113fa748"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"cfg-if 1.0.0", "cfg-if 1.0.0",
"libc", "libc",
"log", "log",
"wepoll-ffi", "wepoll-ffi",
"winapi 0.3.9", "windows-sys 0.42.0",
] ]
[[package]] [[package]]
@ -3905,9 +3903,9 @@ dependencies = [
[[package]] [[package]]
name = "prost" name = "prost"
version = "0.11.2" version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0841812012b2d4a6145fae9a6af1534873c32aa67fff26bd09f8fa42c83f95a" checksum = "c0b18e655c21ff5ac2084a5ad0611e827b3f92badf79f4910b5a5c58f4d87ff0"
dependencies = [ dependencies = [
"bytes 1.3.0", "bytes 1.3.0",
"prost-derive", "prost-derive",
@ -3915,9 +3913,9 @@ dependencies = [
[[package]] [[package]]
name = "prost-build" name = "prost-build"
version = "0.11.2" version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d8b442418ea0822409d9e7d047cbf1e7e9e1760b172bf9982cf29d517c93511" checksum = "e330bf1316db56b12c2bcfa399e8edddd4821965ea25ddb2c134b610b1c1c604"
dependencies = [ dependencies = [
"bytes 1.3.0", "bytes 1.3.0",
"heck", "heck",
@ -4529,9 +4527,9 @@ dependencies = [
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.147" version = "1.0.148"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" checksum = "e53f64bb4ba0191d6d0676e1b141ca55047d83b74f5607e6d8eb88126c52c2dc"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
@ -4557,9 +4555,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.147" version = "1.0.148"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" checksum = "a55492425aa53521babf6137309e7d34c20bbfbbfcfe2c7f3a047fd1f6b92c0c"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -4642,9 +4640,9 @@ dependencies = [
[[package]] [[package]]
name = "sha-1" name = "sha-1"
version = "0.10.0" version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f" checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"cpufeatures", "cpufeatures",
@ -4927,9 +4925,9 @@ checksum = "734676eb262c623cec13c3155096e08d1f8f29adce39ba17948b18dad1e54142"
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.103" version = "1.0.104"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" checksum = "4ae548ec36cf198c0ef7710d3c230987c2d6d7bd98ad6edc0274462724c585ce"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -5252,9 +5250,9 @@ dependencies = [
[[package]] [[package]]
name = "tonic" name = "tonic"
version = "0.8.2" version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55b9af819e54b8f33d453655bef9b9acc171568fb49523078d0cc4e7484200ec" checksum = "8f219fad3b929bef19b1f86fbc0358d35daed8f2cac972037ac0dc10bbb8d5fb"
dependencies = [ dependencies = [
"async-stream", "async-stream",
"async-trait", "async-trait",
@ -5284,9 +5282,9 @@ dependencies = [
[[package]] [[package]]
name = "tonic-build" name = "tonic-build"
version = "0.8.2" version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48c6fd7c2581e36d63388a9e04c350c21beb7a8b059580b2e93993c526899ddc" checksum = "5bf5e9b9c0f7e0a7c027dcfaba7b2c60816c7049171f679d99ee2ff65d0de8c4"
dependencies = [ dependencies = [
"prettyplease", "prettyplease",
"proc-macro2", "proc-macro2",
@ -5570,7 +5568,7 @@ dependencies = [
"httparse", "httparse",
"log", "log",
"rand 0.8.5", "rand 0.8.5",
"sha-1 0.10.0", "sha-1 0.10.1",
"thiserror", "thiserror",
"url", "url",
"utf-8", "utf-8",
@ -5590,9 +5588,9 @@ checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81"
[[package]] [[package]]
name = "uint" name = "uint"
version = "0.9.4" version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a45526d29728d135c2900b0d30573fe3ee79fceb12ef534c7bb30e810a91b601" checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52"
dependencies = [ dependencies = [
"byteorder", "byteorder",
"crunchy", "crunchy",
@ -5791,7 +5789,7 @@ dependencies = [
"maplit", "maplit",
"ndk 0.6.0", "ndk 0.6.0",
"ndk-glue", "ndk-glue",
"nix 0.25.0", "nix 0.26.1",
"once_cell", "once_cell",
"owning_ref", "owning_ref",
"owo-colors", "owo-colors",
@ -5892,7 +5890,7 @@ dependencies = [
"hostname", "hostname",
"json", "json",
"lazy_static", "lazy_static",
"nix 0.25.0", "nix 0.26.1",
"opentelemetry", "opentelemetry",
"opentelemetry-otlp", "opentelemetry-otlp",
"opentelemetry-semantic-conventions", "opentelemetry-semantic-conventions",
@ -5939,7 +5937,7 @@ dependencies = [
"maplit", "maplit",
"ndk 0.6.0", "ndk 0.6.0",
"ndk-glue", "ndk-glue",
"nix 0.25.0", "nix 0.26.1",
"once_cell", "once_cell",
"owo-colors", "owo-colors",
"parking_lot 0.11.2", "parking_lot 0.11.2",

View File

@ -66,12 +66,15 @@ deps-linux:
code-linux: code-linux:
FROM +deps-linux FROM +deps-linux
COPY --dir .cargo external files scripts veilid-cli veilid-core veilid-server veilid-flutter veilid-wasm Cargo.lock Cargo.toml /veilid COPY --dir .cargo external files scripts veilid-cli veilid-core veilid-server veilid-flutter veilid-wasm Cargo.lock Cargo.toml /veilid
RUN cat /veilid/scripts/earthly/cargo-linux/config.toml >> /veilid/.cargo/config.tml
WORKDIR /veilid WORKDIR /veilid
# Code + Linux + Android deps # Code + Linux + Android deps
code-android: code-android:
FROM +deps-android FROM +deps-android
COPY --dir .cargo external files scripts veilid-cli veilid-core veilid-server veilid-flutter veilid-wasm Cargo.lock Cargo.toml /veilid COPY --dir .cargo external files scripts veilid-cli veilid-core veilid-server veilid-flutter veilid-wasm Cargo.lock Cargo.toml /veilid
RUN cat /veilid/scripts/earthly/cargo-linux/config.toml >> /veilid/.cargo/config.tml
RUN cat /veilid/scripts/earthly/cargo-android/config.toml >> /veilid/.cargo/config.tml
WORKDIR /veilid WORKDIR /veilid
# Clippy only # Clippy only

View File

@ -0,0 +1,8 @@
[target.aarch64-linux-android]
linker = "/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android30-clang"
[target.armv7-linux-androideabi]
linker = "/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi30-clang"
[target.x86_64-linux-android]
linker = "/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android30-clang"
[target.i686-linux-android]
linker = "/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android30-clang"

View File

@ -0,0 +1,2 @@
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"

View File

@ -3,10 +3,7 @@ mod protected_store;
mod system; mod system;
mod table_store; mod table_store;
pub mod utils;
pub use block_store::*; pub use block_store::*;
pub use protected_store::*; pub use protected_store::*;
pub use system::*; pub use system::*;
pub use table_store::*; pub use table_store::*;
use utils::*;

View File

@ -1,4 +1,3 @@
use super::*;
use crate::*; use crate::*;
use data_encoding::BASE64URL_NOPAD; use data_encoding::BASE64URL_NOPAD;
use rkyv::{Archive as RkyvArchive, Deserialize as RkyvDeserialize, Serialize as RkyvSerialize}; use rkyv::{Archive as RkyvArchive, Deserialize as RkyvDeserialize, Serialize as RkyvSerialize};

View File

@ -1,6 +1,6 @@
use async_executors::{Bindgen, LocalSpawnHandleExt, SpawnHandleExt, Timer}; use crate::*;
use futures_util::future::{select, Either};
use js_sys::*; //use js_sys::*;
pub async fn get_outbound_relay_peer() -> Option<crate::veilid_api::PeerInfo> { pub async fn get_outbound_relay_peer() -> Option<crate::veilid_api::PeerInfo> {
// unimplemented! // unimplemented!
@ -8,7 +8,7 @@ pub async fn get_outbound_relay_peer() -> Option<crate::veilid_api::PeerInfo> {
} }
// pub async fn get_pwa_web_server_config() -> { // pub async fn get_pwa_web_server_config() -> {
// if utils::is_browser() { // if is_browser() {
// let win = window().unwrap(); // let win = window().unwrap();
// let doc = win.document().unwrap(); // let doc = win.document().unwrap();

View File

@ -1,5 +1,3 @@
use super::*;
use crate::intf::table_db::*; use crate::intf::table_db::*;
use crate::*; use crate::*;
use keyvaluedb_web::*; use keyvaluedb_web::*;
@ -135,7 +133,7 @@ impl TableStore {
} }
} }
if utils::is_browser() { if is_browser() {
let out = match Database::delete(table_name.clone()).await { let out = match Database::delete(table_name.clone()).await {
Ok(_) => true, Ok(_) => true,
Err(_) => false, Err(_) => false,

View File

@ -1,5 +1,6 @@
#![deny(clippy::all)] #![deny(clippy::all)]
#![deny(unused_must_use)] #![deny(unused_must_use)]
#![recursion_limit = "1024"]
cfg_if::cfg_if! { cfg_if::cfg_if! {
if #[cfg(target_arch = "wasm32")] { if #[cfg(target_arch = "wasm32")] {

View File

@ -192,7 +192,7 @@ impl RouteSpecDetail {
/// The core representation of the RouteSpecStore that can be serialized /// The core representation of the RouteSpecStore that can be serialized
#[derive(Debug, Clone, Default, RkyvArchive, RkyvSerialize, RkyvDeserialize)] #[derive(Debug, Clone, Default, RkyvArchive, RkyvSerialize, RkyvDeserialize)]
#[archive_attr(repr(C), derive(CheckBytes))] #[archive_attr(repr(C, align(8)), derive(CheckBytes))]
pub struct RouteSpecStoreContent { pub struct RouteSpecStoreContent {
/// All of the routes we have allocated so far /// All of the routes we have allocated so far
details: HashMap<DHTKey, RouteSpecDetail>, details: HashMap<DHTKey, RouteSpecDetail>,

View File

@ -1,3 +1,14 @@
#[cfg(target_os = "android")]
mod android;
pub mod common; pub mod common;
#[cfg(target_os = "ios")]
mod ios;
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
mod native; mod native;
#[allow(unused_imports)]
use super::*;
pub use common::*;
pub use crypto::tests::*;
pub use network_manager::tests::*;

View File

@ -597,11 +597,13 @@ impl VeilidConfig {
macro_rules! get_config { macro_rules! get_config {
($key:expr) => { ($key:expr) => {
let keyname = &stringify!($key)[6..]; let keyname = &stringify!($key)[6..];
$key = *cb(keyname.to_owned())?.downcast().map_err(|_| { let v = cb(keyname.to_owned())?;
let err = format!("incorrect type for key {}", keyname); $key = match v.downcast() {
debug!("{}", err); Ok(v) => *v,
VeilidAPIError::generic(err) Err(_) => {
})?; apibail_generic!(format!("incorrect type for key {}", keyname))
}
};
}; };
} }

View File

@ -1,8 +1,9 @@
//! Test suite for the Web and headless browsers. //! Test suite for the Web and headless browsers.
#![cfg(target_arch = "wasm32")] #![cfg(target_arch = "wasm32")]
#![recursion_limit = "256"]
use veilid_core::tests::common::*; use veilid_core::tests::*;
use veilid_core::xx::*; use veilid_core::tools::*;
use wasm_bindgen_test::*; use wasm_bindgen_test::*;
wasm_bindgen_test_configure!(run_in_browser); wasm_bindgen_test_configure!(run_in_browser);
@ -15,24 +16,70 @@ static SETUP_ONCE: Once = Once::new();
pub fn setup() -> () { pub fn setup() -> () {
SETUP_ONCE.call_once(|| { SETUP_ONCE.call_once(|| {
console_error_panic_hook::set_once(); console_error_panic_hook::set_once();
cfg_if! {
if #[cfg(feature = "tracing")] {
let mut builder = tracing_wasm::WASMLayerConfigBuilder::new(); let mut builder = tracing_wasm::WASMLayerConfigBuilder::new();
builder.set_report_logs_in_timings(false); builder.set_report_logs_in_timings(false);
builder.set_max_level(Level::TRACE); builder.set_max_level(Level::TRACE);
builder.set_console_config(tracing_wasm::ConsoleConfig::ReportWithConsoleColor); builder.set_console_config(tracing_wasm::ConsoleConfig::ReportWithConsoleColor);
tracing_wasm::set_as_global_default_with_config(builder.build()); tracing_wasm::set_as_global_default_with_config(builder.build());
} else {
wasm_logger::init(wasm_logger::Config::default());
}
}
}); });
} }
#[wasm_bindgen_test] #[wasm_bindgen_test]
async fn run_test_host_interface() { async fn run_test_host_interface() {
setup(); setup();
test_host_interface::test_all().await; test_host_interface::test_all().await;
} }
#[wasm_bindgen_test] #[wasm_bindgen_test]
async fn run_test_async_tag_lock() { async fn run_test_dht_key() {
setup(); setup();
test_dht_key::test_all().await;
test_async_tag_lock::test_all().await; }
#[wasm_bindgen_test]
async fn run_test_veilid_core() {
setup();
test_veilid_core::test_all().await;
}
#[wasm_bindgen_test]
async fn test_veilid_config() {
setup();
test_veilid_config::test_all().await;
}
#[wasm_bindgen_test]
async fn run_test_connection_table() {
setup();
test_connection_table::test_all().await;
}
#[wasm_bindgen_test]
async fn exec_test_table_store() {
setup();
test_table_store::test_all().await;
}
#[wasm_bindgen_test]
async fn exec_test_protected_store() {
setup();
test_protected_store::test_all().await;
}
#[wasm_bindgen_test]
async fn exec_test_crypto() {
setup();
test_crypto::test_all().await;
}
#[wasm_bindgen_test]
async fn exec_test_envelope_receipt() {
setup();
test_envelope_receipt::test_all().await;
} }