[Fix] Stability
This commit is contained in:
parent
dfe8e6efa7
commit
ad208fd298
12 changed files with 281 additions and 98 deletions
114
Cargo.lock
generated
114
Cargo.lock
generated
|
|
@ -104,7 +104,7 @@ checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 3.0.3",
|
"syn 3.0.4",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -238,9 +238,9 @@ checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.4.3"
|
version = "1.4.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "509591b7bcd67f4ef775afad7662703b4935daaa6ec0e5605cfb1090b32a2b6d"
|
checksum = "0ad534f4357a5264cce5019c989cf66a4f0dc4e0d1b1d15f8aacec0ff7360273"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"find-msvc-tools",
|
"find-msvc-tools",
|
||||||
"jobserver",
|
"jobserver",
|
||||||
|
|
@ -338,9 +338,9 @@ checksum = "0c9ea0ac24bc397ab3c98583a3c9ba74fa56b09a4449bbe172b9b1ddb016027a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "combine"
|
name = "combine"
|
||||||
version = "4.6.7"
|
version = "4.6.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd"
|
checksum = "cfc320937d09e6de266b31b9afb480f197d7a861be86be7cb2ea7e5d1bfffc5e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"memchr",
|
"memchr",
|
||||||
|
|
@ -572,7 +572,7 @@ checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 3.0.3",
|
"syn 3.0.4",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -614,9 +614,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "either"
|
name = "either"
|
||||||
version = "1.17.0"
|
version = "1.18.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9e5e8f6c15a24b9a3ee5efec809ccd006d3b30e8b3bb63c39af737c7f87daa1d"
|
checksum = "252afb9ae5eaa683babdc6a068b3f5726eb19e05070c731f9b2a23a7c3e8ed34"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "enum-as-inner"
|
name = "enum-as-inner"
|
||||||
|
|
@ -643,7 +643,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -771,7 +771,7 @@ checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 3.0.3",
|
"syn 3.0.4",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -854,9 +854,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "h2"
|
name = "h2"
|
||||||
version = "0.4.16"
|
version = "0.4.19"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a9f37a958b41b3b19ee2707c06439c0e9e547e847223eb791ecb0cb821c65e27"
|
checksum = "ef8e5e5a340588f4452631496976cf8636d4a7ecf600239fdc27615d2530bc16"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"atomic-waker",
|
"atomic-waker",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
|
@ -1170,9 +1170,9 @@ checksum = "e590f038c1464a96894fd6d10127e90a8be4509f56ff7ecef851b15cee0b7caa"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "icu_provider"
|
name = "icu_provider"
|
||||||
version = "2.3.0"
|
version = "2.3.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "92a7ed671a6aad807a8651a2e1782a6598fda9ce5185dd8158549e95a91c6428"
|
checksum = "d27bbb9d3abbefac45d55f647c9de1d44aafcd1186eb91879afef17c396c3e73"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"displaydoc",
|
"displaydoc",
|
||||||
"icu_locale_core",
|
"icu_locale_core",
|
||||||
|
|
@ -1397,9 +1397,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "keccak"
|
name = "keccak"
|
||||||
version = "0.2.1"
|
version = "0.2.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ffd9697dc4a9a62e2da93389f34400b77a28f0287711263cabb203b3ccb9c0e4"
|
checksum = "d8f198d1db720e4940b5a493201d199d9f24f568f8f746bd13706243a2f71598"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"cpufeatures 0.3.0",
|
"cpufeatures 0.3.0",
|
||||||
|
|
@ -1517,9 +1517,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
version = "0.4.33"
|
version = "0.4.34"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad"
|
checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lru-cache"
|
name = "lru-cache"
|
||||||
|
|
@ -1615,7 +1615,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mtp"
|
name = "mtp"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
source = "git+https://git.methanium.net/Methanium/mtp.git#b331b9f6a3943d0331d8fdcb7c696d6c2bc5e8b8"
|
source = "git+https://git.methanium.net/Methanium/mtp.git#c30315af944bda05ecdb9c4e9cc350cb99cf7b2e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"mtp-client",
|
"mtp-client",
|
||||||
"mtp-codec",
|
"mtp-codec",
|
||||||
|
|
@ -1631,7 +1631,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mtp-client"
|
name = "mtp-client"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
source = "git+https://git.methanium.net/Methanium/mtp.git#b331b9f6a3943d0331d8fdcb7c696d6c2bc5e8b8"
|
source = "git+https://git.methanium.net/Methanium/mtp.git#c30315af944bda05ecdb9c4e9cc350cb99cf7b2e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"mtp-codec",
|
"mtp-codec",
|
||||||
"mtp-common",
|
"mtp-common",
|
||||||
|
|
@ -1644,7 +1644,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mtp-codec"
|
name = "mtp-codec"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
source = "git+https://git.methanium.net/Methanium/mtp.git#b331b9f6a3943d0331d8fdcb7c696d6c2bc5e8b8"
|
source = "git+https://git.methanium.net/Methanium/mtp.git#c30315af944bda05ecdb9c4e9cc350cb99cf7b2e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.23.1",
|
"base64 0.23.1",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
|
|
@ -1658,10 +1658,9 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mtp-common"
|
name = "mtp-common"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
source = "git+https://git.methanium.net/Methanium/mtp.git#b331b9f6a3943d0331d8fdcb7c696d6c2bc5e8b8"
|
source = "git+https://git.methanium.net/Methanium/mtp.git#c30315af944bda05ecdb9c4e9cc350cb99cf7b2e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quinn",
|
"quinn",
|
||||||
"rustls",
|
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.20",
|
||||||
"wtransport",
|
"wtransport",
|
||||||
]
|
]
|
||||||
|
|
@ -1669,7 +1668,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mtp-crypto"
|
name = "mtp-crypto"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
source = "git+https://git.methanium.net/Methanium/mtp.git#b331b9f6a3943d0331d8fdcb7c696d6c2bc5e8b8"
|
source = "git+https://git.methanium.net/Methanium/mtp.git#c30315af944bda05ecdb9c4e9cc350cb99cf7b2e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"argon2",
|
"argon2",
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
|
|
@ -1692,7 +1691,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mtp-files"
|
name = "mtp-files"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
source = "git+https://git.methanium.net/Methanium/mtp.git#b331b9f6a3943d0331d8fdcb7c696d6c2bc5e8b8"
|
source = "git+https://git.methanium.net/Methanium/mtp.git#c30315af944bda05ecdb9c4e9cc350cb99cf7b2e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"mtp-crypto",
|
"mtp-crypto",
|
||||||
"rand 0.10.2",
|
"rand 0.10.2",
|
||||||
|
|
@ -1703,7 +1702,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mtp-host"
|
name = "mtp-host"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
source = "git+https://git.methanium.net/Methanium/mtp.git#b331b9f6a3943d0331d8fdcb7c696d6c2bc5e8b8"
|
source = "git+https://git.methanium.net/Methanium/mtp.git#c30315af944bda05ecdb9c4e9cc350cb99cf7b2e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"mtp-codec",
|
"mtp-codec",
|
||||||
"mtp-common",
|
"mtp-common",
|
||||||
|
|
@ -1719,7 +1718,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mtp-transport"
|
name = "mtp-transport"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
source = "git+https://git.methanium.net/Methanium/mtp.git#b331b9f6a3943d0331d8fdcb7c696d6c2bc5e8b8"
|
source = "git+https://git.methanium.net/Methanium/mtp.git#c30315af944bda05ecdb9c4e9cc350cb99cf7b2e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"mtp-codec",
|
"mtp-codec",
|
||||||
|
|
@ -1739,7 +1738,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mtp-type-map"
|
name = "mtp-type-map"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
source = "git+https://git.methanium.net/Methanium/mtp.git#b331b9f6a3943d0331d8fdcb7c696d6c2bc5e8b8"
|
source = "git+https://git.methanium.net/Methanium/mtp.git#c30315af944bda05ecdb9c4e9cc350cb99cf7b2e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde_yaml",
|
"serde_yaml",
|
||||||
|
|
@ -1748,7 +1747,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mtp-webserver"
|
name = "mtp-webserver"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
source = "git+https://git.methanium.net/Methanium/mtp.git#b331b9f6a3943d0331d8fdcb7c696d6c2bc5e8b8"
|
source = "git+https://git.methanium.net/Methanium/mtp.git#c30315af944bda05ecdb9c4e9cc350cb99cf7b2e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
|
@ -2026,7 +2025,6 @@ dependencies = [
|
||||||
"rand 0.10.2",
|
"rand 0.10.2",
|
||||||
"rustls",
|
"rustls",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"strum",
|
|
||||||
"strum_macros",
|
"strum_macros",
|
||||||
"thiserror 2.0.20",
|
"thiserror 2.0.20",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
|
@ -2366,7 +2364,7 @@ dependencies = [
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"socket2",
|
"socket2",
|
||||||
"tracing",
|
"tracing",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -2392,9 +2390,9 @@ checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand"
|
name = "rand"
|
||||||
version = "0.8.7"
|
version = "0.8.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "22f6172bdec972074665ed81ed53b71da00bfc44b65a753cfde883ec4c702a1a"
|
checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"rand_chacha 0.3.1",
|
"rand_chacha 0.3.1",
|
||||||
|
|
@ -2620,7 +2618,7 @@ dependencies = [
|
||||||
"errno",
|
"errno",
|
||||||
"libc",
|
"libc",
|
||||||
"linux-raw-sys",
|
"linux-raw-sys",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -2679,7 +2677,7 @@ dependencies = [
|
||||||
"security-framework",
|
"security-framework",
|
||||||
"security-framework-sys",
|
"security-framework-sys",
|
||||||
"webpki-root-certs",
|
"webpki-root-certs",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -2690,9 +2688,9 @@ checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustls-webpki"
|
name = "rustls-webpki"
|
||||||
version = "0.103.14"
|
version = "0.103.15"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0527518605e68109d875e248ea259b6758801cf165e4b2c2733ae3b51f12535a"
|
checksum = "f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aws-lc-rs",
|
"aws-lc-rs",
|
||||||
"ring",
|
"ring",
|
||||||
|
|
@ -2792,7 +2790,7 @@ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 3.0.3",
|
"syn 3.0.4",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -2883,7 +2881,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "09057cb2149ad4cbd2da1e26b351f9a4c354219421229c69c3063e6f61947c4a"
|
checksum = "09057cb2149ad4cbd2da1e26b351f9a4c354219421229c69c3063e6f61947c4a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"digest 0.11.3",
|
"digest 0.11.3",
|
||||||
"keccak 0.2.1",
|
"keccak 0.2.2",
|
||||||
"sponge-cursor",
|
"sponge-cursor",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -2988,12 +2986,6 @@ version = "1.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
|
checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "strum"
|
|
||||||
version = "0.28.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9628de9b8791db39ceda2b119bbe13134770b56c138ec1d3af810d045c04f9bd"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "strum_macros"
|
name = "strum_macros"
|
||||||
version = "0.28.0"
|
version = "0.28.0"
|
||||||
|
|
@ -3025,9 +3017,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "3.0.3"
|
version = "3.0.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3"
|
checksum = "e6275cddf4610d1775e6d1fe9469b2e77d0f39fd98fb7450901b821e0c53649f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
|
@ -3061,10 +3053,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
|
checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"fastrand",
|
"fastrand",
|
||||||
"getrandom 0.4.3",
|
"getrandom 0.3.4",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"rustix",
|
"rustix",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -3104,7 +3096,7 @@ checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 3.0.3",
|
"syn 3.0.4",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -3187,7 +3179,7 @@ checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 3.0.3",
|
"syn 3.0.4",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -3334,7 +3326,7 @@ dependencies = [
|
||||||
"idna 0.4.0",
|
"idna 0.4.0",
|
||||||
"ipnet",
|
"ipnet",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"rand 0.8.7",
|
"rand 0.8.8",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"thiserror 1.0.69",
|
"thiserror 1.0.69",
|
||||||
"tinyvec",
|
"tinyvec",
|
||||||
|
|
@ -3355,7 +3347,7 @@ dependencies = [
|
||||||
"lru-cache",
|
"lru-cache",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"rand 0.8.7",
|
"rand 0.8.8",
|
||||||
"resolv-conf",
|
"resolv-conf",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"thiserror 1.0.69",
|
"thiserror 1.0.69",
|
||||||
|
|
@ -3464,9 +3456,9 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "uuid"
|
name = "uuid"
|
||||||
version = "1.24.1"
|
version = "1.26.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2cefc03fd367c0c6d4305de1b312cf00248c4114f4a0418ce6a6af769e3b0bd9"
|
checksum = "b5772d71c9be8a8a6ac2117d949c5b224c1b72241bb611d9a3012edcf8af7812"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom 0.4.3",
|
"getrandom 0.4.3",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
|
|
@ -3625,7 +3617,7 @@ version = "0.1.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -4012,9 +4004,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zerovec"
|
name = "zerovec"
|
||||||
version = "0.11.7"
|
version = "0.11.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "94b5c6b5976d66c1d703c4fd17d3f5e43c8cedaacf604961b171adc7130896d8"
|
checksum = "bb0464e17806c1d976d5cba29399c7f08e516e279e2ba493f63123b5fca67dd8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"yoke",
|
"yoke",
|
||||||
"zerofrom",
|
"zerofrom",
|
||||||
|
|
@ -4023,13 +4015,13 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zerovec-derive"
|
name = "zerovec-derive"
|
||||||
version = "0.11.5"
|
version = "0.11.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9f212a141d820099d57ffafb9569be9617a6f27d3dc881fbee8fb56642f917a9"
|
checksum = "34df6fc39dbd26ddc9c10e6a2984476e13acce22e64e4487636ef494369225da"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 3.0.3",
|
"syn 3.0.4",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ rustls = { version = "0.23.42", default-features = false, features = [
|
||||||
tokio = { version = "1.53.0", features = ["full"] }
|
tokio = { version = "1.53.0", features = ["full"] }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
dotenv = "0.15.0"
|
dotenv = "0.15.0"
|
||||||
strum = "0.28.0"
|
|
||||||
strum_macros = "0.28.0"
|
strum_macros = "0.28.0"
|
||||||
livekit-api = { version = "0.5.6", features = ["rustls-tls-native-roots"] }
|
livekit-api = { version = "0.5.6", features = ["rustls-tls-native-roots"] }
|
||||||
livekit-protocol = "=0.7.10"
|
livekit-protocol = "=0.7.10"
|
||||||
|
|
|
||||||
|
|
@ -145,6 +145,12 @@
|
||||||
description = "Port the Omikron server listens on for incoming QUIC connections.";
|
description = "Port the Omikron server listens on for incoming QUIC connections.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bindAddress = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "0.0.0.0";
|
||||||
|
description = "IP address to bind the Omikron server to.";
|
||||||
|
};
|
||||||
|
|
||||||
omegaHost = lib.mkOption {
|
omegaHost = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "tensamin.net";
|
default = "tensamin.net";
|
||||||
|
|
@ -189,6 +195,7 @@
|
||||||
|
|
||||||
environment = {
|
environment = {
|
||||||
RHO_PORT = toString cfg.rhoPort;
|
RHO_PORT = toString cfg.rhoPort;
|
||||||
|
BIND_ADDRESS = cfg.bindAddress;
|
||||||
OMEGA_HOST = cfg.omegaHost;
|
OMEGA_HOST = cfg.omegaHost;
|
||||||
OMEGA_PORT = toString cfg.omegaPort;
|
OMEGA_PORT = toString cfg.omegaPort;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ pub struct AnonymousClientConnection {
|
||||||
|
|
||||||
impl AnonymousClientConnection {
|
impl AnonymousClientConnection {
|
||||||
pub async fn from_general(general: Arc<GeneralConnection>, user_id: u64) -> Arc<Self> {
|
pub async fn from_general(general: Arc<GeneralConnection>, user_id: u64) -> Arc<Self> {
|
||||||
let username: String = generate_username();
|
let username = generate_username(user_id);
|
||||||
Arc::new(Self {
|
Arc::new(Self {
|
||||||
state: general.state.clone(),
|
state: general.state.clone(),
|
||||||
user_id: user_id,
|
user_id: user_id,
|
||||||
|
|
@ -47,6 +47,7 @@ impl AnonymousClientConnection {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
pub fn start(self: Arc<Self>) {
|
pub fn start(self: Arc<Self>) {
|
||||||
|
anonymous_manager::add_anonymous_user(self.clone());
|
||||||
let self_clone = self.clone();
|
let self_clone = self.clone();
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
while let Ok(cv) = self_clone.receiver.receive().await {
|
while let Ok(cv) = self_clone.receiver.receive().await {
|
||||||
|
|
@ -608,10 +609,13 @@ impl AnonymousClientConnection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Handle connection close
|
|
||||||
pub async fn handle_close(&self) {
|
pub async fn handle_close(&self) {
|
||||||
|
*self.is_open.write().await = false;
|
||||||
// TODO delete temp user
|
self.state
|
||||||
|
.call_manager
|
||||||
|
.remove_user_from_calls(self.user_id)
|
||||||
|
.await;
|
||||||
|
anonymous_manager::remove_anonymous_user(self.user_id).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
use dashmap::DashMap;
|
use dashmap::DashMap;
|
||||||
|
use dashmap::mapref::entry::Entry;
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use rand::prelude::{IndexedRandom, RngExt};
|
use rand::prelude::{IndexedRandom, RngExt};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
@ -7,15 +8,20 @@ use crate::anonymous_clients::anonymous_client_connection::AnonymousClientConnec
|
||||||
|
|
||||||
static ANONYMOUS_USERS: Lazy<DashMap<u64, Arc<AnonymousClientConnection>>> =
|
static ANONYMOUS_USERS: Lazy<DashMap<u64, Arc<AnonymousClientConnection>>> =
|
||||||
Lazy::new(|| DashMap::new());
|
Lazy::new(|| DashMap::new());
|
||||||
|
static ANONYMOUS_USERNAMES: Lazy<DashMap<String, u64>> = Lazy::new(|| DashMap::new());
|
||||||
|
|
||||||
#[allow(dead_code)]
|
pub fn add_anonymous_user(connection: Arc<AnonymousClientConnection>) {
|
||||||
pub async fn add_anonymous_user(connection: Arc<AnonymousClientConnection>) {
|
|
||||||
ANONYMOUS_USERS.insert(connection.get_user_id(), connection);
|
ANONYMOUS_USERS.insert(connection.get_user_id(), connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub async fn remove_anonymous_user(user_id: u64) {
|
pub async fn remove_anonymous_user(user_id: u64) {
|
||||||
ANONYMOUS_USERS.remove(&user_id);
|
if let Some((_, connection)) = ANONYMOUS_USERS.remove(&user_id) {
|
||||||
|
let username = connection.get_user_name().await;
|
||||||
|
ANONYMOUS_USERNAMES.remove_if(&username, |_, reserved_user_id| {
|
||||||
|
*reserved_user_id == user_id
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn get_anonymous_user(user_id: u64) -> Option<Arc<AnonymousClientConnection>> {
|
pub async fn get_anonymous_user(user_id: u64) -> Option<Arc<AnonymousClientConnection>> {
|
||||||
|
|
@ -25,30 +31,52 @@ pub async fn get_anonymous_user(user_id: u64) -> Option<Arc<AnonymousClientConne
|
||||||
pub async fn get_anonymous_user_by_name(
|
pub async fn get_anonymous_user_by_name(
|
||||||
username: String,
|
username: String,
|
||||||
) -> Option<Arc<AnonymousClientConnection>> {
|
) -> Option<Arc<AnonymousClientConnection>> {
|
||||||
let users: Vec<_> = ANONYMOUS_USERS
|
let user_id = ANONYMOUS_USERNAMES
|
||||||
.iter()
|
.get(&username.to_lowercase())?
|
||||||
.map(|ref_multi| ref_multi.value().clone())
|
.value()
|
||||||
.collect();
|
.to_owned();
|
||||||
|
get_anonymous_user(user_id).await
|
||||||
for user_conn in users {
|
|
||||||
if user_conn.get_user_name().await == username {
|
|
||||||
return Some(user_conn);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return None;
|
pub fn generate_username(user_id: u64) -> String {
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: implement check if taken
|
|
||||||
pub fn generate_username() -> String {
|
|
||||||
let adjectives = ["Swift", "Clever", "Brave", "Sneaky", "Fierce"];
|
let adjectives = ["Swift", "Clever", "Brave", "Sneaky", "Fierce"];
|
||||||
let nouns = ["Tiger", "Eagle", "Shark", "Wolf", "Dragon"];
|
let nouns = ["Tiger", "Eagle", "Shark", "Wolf", "Dragon"];
|
||||||
|
|
||||||
let mut rng = rand::rng();
|
let mut rng = rand::rng();
|
||||||
let adj = adjectives.choose(&mut rng).unwrap();
|
loop {
|
||||||
let noun = nouns.choose(&mut rng).unwrap();
|
let Some(adj) = adjectives.choose(&mut rng) else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
let Some(noun) = nouns.choose(&mut rng) else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
let username = format!("{}{}{}", adj, noun, rng.random_range(0..10000));
|
||||||
|
let canonical_username = username.to_lowercase();
|
||||||
|
|
||||||
let number: u16 = rng.random_range(0..10000);
|
if reserve_username(canonical_username, user_id) {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
format!("{}{}{}", adj, noun, number)
|
fn reserve_username(username: String, user_id: u64) -> bool {
|
||||||
|
if let Entry::Vacant(entry) = ANONYMOUS_USERNAMES.entry(username) {
|
||||||
|
entry.insert(user_id);
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn username_reservation_is_unique() {
|
||||||
|
let username = "anonymous-manager-reservation-test".to_string();
|
||||||
|
assert!(reserve_username(username.clone(), 1));
|
||||||
|
assert!(!reserve_username(username.clone(), 2));
|
||||||
|
ANONYMOUS_USERNAMES.remove(&username);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,10 @@ impl AppState {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn keyring_for_host(&self) -> Result<Keyring, String> {
|
pub fn keyring_for_host(&self) -> Result<Keyring, String> {
|
||||||
Keyring::from_bytes(&self.keyring.to_bytes()).map_err(|error| error.to_string())
|
let bytes = self
|
||||||
|
.keyring
|
||||||
|
.try_to_bytes()
|
||||||
|
.map_err(|error| error.to_string())?;
|
||||||
|
Keyring::from_bytes(&bytes).map_err(|error| error.to_string())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -260,6 +260,7 @@ impl CallGroup {
|
||||||
.write()
|
.write()
|
||||||
.await
|
.await
|
||||||
.retain(|caller| caller.user_id != user_id);
|
.retain(|caller| caller.user_id != user_id);
|
||||||
|
self.secrets.write().await.remove(&user_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn get_short_link(self: Arc<Self>) -> Option<String> {
|
pub async fn get_short_link(self: Arc<Self>) -> Option<String> {
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,13 @@ impl CallManager {
|
||||||
call_groups
|
call_groups
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn remove_user_from_calls(&self, user_id: u64) {
|
||||||
|
let call_groups = self.get_call_groups(user_id).await;
|
||||||
|
for call_group in call_groups {
|
||||||
|
call_group.remove_caller(user_id).await;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn get_call_token(&self, user_id: u64, call_id: Uuid) -> Result<String, CallError> {
|
pub async fn get_call_token(&self, user_id: u64, call_id: Uuid) -> Result<String, CallError> {
|
||||||
if let Some(cg) = self.groups.get(&call_id) {
|
if let Some(cg) = self.groups.get(&call_id) {
|
||||||
let mut members = cg.members.write().await;
|
let mut members = cg.members.write().await;
|
||||||
|
|
@ -221,6 +228,30 @@ mod tests {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn removing_user_from_calls_removes_membership_and_invitation_secret() {
|
||||||
|
let call_id = Uuid::new_v4();
|
||||||
|
let sender_id = 55;
|
||||||
|
let anonymous_user_id = 66;
|
||||||
|
let group = Arc::new(CallGroup::new(
|
||||||
|
call_id,
|
||||||
|
Arc::new(Caller::new(sender_id, call_id, true)),
|
||||||
|
));
|
||||||
|
let manager = CallManager::default();
|
||||||
|
manager.groups.insert(call_id, group.clone());
|
||||||
|
|
||||||
|
assert!(
|
||||||
|
manager
|
||||||
|
.add_invite(call_id, sender_id, anonymous_user_id, envelope("anonymous"),)
|
||||||
|
.await
|
||||||
|
);
|
||||||
|
|
||||||
|
manager.remove_user_from_calls(anonymous_user_id).await;
|
||||||
|
|
||||||
|
assert!(group.get_caller(anonymous_user_id).await.is_none());
|
||||||
|
assert!(group.get_secret_for_user(anonymous_user_id).await.is_none());
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn self_invites_are_not_forwarded() {
|
fn self_invites_are_not_forwarded() {
|
||||||
let manager = CallManager::default();
|
let manager = CallManager::default();
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
use std::{env, time::Duration};
|
use std::{env, net::IpAddr, time::Duration};
|
||||||
|
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
const DEFAULT_RHO_PORT: u16 = 443;
|
const DEFAULT_RHO_PORT: u16 = 443;
|
||||||
|
const DEFAULT_BIND_ADDRESS: &str = "0.0.0.0";
|
||||||
const DEFAULT_OMEGA_HOST: &str = "tensamin.net";
|
const DEFAULT_OMEGA_HOST: &str = "tensamin.net";
|
||||||
const DEFAULT_OMEGA_PORT: u16 = 9187;
|
const DEFAULT_OMEGA_PORT: u16 = 9187;
|
||||||
const DEFAULT_OMEGA_SYNC_TIMEOUT_SECONDS: u64 = 20;
|
const DEFAULT_OMEGA_SYNC_TIMEOUT_SECONDS: u64 = 20;
|
||||||
|
|
@ -18,6 +19,7 @@ pub struct LiveKitConfig {
|
||||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub rho_port: u16,
|
pub rho_port: u16,
|
||||||
|
pub bind_address: IpAddr,
|
||||||
pub omega_host: String,
|
pub omega_host: String,
|
||||||
pub omega_port: u16,
|
pub omega_port: u16,
|
||||||
pub omikron_id: u64,
|
pub omikron_id: u64,
|
||||||
|
|
@ -43,6 +45,7 @@ pub enum ConfigError {
|
||||||
impl Config {
|
impl Config {
|
||||||
pub fn from_environment() -> Result<Self, ConfigError> {
|
pub fn from_environment() -> Result<Self, ConfigError> {
|
||||||
let rho_port = parse_or_default("RHO_PORT", DEFAULT_RHO_PORT)?;
|
let rho_port = parse_or_default("RHO_PORT", DEFAULT_RHO_PORT)?;
|
||||||
|
let bind_address = parse_bind_address(env::var("BIND_ADDRESS").ok())?;
|
||||||
let omega_port = parse_or_default("OMEGA_PORT", DEFAULT_OMEGA_PORT)?;
|
let omega_port = parse_or_default("OMEGA_PORT", DEFAULT_OMEGA_PORT)?;
|
||||||
let omikron_id = parse_or_default("ID", 0_u64)?;
|
let omikron_id = parse_or_default("ID", 0_u64)?;
|
||||||
// Each synchronization request is bounded by this timeout. After
|
// Each synchronization request is bounded by this timeout. After
|
||||||
|
|
@ -68,6 +71,7 @@ impl Config {
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
rho_port,
|
rho_port,
|
||||||
|
bind_address,
|
||||||
omega_host,
|
omega_host,
|
||||||
omega_port,
|
omega_port,
|
||||||
omikron_id,
|
omikron_id,
|
||||||
|
|
@ -78,6 +82,18 @@ impl Config {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn parse_bind_address(value: Option<String>) -> Result<IpAddr, ConfigError> {
|
||||||
|
value
|
||||||
|
.as_deref()
|
||||||
|
.unwrap_or(DEFAULT_BIND_ADDRESS)
|
||||||
|
.trim()
|
||||||
|
.parse()
|
||||||
|
.map_err(|_| ConfigError::InvalidValue {
|
||||||
|
name: "BIND_ADDRESS",
|
||||||
|
kind: "IP address",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
fn parse_or_default<T>(name: &'static str, default: T) -> Result<T, ConfigError>
|
fn parse_or_default<T>(name: &'static str, default: T) -> Result<T, ConfigError>
|
||||||
where
|
where
|
||||||
T: std::str::FromStr,
|
T: std::str::FromStr,
|
||||||
|
|
@ -148,4 +164,23 @@ mod tests {
|
||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parses_configured_bind_address() {
|
||||||
|
assert_eq!(
|
||||||
|
parse_bind_address(Some("10.200.2.0".to_string())),
|
||||||
|
Ok(IpAddr::V4(std::net::Ipv4Addr::new(10, 200, 2, 0)))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn rejects_invalid_bind_address() {
|
||||||
|
assert_eq!(
|
||||||
|
parse_bind_address(Some("not-an-address".to_string())),
|
||||||
|
Err(ConfigError::InvalidValue {
|
||||||
|
name: "BIND_ADDRESS",
|
||||||
|
kind: "IP address",
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
50
src/main.rs
50
src/main.rs
|
|
@ -8,7 +8,7 @@ mod rho;
|
||||||
mod services;
|
mod services;
|
||||||
mod util;
|
mod util;
|
||||||
|
|
||||||
use std::path::PathBuf;
|
use std::{fmt::Write, path::PathBuf};
|
||||||
|
|
||||||
use dotenv::dotenv;
|
use dotenv::dotenv;
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
|
|
@ -27,7 +27,7 @@ use crate::{
|
||||||
omega::omega_connection::{OmegaConnection, start_task_cleanup_loop},
|
omega::omega_connection::{OmegaConnection, start_task_cleanup_loop},
|
||||||
rho::rho_manager::RhoManager,
|
rho::rho_manager::RhoManager,
|
||||||
rho::server::start,
|
rho::server::start,
|
||||||
util::logger::startup,
|
util::logger::{PrintType, startup},
|
||||||
};
|
};
|
||||||
|
|
||||||
const KEYRING_PATH: &str = "./omikron.mk";
|
const KEYRING_PATH: &str = "./omikron.mk";
|
||||||
|
|
@ -71,6 +71,18 @@ async fn main() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
let public_key = match omega_database_public_key(&keyring) {
|
||||||
|
Ok(public_key) => public_key,
|
||||||
|
Err(error) => {
|
||||||
|
eprintln!("Unable to serialize public key for Omega: {error}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
log!(
|
||||||
|
0,
|
||||||
|
PrintType::Omikron,
|
||||||
|
"Omikron public_key for Omega enrollment: {public_key}"
|
||||||
|
);
|
||||||
|
|
||||||
let omega_keyring = match keyring_for_omega(&keyring) {
|
let omega_keyring = match keyring_for_omega(&keyring) {
|
||||||
Ok(keyring) => keyring,
|
Ok(keyring) => keyring,
|
||||||
|
|
@ -102,5 +114,37 @@ async fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn keyring_for_omega(keyring: &Keyring) -> Result<Keyring, String> {
|
fn keyring_for_omega(keyring: &Keyring) -> Result<Keyring, String> {
|
||||||
Keyring::from_bytes(&keyring.to_bytes()).map_err(|error| error.to_string())
|
let bytes = keyring.try_to_bytes().map_err(|error| error.to_string())?;
|
||||||
|
Keyring::from_bytes(&bytes).map_err(|error| error.to_string())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn omega_database_public_key(keyring: &Keyring) -> Result<String, String> {
|
||||||
|
let public_key = keyring
|
||||||
|
.public_key_bundle()
|
||||||
|
.try_as_bytes()
|
||||||
|
.map_err(|error| error.to_string())?;
|
||||||
|
omega_database_blob_literal(&public_key)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn omega_database_blob_literal(public_key: &[u8]) -> Result<String, String> {
|
||||||
|
let mut literal = String::with_capacity(3 + public_key.len() * 2);
|
||||||
|
literal.push_str("X'");
|
||||||
|
for byte in public_key {
|
||||||
|
write!(&mut literal, "{byte:02X}").map_err(|error| error.to_string())?;
|
||||||
|
}
|
||||||
|
literal.push('\'');
|
||||||
|
Ok(literal)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn public_key_blob_literal_is_valid_mysql_hex_syntax() {
|
||||||
|
assert_eq!(
|
||||||
|
omega_database_blob_literal(&[0x00, 0x1A, 0xFF]),
|
||||||
|
Ok("X'001AFF'".to_string())
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
use std::net::{IpAddr, Ipv4Addr};
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
|
@ -75,10 +74,23 @@ pub async fn complete_register(
|
||||||
}
|
}
|
||||||
println!("Iota connection request");
|
println!("Iota connection request");
|
||||||
|
|
||||||
|
let pub_key_bytes = match pub_key.try_as_bytes() {
|
||||||
|
Ok(bytes) => bytes,
|
||||||
|
Err(error) => {
|
||||||
|
log_err!(
|
||||||
|
0,
|
||||||
|
PrintType::General,
|
||||||
|
"Failed to serialize Iota public key: {}",
|
||||||
|
error
|
||||||
|
);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
let request = CommunicationValue::new(CommunicationType::CompleteRegisterIota)
|
let request = CommunicationValue::new(CommunicationType::CompleteRegisterIota)
|
||||||
.add_typed_default(
|
.add_typed_default(
|
||||||
DataType::PublicKey,
|
DataType::PublicKey,
|
||||||
DataValue::Str(BASE64_STD.encode(pub_key.as_bytes())),
|
DataValue::Str(BASE64_STD.encode(pub_key_bytes)),
|
||||||
);
|
);
|
||||||
|
|
||||||
let response = match omega
|
let response = match omega
|
||||||
|
|
@ -109,7 +121,7 @@ pub async fn start(state: Arc<AppState>) -> Result<(), Box<dyn std::error::Error
|
||||||
let key_pem = load_file_vec("certs", "key.pem").expect("Error loading Keyfile");
|
let key_pem = load_file_vec("certs", "key.pem").expect("Error loading Keyfile");
|
||||||
|
|
||||||
let host_config = HostConfig::new(
|
let host_config = HostConfig::new(
|
||||||
IpAddr::from(Ipv4Addr::new(0, 0, 0, 0)),
|
state.config.bind_address,
|
||||||
state.config.rho_port,
|
state.config.rho_port,
|
||||||
cert_pem,
|
cert_pem,
|
||||||
key_pem,
|
key_pem,
|
||||||
|
|
@ -154,7 +166,8 @@ pub async fn start(state: Arc<AppState>) -> Result<(), Box<dyn std::error::Error
|
||||||
log!(
|
log!(
|
||||||
0,
|
0,
|
||||||
PrintType::General,
|
PrintType::General,
|
||||||
"Server listening on port {}.",
|
"Server listening on {}:{}.",
|
||||||
|
state.config.bind_address,
|
||||||
state.config.rho_port
|
state.config.rho_port
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -205,7 +205,7 @@ fn format_data_container(data: Vec<(DataTypeId, DataValue)>, version: Version) -
|
||||||
let key_str = key.to_string();
|
let key_str = key.to_string();
|
||||||
|
|
||||||
match value {
|
match value {
|
||||||
DataValue::Str(s) => format!("{}=\"{}\"", key_str, s),
|
DataValue::Str(s) => format!("{}=\"{}\"", key_str, abbreviate_string(&s)),
|
||||||
|
|
||||||
DataValue::Container(inner) => {
|
DataValue::Container(inner) => {
|
||||||
let inner_formatted = format_data_container(inner, version.clone());
|
let inner_formatted = format_data_container(inner, version.clone());
|
||||||
|
|
@ -238,7 +238,7 @@ fn format_array(arr: Vec<DataValue>, version: Version) -> String {
|
||||||
let parts: Vec<String> = arr
|
let parts: Vec<String> = arr
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|value| match value {
|
.map(|value| match value {
|
||||||
DataValue::Str(s) => format!("\"{}\"", s),
|
DataValue::Str(s) => format!("\"{}\"", abbreviate_string(&s)),
|
||||||
|
|
||||||
DataValue::Container(inner) => {
|
DataValue::Container(inner) => {
|
||||||
let inner_formatted = format_data_container(inner, version.clone());
|
let inner_formatted = format_data_container(inner, version.clone());
|
||||||
|
|
@ -266,6 +266,31 @@ fn format_array(arr: Vec<DataValue>, version: Version) -> String {
|
||||||
parts.join(", ")
|
parts.join(", ")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn abbreviate_string(value: &str) -> String {
|
||||||
|
const EDGE_LENGTH: usize = 4;
|
||||||
|
|
||||||
|
let chars: Vec<char> = value.chars().collect();
|
||||||
|
if chars.len() <= EDGE_LENGTH * 2 {
|
||||||
|
return value.to_string();
|
||||||
|
}
|
||||||
|
|
||||||
|
let prefix: String = chars.iter().take(EDGE_LENGTH).collect();
|
||||||
|
let suffix: String = chars.iter().rev().take(EDGE_LENGTH).rev().collect();
|
||||||
|
format!("{prefix}...{suffix}")
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::abbreviate_string;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn abbreviates_only_strings_longer_than_eight_characters() {
|
||||||
|
assert_eq!(abbreviate_string("12345678"), "12345678");
|
||||||
|
assert_eq!(abbreviate_string("123456789"), "1234...6789");
|
||||||
|
assert_eq!(abbreviate_string("YWJjZGVmZ2hpag=="), "YWJj...ag==");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! log_cv {
|
macro_rules! log_cv {
|
||||||
($kind:expr, $cv:expr) => {
|
($kind:expr, $cv:expr) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue