From 005dadb342c6a79d154d3eaf5a5fbb86f3a7e641 Mon Sep 17 00:00:00 2001 From: Matthieu Date: Tue, 12 Oct 2021 22:51:30 +0400 Subject: [PATCH] tests, cleanup & rest base --- BUILD | 6 +- Cargo.lock | 384 ++++++------------ Cargo.toml | 10 +- Makefile | 3 - WORKSPACE | 2 - cargo/crates.bzl | 361 ++++++---------- cargo/remote/BUILD.async-stream-0.3.2.bazel | 65 --- .../BUILD.async-stream-impl-0.3.2.bazel | 56 --- ....3.bazel => BUILD.crypto-mac-0.10.1.bazel} | 7 +- ....bazel => BUILD.foreign-types-0.3.2.bazel} | 7 +- ...=> BUILD.foreign-types-shared-0.1.1.bazel} | 6 +- ...ut-1.1.1.bazel => BUILD.hmac-0.10.1.bazel} | 10 +- ....4.1.bazel => BUILD.hyper-tls-0.5.0.bazel} | 9 +- cargo/remote/BUILD.itertools-0.10.1.bazel | 99 ----- cargo/remote/BUILD.native-tls-0.2.8.bazel | 177 ++++++++ ....8.0.bazel => BUILD.openssl-0.10.36.bazel} | 32 +- ...3.bazel => BUILD.openssl-sys-0.9.67.bazel} | 76 ++-- cargo/remote/BUILD.petgraph-0.5.1.bazel | 79 ---- cargo/remote/BUILD.prost-0.8.0.bazel | 62 --- cargo/remote/BUILD.prost-derive-0.8.0.bazel | 58 --- cargo/remote/BUILD.prost-types-0.8.0.bazel | 55 --- cargo/remote/BUILD.rand-0.8.4.bazel | 1 - .../BUILD.security-framework-sys-2.4.2.bazel | 1 + cargo/remote/BUILD.sha2-0.9.6.bazel | 2 + ...azel => BUILD.testcontainers-0.12.0.bazel} | 21 +- .../remote/BUILD.tokio-native-tls-0.3.0.bazel | 105 +++++ cargo/remote/BUILD.tokio-stream-0.1.7.bazel | 84 ---- cargo/remote/BUILD.tonic-0.5.2.bazel | 96 ----- cargo/remote/BUILD.tonic-build-0.5.2.bazel | 60 --- cargo/remote/BUILD.tower-0.4.8.bazel | 110 ----- cargo/remote/BUILD.tower-layer-0.3.1.bazel | 53 --- cargo/remote/BUILD.tracing-0.1.26.bazel | 8 - .../BUILD.tracing-attributes-0.1.15.bazel | 74 ---- .../remote/BUILD.tracing-futures-0.2.5.bazel | 63 --- ...p-0.8.3.bazel => BUILD.vcpkg-0.2.15.bazel} | 4 +- cargo/remote/BUILD.which-4.2.2.bazel | 68 ---- common/rust/Cargo.toml | 3 +- common/rust/cargo/BUILD.bazel | 9 + common/rust/src/config.rs | 10 +- common/rust/src/lib.rs | 7 + common/rust/src/monitoring.rs | 35 +- common/rust/src/nats.rs | 34 +- common/rust/src/payloads.rs | 2 - common/version.go.in | 3 + config/default.json | 17 + docker-compose.yaml | 7 +- docs/docusaurus.config.js | 2 +- gateway/Cargo.toml | 6 +- gateway/README.md | 3 - gateway/cargo/BUILD.bazel | 9 - gateway/config/default.toml | 12 - gateway/src/connection/stream.rs | 2 +- gateway/src/connection/utils.rs | 2 +- gateway/src/management/mod.rs | 0 gateway/src/payloads/events/resume.rs | 0 gateway/src/shard/actions.rs | 2 +- gateway/src/shard/connection.rs | 6 +- novactl/README.md | 3 - ratelimiter/BUILD | 36 -- ratelimiter/Cargo.toml | 20 - ratelimiter/README.md | 5 - ratelimiter/build.rs | 4 - ratelimiter/proto/BUILD.bazel | 26 -- .../proto/nova.ratelimit.v1alpha.proto | 39 -- ratelimiter/src/main.rs | 45 -- rest/BUILD | 24 ++ rest/Cargo.toml | 14 + rest/cargo/BUILD.bazel | 58 +++ rest/src/config.rs | 18 + rest/src/main.rs | 35 ++ rest/src/proxy/mod.rs | 74 ++++ webhook/Cargo.toml | 6 +- webhook/README.md | 0 webhook/cargo/BUILD.bazel | 26 +- webhook/src/handler/handler.rs | 16 +- webhook/src/handler/make_service.rs | 2 +- webhook/src/handler/mod.rs | 3 +- webhook/src/handler/tests/handler.rs | 174 ++++++++ webhook/src/handler/tests/mod.rs | 1 + webhook/src/main.rs | 11 +- 80 files changed, 1132 insertions(+), 1993 deletions(-) delete mode 100644 cargo/remote/BUILD.async-stream-0.3.2.bazel delete mode 100644 cargo/remote/BUILD.async-stream-impl-0.3.2.bazel rename cargo/remote/{BUILD.heck-0.3.3.bazel => BUILD.crypto-mac-0.10.1.bazel} (86%) rename cargo/remote/{BUILD.fixedbitset-0.2.0.bazel => BUILD.foreign-types-0.3.2.bazel} (89%) rename cargo/remote/{BUILD.either-1.6.1.bazel => BUILD.foreign-types-shared-0.1.1.bazel} (92%) rename cargo/remote/{BUILD.tokio-io-timeout-1.1.1.bazel => BUILD.hmac-0.10.1.bazel} (83%) rename cargo/remote/{BUILD.hyper-timeout-0.4.1.bazel => BUILD.hyper-tls-0.5.0.bazel} (85%) delete mode 100644 cargo/remote/BUILD.itertools-0.10.1.bazel create mode 100644 cargo/remote/BUILD.native-tls-0.2.8.bazel rename cargo/remote/{BUILD.prost-build-0.8.0.bazel => BUILD.openssl-0.10.36.bazel} (70%) rename cargo/remote/{BUILD.anyhow-1.0.43.bazel => BUILD.openssl-sys-0.9.67.bazel} (54%) delete mode 100644 cargo/remote/BUILD.petgraph-0.5.1.bazel delete mode 100644 cargo/remote/BUILD.prost-0.8.0.bazel delete mode 100644 cargo/remote/BUILD.prost-derive-0.8.0.bazel delete mode 100644 cargo/remote/BUILD.prost-types-0.8.0.bazel rename cargo/remote/{BUILD.unicode-segmentation-1.8.0.bazel => BUILD.testcontainers-0.12.0.bazel} (68%) create mode 100644 cargo/remote/BUILD.tokio-native-tls-0.3.0.bazel delete mode 100644 cargo/remote/BUILD.tokio-stream-0.1.7.bazel delete mode 100644 cargo/remote/BUILD.tonic-0.5.2.bazel delete mode 100644 cargo/remote/BUILD.tonic-build-0.5.2.bazel delete mode 100644 cargo/remote/BUILD.tower-0.4.8.bazel delete mode 100644 cargo/remote/BUILD.tower-layer-0.3.1.bazel delete mode 100644 cargo/remote/BUILD.tracing-attributes-0.1.15.bazel delete mode 100644 cargo/remote/BUILD.tracing-futures-0.2.5.bazel rename cargo/remote/{BUILD.multimap-0.8.3.bazel => BUILD.vcpkg-0.2.15.bazel} (95%) delete mode 100644 cargo/remote/BUILD.which-4.2.2.bazel create mode 100644 config/default.json delete mode 100644 gateway/README.md delete mode 100644 gateway/config/default.toml delete mode 100644 gateway/src/management/mod.rs delete mode 100644 gateway/src/payloads/events/resume.rs delete mode 100644 novactl/README.md delete mode 100644 ratelimiter/BUILD delete mode 100644 ratelimiter/Cargo.toml delete mode 100644 ratelimiter/README.md delete mode 100644 ratelimiter/build.rs delete mode 100644 ratelimiter/proto/BUILD.bazel delete mode 100644 ratelimiter/proto/nova.ratelimit.v1alpha.proto delete mode 100644 ratelimiter/src/main.rs create mode 100644 rest/BUILD create mode 100644 rest/Cargo.toml create mode 100644 rest/cargo/BUILD.bazel create mode 100644 rest/src/config.rs create mode 100644 rest/src/main.rs create mode 100644 rest/src/proxy/mod.rs delete mode 100644 webhook/README.md create mode 100644 webhook/src/handler/tests/handler.rs create mode 100644 webhook/src/handler/tests/mod.rs diff --git a/BUILD b/BUILD index ec32785..c486575 100644 --- a/BUILD +++ b/BUILD @@ -14,7 +14,7 @@ filegroup( "//cache", "//gateway", "//novactl", - "//ratelimiter", + "//rest", "//webhook", ], ) @@ -24,7 +24,7 @@ container_bundle( images = { "ghcr.io/discordnova/nova/novactl:$(docker_tag)": "//novactl:image", "ghcr.io/discordnova/nova/gateway:$(docker_tag)": "//gateway:image", - "ghcr.io/discordnova/nova/ratelimiter:$(docker_tag)": "//ratelimiter:image", + "ghcr.io/discordnova/nova/rest:$(docker_tag)": "//rest:image", "ghcr.io/discordnova/nova/webhook:$(docker_tag)": "//webhook:image", "ghcr.io/discordnova/nova/cache:$(docker_tag)": "//cache:image", }, @@ -41,7 +41,7 @@ test_suite( tests = [ "//gateway:tests", "//novactl:tests", - "//ratelimiter:tests", + "//rest:tests", "//webhook:tests", ], ) diff --git a/Cargo.lock b/Cargo.lock index 0696dd6..df69d5a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11,12 +11,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "anyhow" -version = "1.0.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28ae2b3dec75a406790005a200b1bd89785afc02517a00ca99ecfe093ee9e6cf" - [[package]] name = "arrayvec" version = "0.5.2" @@ -34,27 +28,6 @@ dependencies = [ "futures-core", ] -[[package]] -name = "async-stream" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "171374e7e3b2504e0e5236e3b59260560f9fe94bfe9ac39ba5e4e929c5590625" -dependencies = [ - "async-stream-impl", - "futures-core", -] - -[[package]] -name = "async-stream-impl" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "648ed8c8d2ce5409ccd57453d9d1b214b342a0d69376a6feda1fd6cae3299308" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "async-task" version = "4.0.3" @@ -222,6 +195,7 @@ dependencies = [ "pretty_env_logger", "prometheus", "serde 1.0.130", + "testcontainers", "tokio", ] @@ -295,6 +269,16 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "crypto-mac" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bff07008ec701e8028e2ceb8f83f0e4274ee62bd2dbdc4fefff2e9a91824081a" +dependencies = [ + "generic-array", + "subtle", +] + [[package]] name = "curve25519-dalek" version = "3.2.0" @@ -350,12 +334,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "either" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" - [[package]] name = "enumflags2" version = "0.7.1" @@ -405,18 +383,27 @@ dependencies = [ "instant", ] -[[package]] -name = "fixedbitset" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d" - [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "form_urlencoded" version = "1.0.1" @@ -544,7 +531,6 @@ dependencies = [ "enumflags2", "futures", "futures-util", - "log", "num", "num-derive", "num-traits 0.2.14", @@ -613,15 +599,6 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" -[[package]] -name = "heck" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] - [[package]] name = "hermit-abi" version = "0.1.19" @@ -637,6 +614,16 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hmac" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15" +dependencies = [ + "crypto-mac", + "digest", +] + [[package]] name = "http" version = "0.2.4" @@ -705,15 +692,16 @@ dependencies = [ ] [[package]] -name = "hyper-timeout" -version = "0.4.1" +name = "hyper-tls" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ + "bytes", "hyper", - "pin-project-lite", + "native-tls", "tokio", - "tokio-io-timeout", + "tokio-native-tls", ] [[package]] @@ -746,15 +734,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "itertools" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf" -dependencies = [ - "either", -] - [[package]] name = "itoa" version = "0.4.8" @@ -872,10 +851,22 @@ dependencies = [ ] [[package]] -name = "multimap" -version = "0.8.3" +name = "native-tls" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" +checksum = "48ba9f7719b5a0f42f338907614285fb5fd70e53858141f69898a1fb7203b24d" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] [[package]] name = "nats" @@ -1076,12 +1067,39 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +[[package]] +name = "openssl" +version = "0.10.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d9facdb76fec0b73c406f125d44d86fdad818d66fef0531eec9233ca425ff4a" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-sys", +] + [[package]] name = "openssl-probe" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a" +[[package]] +name = "openssl-sys" +version = "0.9.67" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69df2d8dfc6ce3aaf44b40dec6f487d5a886516cf6879c49e98e0710f310a058" +dependencies = [ + "autocfg", + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "parking" version = "2.0.0" @@ -1119,16 +1137,6 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" -[[package]] -name = "petgraph" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7" -dependencies = [ - "fixedbitset", - "indexmap", -] - [[package]] name = "pin-project" version = "1.0.8" @@ -1219,57 +1227,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "prost" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de5e2533f59d08fcf364fd374ebda0692a70bd6d7e66ef97f306f45c6c5d8020" -dependencies = [ - "bytes", - "prost-derive", -] - -[[package]] -name = "prost-build" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "355f634b43cdd80724ee7848f95770e7e70eefa6dcf14fea676216573b8fd603" -dependencies = [ - "bytes", - "heck", - "itertools", - "log", - "multimap", - "petgraph", - "prost", - "prost-types", - "tempfile", - "which", -] - -[[package]] -name = "prost-derive" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "600d2f334aa05acb02a755e217ef1ab6dea4d51b58b7846588b747edec04efba" -dependencies = [ - "anyhow", - "itertools", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "prost-types" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "603bbd6394701d13f3f25aada59c7de9d35a6a5887cfc156181234a44002771b" -dependencies = [ - "bytes", - "prost", -] - [[package]] name = "protobuf" version = "2.25.1" @@ -1423,13 +1380,15 @@ dependencies = [ ] [[package]] -name = "rest-ratelimiter" +name = "rest" version = "0.1.0" dependencies = [ - "prost", + "common", + "futures-util", + "hyper", + "hyper-tls", + "serde 1.0.130", "tokio", - "tonic", - "tonic-build", ] [[package]] @@ -1756,6 +1715,21 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "testcontainers" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5e3ed6e3598dbf32cba8cb356b881c085e0adea57597f387723430dd94b4084" +dependencies = [ + "hex", + "hmac", + "log", + "rand 0.8.4", + "serde 1.0.130", + "serde_json", + "sha2", +] + [[package]] name = "thiserror" version = "1.0.29" @@ -1822,16 +1796,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "tokio-io-timeout" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90c49f106be240de154571dd31fbe48acb10ba6c6dd6f6517ad603abffa42de9" -dependencies = [ - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-macros" version = "1.3.0" @@ -1844,25 +1808,24 @@ dependencies = [ ] [[package]] -name = "tokio-rustls" -version = "0.22.0" +name = "tokio-native-tls" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" +checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" dependencies = [ - "rustls", + "native-tls", "tokio", - "webpki", ] [[package]] -name = "tokio-stream" -version = "0.1.7" +name = "tokio-rustls" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b2f3f698253f03119ac0102beaa64f67a67e08074d03a22d18784104543727f" +checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" dependencies = [ - "futures-core", - "pin-project-lite", + "rustls", "tokio", + "webpki", ] [[package]] @@ -1905,75 +1868,6 @@ dependencies = [ "serde 1.0.130", ] -[[package]] -name = "tonic" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "796c5e1cd49905e65dd8e700d4cb1dffcbfdb4fc9d017de08c1a537afd83627c" -dependencies = [ - "async-stream", - "async-trait", - "base64", - "bytes", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "hyper", - "hyper-timeout", - "percent-encoding", - "pin-project", - "prost", - "prost-derive", - "tokio", - "tokio-stream", - "tokio-util", - "tower", - "tower-layer", - "tower-service", - "tracing", - "tracing-futures", -] - -[[package]] -name = "tonic-build" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12b52d07035516c2b74337d2ac7746075e7dcae7643816c1b12c5ff8a7484c08" -dependencies = [ - "proc-macro2", - "prost-build", - "quote", - "syn", -] - -[[package]] -name = "tower" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f60422bc7fefa2f3ec70359b8ff1caff59d785877eb70595904605bcc412470f" -dependencies = [ - "futures-core", - "futures-util", - "indexmap", - "pin-project", - "rand 0.8.4", - "slab", - "tokio", - "tokio-stream", - "tokio-util", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "tower-layer" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "343bc9466d3fe6b0f960ef45960509f84480bf4fd96f92901afe7ff3df9d3a62" - [[package]] name = "tower-service" version = "0.3.1" @@ -1987,23 +1881,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09adeb8c97449311ccd28a427f96fb563e7fd31aabf994189879d9da2394b89d" dependencies = [ "cfg-if", - "log", "pin-project-lite", - "tracing-attributes", "tracing-core", ] -[[package]] -name = "tracing-attributes" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c42e6fa53307c8a17e4ccd4dc81cf5ec38db9209f59b222210375b54ee40d1e2" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "tracing-core" version = "0.1.19" @@ -2013,16 +1894,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "tracing-futures" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" -dependencies = [ - "pin-project", - "tracing", -] - [[package]] name = "try-lock" version = "0.2.3" @@ -2072,12 +1943,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-segmentation" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" - [[package]] name = "unicode-xid" version = "0.2.2" @@ -2108,6 +1973,12 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version_check" version = "0.9.3" @@ -2222,12 +2093,10 @@ name = "webhook" version = "0.1.0" dependencies = [ "common", - "config", "hex", "hyper", + "libc", "libsodium-sys", - "log", - "nats", "serde 1.0.130", "serde_json", "tokio", @@ -2252,17 +2121,6 @@ dependencies = [ "webpki", ] -[[package]] -name = "which" -version = "4.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea187a8ef279bc014ec368c27a920da2024d2a711109bfbe3440585d5cf27ad9" -dependencies = [ - "either", - "lazy_static", - "libc", -] - [[package]] name = "winapi" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index 8bee6e4..87ebe39 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,10 +2,10 @@ members = [ "webhook", - "ratelimiter", "gateway", "cache", - "common/rust" + "common/rust", + "rest" ] [package] @@ -50,4 +50,8 @@ buildrs_additional_environment_variables = { PATH = "/usr/sbin:/usr/bin:/sbin:/b compile_data_attr = "glob([\"*/**\"])" additional_build_file = "bazel/patch/BUILD_script_patch" gen_buildrs = false -additional_deps = [":libsodium_sys_build_script"] \ No newline at end of file +additional_deps = [":libsodium_sys_build_script"] + + +[package.metadata.raze.crates.value-bag.'*'] +gen_buildrs = false \ No newline at end of file diff --git a/Makefile b/Makefile index 663502f..d938a86 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,3 @@ .PHONY: gazelle gazelle: bazel run //:gazelle -- update-repos -build_file_name BUILD.bazel -from_file=go.mod -to_macro=deps.bzl%go_dependencies - -.PHONY: docs -docs: diff --git a/WORKSPACE b/WORKSPACE index bdc8b17..d4aab8c 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1,6 +1,4 @@ workspace(name = "nova") - -#@unused load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( diff --git a/cargo/crates.bzl b/cargo/crates.bzl index 6bfcdb6..2d934cc 100644 --- a/cargo/crates.bzl +++ b/cargo/crates.bzl @@ -12,12 +12,10 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") # buildifier: di # EXPERIMENTAL -- MAY CHANGE AT ANY TIME: A mapping of package names to a set of normal dependencies for the Rust targets of that package. _DEPENDENCIES = { "webhook": { - "config": "@raze__config__0_11_0//:config", "hex": "@raze__hex__0_4_3//:hex", "hyper": "@raze__hyper__0_14_12//:hyper", + "libc": "@raze__libc__0_2_101//:libc", "libsodium-sys": "@raze__libsodium_sys__0_2_7//:libsodium_sys", - "log": "@raze__log__0_4_14//:log", - "nats": "@raze__nats__0_15_2//:nats", "serde": "@raze__serde__1_0_130//:serde", "serde_json": "@raze__serde_json__1_0_67//:serde_json", "tokio": "@raze__tokio__1_11_0//:tokio", @@ -30,18 +28,13 @@ _DEPENDENCIES = { "pretty_env_logger": "@raze__pretty_env_logger__0_4_0//:pretty_env_logger", "prometheus": "@raze__prometheus__0_12_0//:prometheus", "serde": "@raze__serde__1_0_130//:serde", + "testcontainers": "@raze__testcontainers__0_12_0//:testcontainers", "tokio": "@raze__tokio__1_11_0//:tokio", }, - "ratelimiter": { - "prost": "@raze__prost__0_8_0//:prost", - "tokio": "@raze__tokio__1_11_0//:tokio", - "tonic": "@raze__tonic__0_5_2//:tonic", - }, "gateway": { "enumflags2": "@raze__enumflags2__0_7_1//:enumflags2", "futures": "@raze__futures__0_3_17//:futures", "futures-util": "@raze__futures_util__0_3_17//:futures_util", - "log": "@raze__log__0_4_14//:log", "num": "@raze__num__0_4_0//:num", "num-traits": "@raze__num_traits__0_2_14//:num_traits", "serde": "@raze__serde__1_0_130//:serde", @@ -57,6 +50,13 @@ _DEPENDENCIES = { "serde": "@raze__serde__1_0_130//:serde", "serde_json": "@raze__serde_json__1_0_67//:serde_json", }, + "rest": { + "futures-util": "@raze__futures_util__0_3_17//:futures_util", + "hyper": "@raze__hyper__0_14_12//:hyper", + "hyper-tls": "@raze__hyper_tls__0_5_0//:hyper_tls", + "serde": "@raze__serde__1_0_130//:serde", + "tokio": "@raze__tokio__1_11_0//:tokio", + }, "": { "libc": "@raze__libc__0_2_101//:libc", }, @@ -68,14 +68,14 @@ _PROC_MACRO_DEPENDENCIES = { }, "common/rust": { }, - "ratelimiter": { - }, "gateway": { "num-derive": "@raze__num_derive__0_3_3//:num_derive", "serde_repr": "@raze__serde_repr__0_1_7//:serde_repr", }, "cache": { }, + "rest": { + }, "": { }, } @@ -86,13 +86,12 @@ _DEV_DEPENDENCIES = { }, "common/rust": { }, - "ratelimiter": { - "tonic-build": "@raze__tonic_build__0_5_2//:tonic_build", - }, "gateway": { }, "cache": { }, + "rest": { + }, "": { }, } @@ -103,12 +102,12 @@ _DEV_PROC_MACRO_DEPENDENCIES = { }, "common/rust": { }, - "ratelimiter": { - }, "gateway": { }, "cache": { }, + "rest": { + }, "": { }, } @@ -258,16 +257,6 @@ def raze_fetch_remote_crates(): build_file = Label("//cargo/remote:BUILD.aho-corasick-0.7.18.bazel"), ) - maybe( - http_archive, - name = "raze__anyhow__1_0_43", - url = "https://crates.io/api/v1/crates/anyhow/1.0.43/download", - type = "tar.gz", - sha256 = "28ae2b3dec75a406790005a200b1bd89785afc02517a00ca99ecfe093ee9e6cf", - strip_prefix = "anyhow-1.0.43", - build_file = Label("//cargo/remote:BUILD.anyhow-1.0.43.bazel"), - ) - maybe( http_archive, name = "raze__arrayvec__0_5_2", @@ -288,26 +277,6 @@ def raze_fetch_remote_crates(): build_file = Label("//cargo/remote:BUILD.async-channel-1.6.1.bazel"), ) - maybe( - http_archive, - name = "raze__async_stream__0_3_2", - url = "https://crates.io/api/v1/crates/async-stream/0.3.2/download", - type = "tar.gz", - sha256 = "171374e7e3b2504e0e5236e3b59260560f9fe94bfe9ac39ba5e4e929c5590625", - strip_prefix = "async-stream-0.3.2", - build_file = Label("//cargo/remote:BUILD.async-stream-0.3.2.bazel"), - ) - - maybe( - http_archive, - name = "raze__async_stream_impl__0_3_2", - url = "https://crates.io/api/v1/crates/async-stream-impl/0.3.2/download", - type = "tar.gz", - sha256 = "648ed8c8d2ce5409ccd57453d9d1b214b342a0d69376a6feda1fd6cae3299308", - strip_prefix = "async-stream-impl-0.3.2", - build_file = Label("//cargo/remote:BUILD.async-stream-impl-0.3.2.bazel"), - ) - maybe( http_archive, name = "raze__async_task__4_0_3", @@ -558,6 +527,16 @@ def raze_fetch_remote_crates(): build_file = Label("//cargo/remote:BUILD.crossbeam-utils-0.8.5.bazel"), ) + maybe( + http_archive, + name = "raze__crypto_mac__0_10_1", + url = "https://crates.io/api/v1/crates/crypto-mac/0.10.1/download", + type = "tar.gz", + sha256 = "bff07008ec701e8028e2ceb8f83f0e4274ee62bd2dbdc4fefff2e9a91824081a", + strip_prefix = "crypto-mac-0.10.1", + build_file = Label("//cargo/remote:BUILD.crypto-mac-0.10.1.bazel"), + ) + maybe( http_archive, name = "raze__curve25519_dalek__3_2_0", @@ -618,16 +597,6 @@ def raze_fetch_remote_crates(): build_file = Label("//cargo/remote:BUILD.ed25519-dalek-1.0.1.bazel"), ) - maybe( - http_archive, - name = "raze__either__1_6_1", - url = "https://crates.io/api/v1/crates/either/1.6.1/download", - type = "tar.gz", - sha256 = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457", - strip_prefix = "either-1.6.1", - build_file = Label("//cargo/remote:BUILD.either-1.6.1.bazel"), - ) - maybe( http_archive, name = "raze__enumflags2__0_7_1", @@ -678,16 +647,6 @@ def raze_fetch_remote_crates(): build_file = Label("//cargo/remote:BUILD.fastrand-1.5.0.bazel"), ) - maybe( - http_archive, - name = "raze__fixedbitset__0_2_0", - url = "https://crates.io/api/v1/crates/fixedbitset/0.2.0/download", - type = "tar.gz", - sha256 = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d", - strip_prefix = "fixedbitset-0.2.0", - build_file = Label("//cargo/remote:BUILD.fixedbitset-0.2.0.bazel"), - ) - maybe( http_archive, name = "raze__fnv__1_0_7", @@ -698,6 +657,26 @@ def raze_fetch_remote_crates(): build_file = Label("//cargo/remote:BUILD.fnv-1.0.7.bazel"), ) + maybe( + http_archive, + name = "raze__foreign_types__0_3_2", + url = "https://crates.io/api/v1/crates/foreign-types/0.3.2/download", + type = "tar.gz", + sha256 = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1", + strip_prefix = "foreign-types-0.3.2", + build_file = Label("//cargo/remote:BUILD.foreign-types-0.3.2.bazel"), + ) + + maybe( + http_archive, + name = "raze__foreign_types_shared__0_1_1", + url = "https://crates.io/api/v1/crates/foreign-types-shared/0.1.1/download", + type = "tar.gz", + sha256 = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b", + strip_prefix = "foreign-types-shared-0.1.1", + build_file = Label("//cargo/remote:BUILD.foreign-types-shared-0.1.1.bazel"), + ) + maybe( http_archive, name = "raze__form_urlencoded__1_0_1", @@ -858,16 +837,6 @@ def raze_fetch_remote_crates(): build_file = Label("//cargo/remote:BUILD.hashbrown-0.11.2.bazel"), ) - maybe( - http_archive, - name = "raze__heck__0_3_3", - url = "https://crates.io/api/v1/crates/heck/0.3.3/download", - type = "tar.gz", - sha256 = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c", - strip_prefix = "heck-0.3.3", - build_file = Label("//cargo/remote:BUILD.heck-0.3.3.bazel"), - ) - maybe( http_archive, name = "raze__hermit_abi__0_1_19", @@ -888,6 +857,16 @@ def raze_fetch_remote_crates(): build_file = Label("//cargo/remote:BUILD.hex-0.4.3.bazel"), ) + maybe( + http_archive, + name = "raze__hmac__0_10_1", + url = "https://crates.io/api/v1/crates/hmac/0.10.1/download", + type = "tar.gz", + sha256 = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15", + strip_prefix = "hmac-0.10.1", + build_file = Label("//cargo/remote:BUILD.hmac-0.10.1.bazel"), + ) + maybe( http_archive, name = "raze__http__0_2_4", @@ -950,12 +929,12 @@ def raze_fetch_remote_crates(): maybe( http_archive, - name = "raze__hyper_timeout__0_4_1", - url = "https://crates.io/api/v1/crates/hyper-timeout/0.4.1/download", + name = "raze__hyper_tls__0_5_0", + url = "https://crates.io/api/v1/crates/hyper-tls/0.5.0/download", type = "tar.gz", - sha256 = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1", - strip_prefix = "hyper-timeout-0.4.1", - build_file = Label("//cargo/remote:BUILD.hyper-timeout-0.4.1.bazel"), + sha256 = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905", + strip_prefix = "hyper-tls-0.5.0", + build_file = Label("//cargo/remote:BUILD.hyper-tls-0.5.0.bazel"), ) maybe( @@ -988,16 +967,6 @@ def raze_fetch_remote_crates(): build_file = Label("//cargo/remote:BUILD.instant-0.1.10.bazel"), ) - maybe( - http_archive, - name = "raze__itertools__0_10_1", - url = "https://crates.io/api/v1/crates/itertools/0.10.1/download", - type = "tar.gz", - sha256 = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf", - strip_prefix = "itertools-0.10.1", - build_file = Label("//cargo/remote:BUILD.itertools-0.10.1.bazel"), - ) - maybe( http_archive, name = "raze__itoa__0_4_8", @@ -1140,12 +1109,12 @@ def raze_fetch_remote_crates(): maybe( http_archive, - name = "raze__multimap__0_8_3", - url = "https://crates.io/api/v1/crates/multimap/0.8.3/download", + name = "raze__native_tls__0_2_8", + url = "https://crates.io/api/v1/crates/native-tls/0.2.8/download", type = "tar.gz", - sha256 = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a", - strip_prefix = "multimap-0.8.3", - build_file = Label("//cargo/remote:BUILD.multimap-0.8.3.bazel"), + sha256 = "48ba9f7719b5a0f42f338907614285fb5fd70e53858141f69898a1fb7203b24d", + strip_prefix = "native-tls-0.2.8", + build_file = Label("//cargo/remote:BUILD.native-tls-0.2.8.bazel"), ) maybe( @@ -1318,6 +1287,16 @@ def raze_fetch_remote_crates(): build_file = Label("//cargo/remote:BUILD.opaque-debug-0.3.0.bazel"), ) + maybe( + http_archive, + name = "raze__openssl__0_10_36", + url = "https://crates.io/api/v1/crates/openssl/0.10.36/download", + type = "tar.gz", + sha256 = "8d9facdb76fec0b73c406f125d44d86fdad818d66fef0531eec9233ca425ff4a", + strip_prefix = "openssl-0.10.36", + build_file = Label("//cargo/remote:BUILD.openssl-0.10.36.bazel"), + ) + maybe( http_archive, name = "raze__openssl_probe__0_1_4", @@ -1328,6 +1307,16 @@ def raze_fetch_remote_crates(): build_file = Label("//cargo/remote:BUILD.openssl-probe-0.1.4.bazel"), ) + maybe( + http_archive, + name = "raze__openssl_sys__0_9_67", + url = "https://crates.io/api/v1/crates/openssl-sys/0.9.67/download", + type = "tar.gz", + sha256 = "69df2d8dfc6ce3aaf44b40dec6f487d5a886516cf6879c49e98e0710f310a058", + strip_prefix = "openssl-sys-0.9.67", + build_file = Label("//cargo/remote:BUILD.openssl-sys-0.9.67.bazel"), + ) + maybe( http_archive, name = "raze__parking__2_0_0", @@ -1368,16 +1357,6 @@ def raze_fetch_remote_crates(): build_file = Label("//cargo/remote:BUILD.percent-encoding-2.1.0.bazel"), ) - maybe( - http_archive, - name = "raze__petgraph__0_5_1", - url = "https://crates.io/api/v1/crates/petgraph/0.5.1/download", - type = "tar.gz", - sha256 = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7", - strip_prefix = "petgraph-0.5.1", - build_file = Label("//cargo/remote:BUILD.petgraph-0.5.1.bazel"), - ) - maybe( http_archive, name = "raze__pin_project__1_0_8", @@ -1488,46 +1467,6 @@ def raze_fetch_remote_crates(): build_file = Label("//cargo/remote:BUILD.prometheus-0.12.0.bazel"), ) - maybe( - http_archive, - name = "raze__prost__0_8_0", - url = "https://crates.io/api/v1/crates/prost/0.8.0/download", - type = "tar.gz", - sha256 = "de5e2533f59d08fcf364fd374ebda0692a70bd6d7e66ef97f306f45c6c5d8020", - strip_prefix = "prost-0.8.0", - build_file = Label("//cargo/remote:BUILD.prost-0.8.0.bazel"), - ) - - maybe( - http_archive, - name = "raze__prost_build__0_8_0", - url = "https://crates.io/api/v1/crates/prost-build/0.8.0/download", - type = "tar.gz", - sha256 = "355f634b43cdd80724ee7848f95770e7e70eefa6dcf14fea676216573b8fd603", - strip_prefix = "prost-build-0.8.0", - build_file = Label("//cargo/remote:BUILD.prost-build-0.8.0.bazel"), - ) - - maybe( - http_archive, - name = "raze__prost_derive__0_8_0", - url = "https://crates.io/api/v1/crates/prost-derive/0.8.0/download", - type = "tar.gz", - sha256 = "600d2f334aa05acb02a755e217ef1ab6dea4d51b58b7846588b747edec04efba", - strip_prefix = "prost-derive-0.8.0", - build_file = Label("//cargo/remote:BUILD.prost-derive-0.8.0.bazel"), - ) - - maybe( - http_archive, - name = "raze__prost_types__0_8_0", - url = "https://crates.io/api/v1/crates/prost-types/0.8.0/download", - type = "tar.gz", - sha256 = "603bbd6394701d13f3f25aada59c7de9d35a6a5887cfc156181234a44002771b", - strip_prefix = "prost-types-0.8.0", - build_file = Label("//cargo/remote:BUILD.prost-types-0.8.0.bazel"), - ) - maybe( http_archive, name = "raze__protobuf__2_25_1", @@ -2028,6 +1967,16 @@ def raze_fetch_remote_crates(): build_file = Label("//cargo/remote:BUILD.termcolor-1.1.2.bazel"), ) + maybe( + http_archive, + name = "raze__testcontainers__0_12_0", + url = "https://crates.io/api/v1/crates/testcontainers/0.12.0/download", + type = "tar.gz", + sha256 = "d5e3ed6e3598dbf32cba8cb356b881c085e0adea57597f387723430dd94b4084", + strip_prefix = "testcontainers-0.12.0", + build_file = Label("//cargo/remote:BUILD.testcontainers-0.12.0.bazel"), + ) + maybe( http_archive, name = "raze__thiserror__1_0_29", @@ -2088,16 +2037,6 @@ def raze_fetch_remote_crates(): build_file = Label("//cargo/remote:BUILD.tokio-1.11.0.bazel"), ) - maybe( - http_archive, - name = "raze__tokio_io_timeout__1_1_1", - url = "https://crates.io/api/v1/crates/tokio-io-timeout/1.1.1/download", - type = "tar.gz", - sha256 = "90c49f106be240de154571dd31fbe48acb10ba6c6dd6f6517ad603abffa42de9", - strip_prefix = "tokio-io-timeout-1.1.1", - build_file = Label("//cargo/remote:BUILD.tokio-io-timeout-1.1.1.bazel"), - ) - maybe( http_archive, name = "raze__tokio_macros__1_3_0", @@ -2110,22 +2049,22 @@ def raze_fetch_remote_crates(): maybe( http_archive, - name = "raze__tokio_rustls__0_22_0", - url = "https://crates.io/api/v1/crates/tokio-rustls/0.22.0/download", + name = "raze__tokio_native_tls__0_3_0", + url = "https://crates.io/api/v1/crates/tokio-native-tls/0.3.0/download", type = "tar.gz", - sha256 = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6", - strip_prefix = "tokio-rustls-0.22.0", - build_file = Label("//cargo/remote:BUILD.tokio-rustls-0.22.0.bazel"), + sha256 = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b", + strip_prefix = "tokio-native-tls-0.3.0", + build_file = Label("//cargo/remote:BUILD.tokio-native-tls-0.3.0.bazel"), ) maybe( http_archive, - name = "raze__tokio_stream__0_1_7", - url = "https://crates.io/api/v1/crates/tokio-stream/0.1.7/download", + name = "raze__tokio_rustls__0_22_0", + url = "https://crates.io/api/v1/crates/tokio-rustls/0.22.0/download", type = "tar.gz", - sha256 = "7b2f3f698253f03119ac0102beaa64f67a67e08074d03a22d18784104543727f", - strip_prefix = "tokio-stream-0.1.7", - build_file = Label("//cargo/remote:BUILD.tokio-stream-0.1.7.bazel"), + sha256 = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6", + strip_prefix = "tokio-rustls-0.22.0", + build_file = Label("//cargo/remote:BUILD.tokio-rustls-0.22.0.bazel"), ) maybe( @@ -2158,46 +2097,6 @@ def raze_fetch_remote_crates(): build_file = Label("//cargo/remote:BUILD.toml-0.5.8.bazel"), ) - maybe( - http_archive, - name = "raze__tonic__0_5_2", - url = "https://crates.io/api/v1/crates/tonic/0.5.2/download", - type = "tar.gz", - sha256 = "796c5e1cd49905e65dd8e700d4cb1dffcbfdb4fc9d017de08c1a537afd83627c", - strip_prefix = "tonic-0.5.2", - build_file = Label("//cargo/remote:BUILD.tonic-0.5.2.bazel"), - ) - - maybe( - http_archive, - name = "raze__tonic_build__0_5_2", - url = "https://crates.io/api/v1/crates/tonic-build/0.5.2/download", - type = "tar.gz", - sha256 = "12b52d07035516c2b74337d2ac7746075e7dcae7643816c1b12c5ff8a7484c08", - strip_prefix = "tonic-build-0.5.2", - build_file = Label("//cargo/remote:BUILD.tonic-build-0.5.2.bazel"), - ) - - maybe( - http_archive, - name = "raze__tower__0_4_8", - url = "https://crates.io/api/v1/crates/tower/0.4.8/download", - type = "tar.gz", - sha256 = "f60422bc7fefa2f3ec70359b8ff1caff59d785877eb70595904605bcc412470f", - strip_prefix = "tower-0.4.8", - build_file = Label("//cargo/remote:BUILD.tower-0.4.8.bazel"), - ) - - maybe( - http_archive, - name = "raze__tower_layer__0_3_1", - url = "https://crates.io/api/v1/crates/tower-layer/0.3.1/download", - type = "tar.gz", - sha256 = "343bc9466d3fe6b0f960ef45960509f84480bf4fd96f92901afe7ff3df9d3a62", - strip_prefix = "tower-layer-0.3.1", - build_file = Label("//cargo/remote:BUILD.tower-layer-0.3.1.bazel"), - ) - maybe( http_archive, name = "raze__tower_service__0_3_1", @@ -2218,16 +2117,6 @@ def raze_fetch_remote_crates(): build_file = Label("//cargo/remote:BUILD.tracing-0.1.26.bazel"), ) - maybe( - http_archive, - name = "raze__tracing_attributes__0_1_15", - url = "https://crates.io/api/v1/crates/tracing-attributes/0.1.15/download", - type = "tar.gz", - sha256 = "c42e6fa53307c8a17e4ccd4dc81cf5ec38db9209f59b222210375b54ee40d1e2", - strip_prefix = "tracing-attributes-0.1.15", - build_file = Label("//cargo/remote:BUILD.tracing-attributes-0.1.15.bazel"), - ) - maybe( http_archive, name = "raze__tracing_core__0_1_19", @@ -2238,16 +2127,6 @@ def raze_fetch_remote_crates(): build_file = Label("//cargo/remote:BUILD.tracing-core-0.1.19.bazel"), ) - maybe( - http_archive, - name = "raze__tracing_futures__0_2_5", - url = "https://crates.io/api/v1/crates/tracing-futures/0.2.5/download", - type = "tar.gz", - sha256 = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2", - strip_prefix = "tracing-futures-0.2.5", - build_file = Label("//cargo/remote:BUILD.tracing-futures-0.2.5.bazel"), - ) - maybe( http_archive, name = "raze__try_lock__0_2_3", @@ -2298,16 +2177,6 @@ def raze_fetch_remote_crates(): build_file = Label("//cargo/remote:BUILD.unicode-normalization-0.1.19.bazel"), ) - maybe( - http_archive, - name = "raze__unicode_segmentation__1_8_0", - url = "https://crates.io/api/v1/crates/unicode-segmentation/1.8.0/download", - type = "tar.gz", - sha256 = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b", - strip_prefix = "unicode-segmentation-1.8.0", - build_file = Label("//cargo/remote:BUILD.unicode-segmentation-1.8.0.bazel"), - ) - maybe( http_archive, name = "raze__unicode_xid__0_2_2", @@ -2348,6 +2217,16 @@ def raze_fetch_remote_crates(): build_file = Label("//cargo/remote:BUILD.utf-8-0.7.6.bazel"), ) + maybe( + http_archive, + name = "raze__vcpkg__0_2_15", + url = "https://crates.io/api/v1/crates/vcpkg/0.2.15/download", + type = "tar.gz", + sha256 = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426", + strip_prefix = "vcpkg-0.2.15", + build_file = Label("//cargo/remote:BUILD.vcpkg-0.2.15.bazel"), + ) + maybe( http_archive, name = "raze__version_check__0_9_3", @@ -2488,16 +2367,6 @@ def raze_fetch_remote_crates(): build_file = Label("//cargo/remote:BUILD.webpki-roots-0.21.1.bazel"), ) - maybe( - http_archive, - name = "raze__which__4_2_2", - url = "https://crates.io/api/v1/crates/which/4.2.2/download", - type = "tar.gz", - sha256 = "ea187a8ef279bc014ec368c27a920da2024d2a711109bfbe3440585d5cf27ad9", - strip_prefix = "which-4.2.2", - build_file = Label("//cargo/remote:BUILD.which-4.2.2.bazel"), - ) - maybe( http_archive, name = "raze__winapi__0_3_9", diff --git a/cargo/remote/BUILD.async-stream-0.3.2.bazel b/cargo/remote/BUILD.async-stream-0.3.2.bazel deleted file mode 100644 index bfffc1a..0000000 --- a/cargo/remote/BUILD.async-stream-0.3.2.bazel +++ /dev/null @@ -1,65 +0,0 @@ -""" -@generated -cargo-raze crate build file. - -DO NOT EDIT! Replaced on runs of cargo-raze -""" - -# buildifier: disable=load -load("@bazel_skylib//lib:selects.bzl", "selects") - -# buildifier: disable=load -load( - "@rules_rust//rust:rust.bzl", - "rust_binary", - "rust_library", - "rust_test", -) - -package(default_visibility = [ - # Public for visibility by "@raze__crate__version//" targets. - # - # Prefer access through "//cargo", which limits external - # visibility to explicit Cargo.toml dependencies. - "//visibility:public", -]) - -licenses([ - "notice", # MIT from expression "MIT" -]) - -# Generated Targets - -# Unsupported target "tcp_accept" with type "example" omitted - -rust_library( - name = "async_stream", - srcs = glob(["**/*.rs"]), - crate_features = [ - ], - crate_root = "src/lib.rs", - crate_type = "lib", - data = [], - edition = "2018", - proc_macro_deps = [ - "@raze__async_stream_impl__0_3_2//:async_stream_impl", - ], - rustc_flags = [ - "--cap-lints=allow", - ], - tags = [ - "cargo-raze", - "manual", - ], - version = "0.3.2", - # buildifier: leave-alone - deps = [ - "@raze__futures_core__0_3_17//:futures_core", - ], -) - -# Unsupported target "for_await" with type "test" omitted - -# Unsupported target "stream" with type "test" omitted - -# Unsupported target "try_stream" with type "test" omitted diff --git a/cargo/remote/BUILD.async-stream-impl-0.3.2.bazel b/cargo/remote/BUILD.async-stream-impl-0.3.2.bazel deleted file mode 100644 index 1db7cf6..0000000 --- a/cargo/remote/BUILD.async-stream-impl-0.3.2.bazel +++ /dev/null @@ -1,56 +0,0 @@ -""" -@generated -cargo-raze crate build file. - -DO NOT EDIT! Replaced on runs of cargo-raze -""" - -# buildifier: disable=load -load("@bazel_skylib//lib:selects.bzl", "selects") - -# buildifier: disable=load -load( - "@rules_rust//rust:rust.bzl", - "rust_binary", - "rust_library", - "rust_test", -) - -package(default_visibility = [ - # Public for visibility by "@raze__crate__version//" targets. - # - # Prefer access through "//cargo", which limits external - # visibility to explicit Cargo.toml dependencies. - "//visibility:public", -]) - -licenses([ - "notice", # MIT from expression "MIT" -]) - -# Generated Targets - -rust_library( - name = "async_stream_impl", - srcs = glob(["**/*.rs"]), - crate_features = [ - ], - crate_root = "src/lib.rs", - crate_type = "proc-macro", - data = [], - edition = "2018", - rustc_flags = [ - "--cap-lints=allow", - ], - tags = [ - "cargo-raze", - "manual", - ], - version = "0.3.2", - # buildifier: leave-alone - deps = [ - "@raze__proc_macro2__1_0_29//:proc_macro2", - "@raze__quote__1_0_9//:quote", - "@raze__syn__1_0_76//:syn", - ], -) diff --git a/cargo/remote/BUILD.heck-0.3.3.bazel b/cargo/remote/BUILD.crypto-mac-0.10.1.bazel similarity index 86% rename from cargo/remote/BUILD.heck-0.3.3.bazel rename to cargo/remote/BUILD.crypto-mac-0.10.1.bazel index 45ff7e4..5d4c629 100644 --- a/cargo/remote/BUILD.heck-0.3.3.bazel +++ b/cargo/remote/BUILD.crypto-mac-0.10.1.bazel @@ -31,7 +31,7 @@ licenses([ # Generated Targets rust_library( - name = "heck", + name = "crypto_mac", srcs = glob(["**/*.rs"]), crate_features = [ ], @@ -46,9 +46,10 @@ rust_library( "cargo-raze", "manual", ], - version = "0.3.3", + version = "0.10.1", # buildifier: leave-alone deps = [ - "@raze__unicode_segmentation__1_8_0//:unicode_segmentation", + "@raze__generic_array__0_14_4//:generic_array", + "@raze__subtle__2_4_1//:subtle", ], ) diff --git a/cargo/remote/BUILD.fixedbitset-0.2.0.bazel b/cargo/remote/BUILD.foreign-types-0.3.2.bazel similarity index 89% rename from cargo/remote/BUILD.fixedbitset-0.2.0.bazel rename to cargo/remote/BUILD.foreign-types-0.3.2.bazel index 260256f..6ef7960 100644 --- a/cargo/remote/BUILD.fixedbitset-0.2.0.bazel +++ b/cargo/remote/BUILD.foreign-types-0.3.2.bazel @@ -30,10 +30,8 @@ licenses([ # Generated Targets -# Unsupported target "benches" with type "bench" omitted - rust_library( - name = "fixedbitset", + name = "foreign_types", srcs = glob(["**/*.rs"]), crate_features = [ ], @@ -48,8 +46,9 @@ rust_library( "cargo-raze", "manual", ], - version = "0.2.0", + version = "0.3.2", # buildifier: leave-alone deps = [ + "@raze__foreign_types_shared__0_1_1//:foreign_types_shared", ], ) diff --git a/cargo/remote/BUILD.either-1.6.1.bazel b/cargo/remote/BUILD.foreign-types-shared-0.1.1.bazel similarity index 92% rename from cargo/remote/BUILD.either-1.6.1.bazel rename to cargo/remote/BUILD.foreign-types-shared-0.1.1.bazel index 29a576b..c003ce7 100644 --- a/cargo/remote/BUILD.either-1.6.1.bazel +++ b/cargo/remote/BUILD.foreign-types-shared-0.1.1.bazel @@ -31,11 +31,9 @@ licenses([ # Generated Targets rust_library( - name = "either", + name = "foreign_types_shared", srcs = glob(["**/*.rs"]), crate_features = [ - "default", - "use_std", ], crate_root = "src/lib.rs", crate_type = "lib", @@ -48,7 +46,7 @@ rust_library( "cargo-raze", "manual", ], - version = "1.6.1", + version = "0.1.1", # buildifier: leave-alone deps = [ ], diff --git a/cargo/remote/BUILD.tokio-io-timeout-1.1.1.bazel b/cargo/remote/BUILD.hmac-0.10.1.bazel similarity index 83% rename from cargo/remote/BUILD.tokio-io-timeout-1.1.1.bazel rename to cargo/remote/BUILD.hmac-0.10.1.bazel index 33a8951..e129998 100644 --- a/cargo/remote/BUILD.tokio-io-timeout-1.1.1.bazel +++ b/cargo/remote/BUILD.hmac-0.10.1.bazel @@ -31,7 +31,7 @@ licenses([ # Generated Targets rust_library( - name = "tokio_io_timeout", + name = "hmac", srcs = glob(["**/*.rs"]), crate_features = [ ], @@ -46,10 +46,12 @@ rust_library( "cargo-raze", "manual", ], - version = "1.1.1", + version = "0.10.1", # buildifier: leave-alone deps = [ - "@raze__pin_project_lite__0_2_7//:pin_project_lite", - "@raze__tokio__1_11_0//:tokio", + "@raze__crypto_mac__0_10_1//:crypto_mac", + "@raze__digest__0_9_0//:digest", ], ) + +# Unsupported target "lib" with type "test" omitted diff --git a/cargo/remote/BUILD.hyper-timeout-0.4.1.bazel b/cargo/remote/BUILD.hyper-tls-0.5.0.bazel similarity index 85% rename from cargo/remote/BUILD.hyper-timeout-0.4.1.bazel rename to cargo/remote/BUILD.hyper-tls-0.5.0.bazel index 9fc071f..5cfb670 100644 --- a/cargo/remote/BUILD.hyper-timeout-0.4.1.bazel +++ b/cargo/remote/BUILD.hyper-tls-0.5.0.bazel @@ -33,7 +33,7 @@ licenses([ # Unsupported target "client" with type "example" omitted rust_library( - name = "hyper_timeout", + name = "hyper_tls", srcs = glob(["**/*.rs"]), crate_features = [ ], @@ -48,12 +48,13 @@ rust_library( "cargo-raze", "manual", ], - version = "0.4.1", + version = "0.5.0", # buildifier: leave-alone deps = [ + "@raze__bytes__1_1_0//:bytes", "@raze__hyper__0_14_12//:hyper", - "@raze__pin_project_lite__0_2_7//:pin_project_lite", + "@raze__native_tls__0_2_8//:native_tls", "@raze__tokio__1_11_0//:tokio", - "@raze__tokio_io_timeout__1_1_1//:tokio_io_timeout", + "@raze__tokio_native_tls__0_3_0//:tokio_native_tls", ], ) diff --git a/cargo/remote/BUILD.itertools-0.10.1.bazel b/cargo/remote/BUILD.itertools-0.10.1.bazel deleted file mode 100644 index 4b5e5db..0000000 --- a/cargo/remote/BUILD.itertools-0.10.1.bazel +++ /dev/null @@ -1,99 +0,0 @@ -""" -@generated -cargo-raze crate build file. - -DO NOT EDIT! Replaced on runs of cargo-raze -""" - -# buildifier: disable=load -load("@bazel_skylib//lib:selects.bzl", "selects") - -# buildifier: disable=load -load( - "@rules_rust//rust:rust.bzl", - "rust_binary", - "rust_library", - "rust_test", -) - -package(default_visibility = [ - # Public for visibility by "@raze__crate__version//" targets. - # - # Prefer access through "//cargo", which limits external - # visibility to explicit Cargo.toml dependencies. - "//visibility:public", -]) - -licenses([ - "notice", # MIT from expression "MIT OR Apache-2.0" -]) - -# Generated Targets - -# Unsupported target "bench1" with type "bench" omitted - -# Unsupported target "combinations" with type "bench" omitted - -# Unsupported target "combinations_with_replacement" with type "bench" omitted - -# Unsupported target "fold_specialization" with type "bench" omitted - -# Unsupported target "powerset" with type "bench" omitted - -# Unsupported target "tree_fold1" with type "bench" omitted - -# Unsupported target "tuple_combinations" with type "bench" omitted - -# Unsupported target "tuples" with type "bench" omitted - -# Unsupported target "iris" with type "example" omitted - -rust_library( - name = "itertools", - srcs = glob(["**/*.rs"]), - crate_features = [ - "default", - "use_alloc", - "use_std", - ], - crate_root = "src/lib.rs", - crate_type = "lib", - data = [], - edition = "2018", - rustc_flags = [ - "--cap-lints=allow", - ], - tags = [ - "cargo-raze", - "manual", - ], - version = "0.10.1", - # buildifier: leave-alone - deps = [ - "@raze__either__1_6_1//:either", - ], -) - -# Unsupported target "adaptors_no_collect" with type "test" omitted - -# Unsupported target "flatten_ok" with type "test" omitted - -# Unsupported target "fold_specialization" with type "test" omitted - -# Unsupported target "macros_hygiene" with type "test" omitted - -# Unsupported target "merge_join" with type "test" omitted - -# Unsupported target "peeking_take_while" with type "test" omitted - -# Unsupported target "quick" with type "test" omitted - -# Unsupported target "specializations" with type "test" omitted - -# Unsupported target "test_core" with type "test" omitted - -# Unsupported target "test_std" with type "test" omitted - -# Unsupported target "tuples" with type "test" omitted - -# Unsupported target "zip" with type "test" omitted diff --git a/cargo/remote/BUILD.native-tls-0.2.8.bazel b/cargo/remote/BUILD.native-tls-0.2.8.bazel new file mode 100644 index 0000000..cf4a6a5 --- /dev/null +++ b/cargo/remote/BUILD.native-tls-0.2.8.bazel @@ -0,0 +1,177 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +# buildifier: disable=load +load( + "@rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets +# buildifier: disable=out-of-order-load +# buildifier: disable=load-on-top +load( + "@rules_rust//cargo:cargo_build_script.bzl", + "cargo_build_script", +) + +cargo_build_script( + name = "native_tls_build_script", + srcs = glob(["**/*.rs"]), + build_script_env = { + }, + crate_features = [ + ], + crate_root = "build.rs", + data = glob(["**"]), + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.2.8", + visibility = ["//visibility:private"], + deps = [ + ] + selects.with_or({ + # cfg(any(target_os = "macos", target_os = "ios")) + ( + "@rules_rust//rust/platform:aarch64-apple-darwin", + "@rules_rust//rust/platform:aarch64-apple-ios", + "@rules_rust//rust/platform:i686-apple-darwin", + "@rules_rust//rust/platform:x86_64-apple-darwin", + "@rules_rust//rust/platform:x86_64-apple-ios", + ): [ + "@raze__security_framework_sys__2_4_2//:security_framework_sys", + ], + "//conditions:default": [], + }) + selects.with_or({ + # cfg(not(any(target_os = "windows", target_os = "macos", target_os = "ios"))) + ( + "@rules_rust//rust/platform:aarch64-linux-android", + "@rules_rust//rust/platform:aarch64-unknown-linux-gnu", + "@rules_rust//rust/platform:arm-unknown-linux-gnueabi", + "@rules_rust//rust/platform:i686-linux-android", + "@rules_rust//rust/platform:i686-unknown-freebsd", + "@rules_rust//rust/platform:i686-unknown-linux-gnu", + "@rules_rust//rust/platform:powerpc-unknown-linux-gnu", + "@rules_rust//rust/platform:s390x-unknown-linux-gnu", + "@rules_rust//rust/platform:wasm32-unknown-unknown", + "@rules_rust//rust/platform:wasm32-wasi", + "@rules_rust//rust/platform:x86_64-linux-android", + "@rules_rust//rust/platform:x86_64-unknown-freebsd", + "@rules_rust//rust/platform:x86_64-unknown-linux-gnu", + ): [ + "@raze__openssl_sys__0_9_67//:openssl_sys", + ], + "//conditions:default": [], + }) + selects.with_or({ + # cfg(target_os = "windows") + ( + "@rules_rust//rust/platform:i686-pc-windows-msvc", + "@rules_rust//rust/platform:x86_64-pc-windows-msvc", + ): [ + ], + "//conditions:default": [], + }), +) + +# Unsupported target "google-connect" with type "example" omitted + +# Unsupported target "simple-server" with type "example" omitted + +rust_library( + name = "native_tls", + srcs = glob(["**/*.rs"]), + aliases = { + }, + crate_features = [ + ], + crate_root = "src/lib.rs", + crate_type = "lib", + data = [], + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.2.8", + # buildifier: leave-alone + deps = [ + ":native_tls_build_script", + ] + selects.with_or({ + # cfg(any(target_os = "macos", target_os = "ios")) + ( + "@rules_rust//rust/platform:aarch64-apple-darwin", + "@rules_rust//rust/platform:aarch64-apple-ios", + "@rules_rust//rust/platform:i686-apple-darwin", + "@rules_rust//rust/platform:x86_64-apple-darwin", + "@rules_rust//rust/platform:x86_64-apple-ios", + ): [ + "@raze__lazy_static__1_4_0//:lazy_static", + "@raze__libc__0_2_101//:libc", + "@raze__security_framework__2_4_2//:security_framework", + "@raze__security_framework_sys__2_4_2//:security_framework_sys", + "@raze__tempfile__3_2_0//:tempfile", + ], + "//conditions:default": [], + }) + selects.with_or({ + # cfg(not(any(target_os = "windows", target_os = "macos", target_os = "ios"))) + ( + "@rules_rust//rust/platform:aarch64-linux-android", + "@rules_rust//rust/platform:aarch64-unknown-linux-gnu", + "@rules_rust//rust/platform:arm-unknown-linux-gnueabi", + "@rules_rust//rust/platform:i686-linux-android", + "@rules_rust//rust/platform:i686-unknown-freebsd", + "@rules_rust//rust/platform:i686-unknown-linux-gnu", + "@rules_rust//rust/platform:powerpc-unknown-linux-gnu", + "@rules_rust//rust/platform:s390x-unknown-linux-gnu", + "@rules_rust//rust/platform:wasm32-unknown-unknown", + "@rules_rust//rust/platform:wasm32-wasi", + "@rules_rust//rust/platform:x86_64-linux-android", + "@rules_rust//rust/platform:x86_64-unknown-freebsd", + "@rules_rust//rust/platform:x86_64-unknown-linux-gnu", + ): [ + "@raze__log__0_4_14//:log", + "@raze__openssl__0_10_36//:openssl", + "@raze__openssl_probe__0_1_4//:openssl_probe", + "@raze__openssl_sys__0_9_67//:openssl_sys", + ], + "//conditions:default": [], + }) + selects.with_or({ + # cfg(target_os = "windows") + ( + "@rules_rust//rust/platform:i686-pc-windows-msvc", + "@rules_rust//rust/platform:x86_64-pc-windows-msvc", + ): [ + "@raze__schannel__0_1_19//:schannel", + ], + "//conditions:default": [], + }), +) diff --git a/cargo/remote/BUILD.prost-build-0.8.0.bazel b/cargo/remote/BUILD.openssl-0.10.36.bazel similarity index 70% rename from cargo/remote/BUILD.prost-build-0.8.0.bazel rename to cargo/remote/BUILD.openssl-0.10.36.bazel index 998d95e..e70a454 100644 --- a/cargo/remote/BUILD.prost-build-0.8.0.bazel +++ b/cargo/remote/BUILD.openssl-0.10.36.bazel @@ -37,7 +37,7 @@ load( ) cargo_build_script( - name = "prost_build_build_script", + name = "openssl_build_script", srcs = glob(["**/*.rs"]), build_script_env = { }, @@ -53,16 +53,21 @@ cargo_build_script( "cargo-raze", "manual", ], - version = "0.8.0", + version = "0.10.36", visibility = ["//visibility:private"], deps = [ - "@raze__which__4_2_2//:which", + "@raze__openssl_sys__0_9_67//:openssl_sys", ], ) +# Unsupported target "mk_certs" with type "example" omitted + rust_library( - name = "prost_build", + name = "openssl", srcs = glob(["**/*.rs"]), + aliases = { + "@raze__openssl_sys__0_9_67//:openssl_sys": "ffi", + }, crate_features = [ ], crate_root = "src/lib.rs", @@ -76,18 +81,15 @@ rust_library( "cargo-raze", "manual", ], - version = "0.8.0", + version = "0.10.36", # buildifier: leave-alone deps = [ - ":prost_build_build_script", - "@raze__bytes__1_1_0//:bytes", - "@raze__heck__0_3_3//:heck", - "@raze__itertools__0_10_1//:itertools", - "@raze__log__0_4_14//:log", - "@raze__multimap__0_8_3//:multimap", - "@raze__petgraph__0_5_1//:petgraph", - "@raze__prost__0_8_0//:prost", - "@raze__prost_types__0_8_0//:prost_types", - "@raze__tempfile__3_2_0//:tempfile", + ":openssl_build_script", + "@raze__bitflags__1_3_2//:bitflags", + "@raze__cfg_if__1_0_0//:cfg_if", + "@raze__foreign_types__0_3_2//:foreign_types", + "@raze__libc__0_2_101//:libc", + "@raze__once_cell__1_8_0//:once_cell", + "@raze__openssl_sys__0_9_67//:openssl_sys", ], ) diff --git a/cargo/remote/BUILD.anyhow-1.0.43.bazel b/cargo/remote/BUILD.openssl-sys-0.9.67.bazel similarity index 54% rename from cargo/remote/BUILD.anyhow-1.0.43.bazel rename to cargo/remote/BUILD.openssl-sys-0.9.67.bazel index 65e94d6..a97fdb8 100644 --- a/cargo/remote/BUILD.anyhow-1.0.43.bazel +++ b/cargo/remote/BUILD.openssl-sys-0.9.67.bazel @@ -25,7 +25,7 @@ package(default_visibility = [ ]) licenses([ - "notice", # MIT from expression "MIT OR Apache-2.0" + "notice", # MIT from expression "MIT" ]) # Generated Targets @@ -37,17 +37,16 @@ load( ) cargo_build_script( - name = "anyhow_build_script", + name = "openssl_sys_build_script", srcs = glob(["**/*.rs"]), build_script_env = { }, crate_features = [ - "default", - "std", ], - crate_root = "build.rs", + crate_root = "build/main.rs", data = glob(["**"]), - edition = "2018", + edition = "2015", + links = "openssl", rustc_flags = [ "--cap-lints=allow", ], @@ -55,23 +54,35 @@ cargo_build_script( "cargo-raze", "manual", ], - version = "1.0.43", + version = "0.9.67", visibility = ["//visibility:private"], deps = [ - ], + "@raze__autocfg__1_0_1//:autocfg", + "@raze__cc__1_0_70//:cc", + "@raze__pkg_config__0_3_19//:pkg_config", + ] + selects.with_or({ + # cfg(target_env = "msvc") + ( + "@rules_rust//rust/platform:i686-pc-windows-msvc", + "@rules_rust//rust/platform:x86_64-pc-windows-msvc", + ): [ + "@raze__vcpkg__0_2_15//:vcpkg", + ], + "//conditions:default": [], + }), ) rust_library( - name = "anyhow", + name = "openssl_sys", srcs = glob(["**/*.rs"]), + aliases = { + }, crate_features = [ - "default", - "std", ], crate_root = "src/lib.rs", crate_type = "lib", data = [], - edition = "2018", + edition = "2015", rustc_flags = [ "--cap-lints=allow", ], @@ -79,35 +90,18 @@ rust_library( "cargo-raze", "manual", ], - version = "1.0.43", + version = "0.9.67", # buildifier: leave-alone deps = [ - ":anyhow_build_script", - ], + ":openssl_sys_build_script", + "@raze__libc__0_2_101//:libc", + ] + selects.with_or({ + # cfg(target_env = "msvc") + ( + "@rules_rust//rust/platform:i686-pc-windows-msvc", + "@rules_rust//rust/platform:x86_64-pc-windows-msvc", + ): [ + ], + "//conditions:default": [], + }), ) - -# Unsupported target "compiletest" with type "test" omitted - -# Unsupported target "test_autotrait" with type "test" omitted - -# Unsupported target "test_backtrace" with type "test" omitted - -# Unsupported target "test_boxed" with type "test" omitted - -# Unsupported target "test_chain" with type "test" omitted - -# Unsupported target "test_context" with type "test" omitted - -# Unsupported target "test_convert" with type "test" omitted - -# Unsupported target "test_downcast" with type "test" omitted - -# Unsupported target "test_ffi" with type "test" omitted - -# Unsupported target "test_fmt" with type "test" omitted - -# Unsupported target "test_macros" with type "test" omitted - -# Unsupported target "test_repr" with type "test" omitted - -# Unsupported target "test_source" with type "test" omitted diff --git a/cargo/remote/BUILD.petgraph-0.5.1.bazel b/cargo/remote/BUILD.petgraph-0.5.1.bazel deleted file mode 100644 index 0be98f7..0000000 --- a/cargo/remote/BUILD.petgraph-0.5.1.bazel +++ /dev/null @@ -1,79 +0,0 @@ -""" -@generated -cargo-raze crate build file. - -DO NOT EDIT! Replaced on runs of cargo-raze -""" - -# buildifier: disable=load -load("@bazel_skylib//lib:selects.bzl", "selects") - -# buildifier: disable=load -load( - "@rules_rust//rust:rust.bzl", - "rust_binary", - "rust_library", - "rust_test", -) - -package(default_visibility = [ - # Public for visibility by "@raze__crate__version//" targets. - # - # Prefer access through "//cargo", which limits external - # visibility to explicit Cargo.toml dependencies. - "//visibility:public", -]) - -licenses([ - "notice", # MIT from expression "MIT OR Apache-2.0" -]) - -# Generated Targets - -# Unsupported target "dijkstra" with type "bench" omitted - -# Unsupported target "iso" with type "bench" omitted - -# Unsupported target "matrix_graph" with type "bench" omitted - -# Unsupported target "ograph" with type "bench" omitted - -# Unsupported target "stable_graph" with type "bench" omitted - -# Unsupported target "unionfind" with type "bench" omitted - -rust_library( - name = "petgraph", - srcs = glob(["**/*.rs"]), - crate_features = [ - ], - crate_root = "src/lib.rs", - crate_type = "lib", - data = [], - edition = "2018", - rustc_flags = [ - "--cap-lints=allow", - ], - tags = [ - "cargo-raze", - "manual", - ], - version = "0.5.1", - # buildifier: leave-alone - deps = [ - "@raze__fixedbitset__0_2_0//:fixedbitset", - "@raze__indexmap__1_7_0//:indexmap", - ], -) - -# Unsupported target "graph" with type "test" omitted - -# Unsupported target "graphmap" with type "test" omitted - -# Unsupported target "iso" with type "test" omitted - -# Unsupported target "quickcheck" with type "test" omitted - -# Unsupported target "stable_graph" with type "test" omitted - -# Unsupported target "unionfind" with type "test" omitted diff --git a/cargo/remote/BUILD.prost-0.8.0.bazel b/cargo/remote/BUILD.prost-0.8.0.bazel deleted file mode 100644 index 6d99ea1..0000000 --- a/cargo/remote/BUILD.prost-0.8.0.bazel +++ /dev/null @@ -1,62 +0,0 @@ -""" -@generated -cargo-raze crate build file. - -DO NOT EDIT! Replaced on runs of cargo-raze -""" - -# buildifier: disable=load -load("@bazel_skylib//lib:selects.bzl", "selects") - -# buildifier: disable=load -load( - "@rules_rust//rust:rust.bzl", - "rust_binary", - "rust_library", - "rust_test", -) - -package(default_visibility = [ - # Public for visibility by "@raze__crate__version//" targets. - # - # Prefer access through "//cargo", which limits external - # visibility to explicit Cargo.toml dependencies. - "//visibility:public", -]) - -licenses([ - "notice", # Apache-2.0 from expression "Apache-2.0" -]) - -# Generated Targets - -# Unsupported target "varint" with type "bench" omitted - -rust_library( - name = "prost", - srcs = glob(["**/*.rs"]), - crate_features = [ - "default", - "prost-derive", - "std", - ], - crate_root = "src/lib.rs", - crate_type = "lib", - data = [], - edition = "2018", - proc_macro_deps = [ - "@raze__prost_derive__0_8_0//:prost_derive", - ], - rustc_flags = [ - "--cap-lints=allow", - ], - tags = [ - "cargo-raze", - "manual", - ], - version = "0.8.0", - # buildifier: leave-alone - deps = [ - "@raze__bytes__1_1_0//:bytes", - ], -) diff --git a/cargo/remote/BUILD.prost-derive-0.8.0.bazel b/cargo/remote/BUILD.prost-derive-0.8.0.bazel deleted file mode 100644 index e573303..0000000 --- a/cargo/remote/BUILD.prost-derive-0.8.0.bazel +++ /dev/null @@ -1,58 +0,0 @@ -""" -@generated -cargo-raze crate build file. - -DO NOT EDIT! Replaced on runs of cargo-raze -""" - -# buildifier: disable=load -load("@bazel_skylib//lib:selects.bzl", "selects") - -# buildifier: disable=load -load( - "@rules_rust//rust:rust.bzl", - "rust_binary", - "rust_library", - "rust_test", -) - -package(default_visibility = [ - # Public for visibility by "@raze__crate__version//" targets. - # - # Prefer access through "//cargo", which limits external - # visibility to explicit Cargo.toml dependencies. - "//visibility:public", -]) - -licenses([ - "notice", # Apache-2.0 from expression "Apache-2.0" -]) - -# Generated Targets - -rust_library( - name = "prost_derive", - srcs = glob(["**/*.rs"]), - crate_features = [ - ], - crate_root = "src/lib.rs", - crate_type = "proc-macro", - data = [], - edition = "2018", - rustc_flags = [ - "--cap-lints=allow", - ], - tags = [ - "cargo-raze", - "manual", - ], - version = "0.8.0", - # buildifier: leave-alone - deps = [ - "@raze__anyhow__1_0_43//:anyhow", - "@raze__itertools__0_10_1//:itertools", - "@raze__proc_macro2__1_0_29//:proc_macro2", - "@raze__quote__1_0_9//:quote", - "@raze__syn__1_0_76//:syn", - ], -) diff --git a/cargo/remote/BUILD.prost-types-0.8.0.bazel b/cargo/remote/BUILD.prost-types-0.8.0.bazel deleted file mode 100644 index 97de85a..0000000 --- a/cargo/remote/BUILD.prost-types-0.8.0.bazel +++ /dev/null @@ -1,55 +0,0 @@ -""" -@generated -cargo-raze crate build file. - -DO NOT EDIT! Replaced on runs of cargo-raze -""" - -# buildifier: disable=load -load("@bazel_skylib//lib:selects.bzl", "selects") - -# buildifier: disable=load -load( - "@rules_rust//rust:rust.bzl", - "rust_binary", - "rust_library", - "rust_test", -) - -package(default_visibility = [ - # Public for visibility by "@raze__crate__version//" targets. - # - # Prefer access through "//cargo", which limits external - # visibility to explicit Cargo.toml dependencies. - "//visibility:public", -]) - -licenses([ - "notice", # Apache-2.0 from expression "Apache-2.0" -]) - -# Generated Targets - -rust_library( - name = "prost_types", - srcs = glob(["**/*.rs"]), - crate_features = [ - ], - crate_root = "src/lib.rs", - crate_type = "lib", - data = [], - edition = "2018", - rustc_flags = [ - "--cap-lints=allow", - ], - tags = [ - "cargo-raze", - "manual", - ], - version = "0.8.0", - # buildifier: leave-alone - deps = [ - "@raze__bytes__1_1_0//:bytes", - "@raze__prost__0_8_0//:prost", - ], -) diff --git a/cargo/remote/BUILD.rand-0.8.4.bazel b/cargo/remote/BUILD.rand-0.8.4.bazel index 4124443..4d0f4d6 100644 --- a/cargo/remote/BUILD.rand-0.8.4.bazel +++ b/cargo/remote/BUILD.rand-0.8.4.bazel @@ -42,7 +42,6 @@ rust_library( "libc", "rand_chacha", "rand_hc", - "small_rng", "std", "std_rng", ], diff --git a/cargo/remote/BUILD.security-framework-sys-2.4.2.bazel b/cargo/remote/BUILD.security-framework-sys-2.4.2.bazel index 329b304..6d2a230 100644 --- a/cargo/remote/BUILD.security-framework-sys-2.4.2.bazel +++ b/cargo/remote/BUILD.security-framework-sys-2.4.2.bazel @@ -35,6 +35,7 @@ rust_library( srcs = glob(["**/*.rs"]), crate_features = [ "OSX_10_9", + "default", ], crate_root = "src/lib.rs", crate_type = "lib", diff --git a/cargo/remote/BUILD.sha2-0.9.6.bazel b/cargo/remote/BUILD.sha2-0.9.6.bazel index 9ebd0ed..dff9109 100644 --- a/cargo/remote/BUILD.sha2-0.9.6.bazel +++ b/cargo/remote/BUILD.sha2-0.9.6.bazel @@ -44,6 +44,8 @@ rust_library( aliases = { }, crate_features = [ + "default", + "std", ], crate_root = "src/lib.rs", crate_type = "lib", diff --git a/cargo/remote/BUILD.unicode-segmentation-1.8.0.bazel b/cargo/remote/BUILD.testcontainers-0.12.0.bazel similarity index 68% rename from cargo/remote/BUILD.unicode-segmentation-1.8.0.bazel rename to cargo/remote/BUILD.testcontainers-0.12.0.bazel index dec202b..e35b1e5 100644 --- a/cargo/remote/BUILD.unicode-segmentation-1.8.0.bazel +++ b/cargo/remote/BUILD.testcontainers-0.12.0.bazel @@ -30,14 +30,8 @@ licenses([ # Generated Targets -# Unsupported target "graphemes" with type "bench" omitted - -# Unsupported target "unicode_words" with type "bench" omitted - -# Unsupported target "word_bounds" with type "bench" omitted - rust_library( - name = "unicode_segmentation", + name = "testcontainers", srcs = glob(["**/*.rs"]), crate_features = [ ], @@ -52,8 +46,19 @@ rust_library( "cargo-raze", "manual", ], - version = "1.8.0", + version = "0.12.0", # buildifier: leave-alone deps = [ + "@raze__hex__0_4_3//:hex", + "@raze__hmac__0_10_1//:hmac", + "@raze__log__0_4_14//:log", + "@raze__rand__0_8_4//:rand", + "@raze__serde__1_0_130//:serde", + "@raze__serde_json__1_0_67//:serde_json", + "@raze__sha2__0_9_6//:sha2", ], ) + +# Unsupported target "cli_client" with type "test" omitted + +# Unsupported target "images" with type "test" omitted diff --git a/cargo/remote/BUILD.tokio-native-tls-0.3.0.bazel b/cargo/remote/BUILD.tokio-native-tls-0.3.0.bazel new file mode 100644 index 0000000..9f83be1 --- /dev/null +++ b/cargo/remote/BUILD.tokio-native-tls-0.3.0.bazel @@ -0,0 +1,105 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +# buildifier: disable=load +load( + "@rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT" +]) + +# Generated Targets + +# Unsupported target "download-rust-lang" with type "example" omitted + +# Unsupported target "echo" with type "example" omitted + +rust_library( + name = "tokio_native_tls", + srcs = glob(["**/*.rs"]), + aliases = { + }, + crate_features = [ + ], + crate_root = "src/lib.rs", + crate_type = "lib", + data = [], + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.3.0", + # buildifier: leave-alone + deps = [ + "@raze__native_tls__0_2_8//:native_tls", + "@raze__tokio__1_11_0//:tokio", + ] + selects.with_or({ + # cfg(all(not(target_os = "macos"), not(windows), not(target_os = "ios"))) + ( + "@rules_rust//rust/platform:aarch64-linux-android", + "@rules_rust//rust/platform:aarch64-unknown-linux-gnu", + "@rules_rust//rust/platform:arm-unknown-linux-gnueabi", + "@rules_rust//rust/platform:i686-linux-android", + "@rules_rust//rust/platform:i686-unknown-freebsd", + "@rules_rust//rust/platform:i686-unknown-linux-gnu", + "@rules_rust//rust/platform:powerpc-unknown-linux-gnu", + "@rules_rust//rust/platform:s390x-unknown-linux-gnu", + "@rules_rust//rust/platform:wasm32-unknown-unknown", + "@rules_rust//rust/platform:wasm32-wasi", + "@rules_rust//rust/platform:x86_64-linux-android", + "@rules_rust//rust/platform:x86_64-unknown-freebsd", + "@rules_rust//rust/platform:x86_64-unknown-linux-gnu", + ): [ + ], + "//conditions:default": [], + }) + selects.with_or({ + # cfg(any(target_os = "macos", target_os = "ios")) + ( + "@rules_rust//rust/platform:aarch64-apple-darwin", + "@rules_rust//rust/platform:aarch64-apple-ios", + "@rules_rust//rust/platform:i686-apple-darwin", + "@rules_rust//rust/platform:x86_64-apple-darwin", + "@rules_rust//rust/platform:x86_64-apple-ios", + ): [ + ], + "//conditions:default": [], + }) + selects.with_or({ + # cfg(windows) + ( + "@rules_rust//rust/platform:i686-pc-windows-msvc", + "@rules_rust//rust/platform:x86_64-pc-windows-msvc", + ): [ + ], + "//conditions:default": [], + }), +) + +# Unsupported target "bad" with type "test" omitted + +# Unsupported target "google" with type "test" omitted + +# Unsupported target "smoke" with type "test" omitted diff --git a/cargo/remote/BUILD.tokio-stream-0.1.7.bazel b/cargo/remote/BUILD.tokio-stream-0.1.7.bazel deleted file mode 100644 index 5b08034..0000000 --- a/cargo/remote/BUILD.tokio-stream-0.1.7.bazel +++ /dev/null @@ -1,84 +0,0 @@ -""" -@generated -cargo-raze crate build file. - -DO NOT EDIT! Replaced on runs of cargo-raze -""" - -# buildifier: disable=load -load("@bazel_skylib//lib:selects.bzl", "selects") - -# buildifier: disable=load -load( - "@rules_rust//rust:rust.bzl", - "rust_binary", - "rust_library", - "rust_test", -) - -package(default_visibility = [ - # Public for visibility by "@raze__crate__version//" targets. - # - # Prefer access through "//cargo", which limits external - # visibility to explicit Cargo.toml dependencies. - "//visibility:public", -]) - -licenses([ - "notice", # MIT from expression "MIT" -]) - -# Generated Targets - -rust_library( - name = "tokio_stream", - srcs = glob(["**/*.rs"]), - crate_features = [ - "default", - "time", - ], - crate_root = "src/lib.rs", - crate_type = "lib", - data = [], - edition = "2018", - rustc_flags = [ - "--cap-lints=allow", - ], - tags = [ - "cargo-raze", - "manual", - ], - version = "0.1.7", - # buildifier: leave-alone - deps = [ - "@raze__futures_core__0_3_17//:futures_core", - "@raze__pin_project_lite__0_2_7//:pin_project_lite", - "@raze__tokio__1_11_0//:tokio", - ], -) - -# Unsupported target "async_send_sync" with type "test" omitted - -# Unsupported target "stream_chain" with type "test" omitted - -# Unsupported target "stream_collect" with type "test" omitted - -# Unsupported target "stream_empty" with type "test" omitted - -# Unsupported target "stream_fuse" with type "test" omitted - -# Unsupported target "stream_iter" with type "test" omitted - -# Unsupported target "stream_merge" with type "test" omitted - -# Unsupported target "stream_once" with type "test" omitted - -# Unsupported target "stream_pending" with type "test" omitted - -# Unsupported target "stream_stream_map" with type "test" omitted - -# Unsupported target "stream_timeout" with type "test" omitted - -# Unsupported target "time_throttle" with type "test" omitted - -# Unsupported target "watch" with type "test" omitted diff --git a/cargo/remote/BUILD.tonic-0.5.2.bazel b/cargo/remote/BUILD.tonic-0.5.2.bazel deleted file mode 100644 index 9d3e41f..0000000 --- a/cargo/remote/BUILD.tonic-0.5.2.bazel +++ /dev/null @@ -1,96 +0,0 @@ -""" -@generated -cargo-raze crate build file. - -DO NOT EDIT! Replaced on runs of cargo-raze -""" - -# buildifier: disable=load -load("@bazel_skylib//lib:selects.bzl", "selects") - -# buildifier: disable=load -load( - "@rules_rust//rust:rust.bzl", - "rust_binary", - "rust_library", - "rust_test", -) - -package(default_visibility = [ - # Public for visibility by "@raze__crate__version//" targets. - # - # Prefer access through "//cargo", which limits external - # visibility to explicit Cargo.toml dependencies. - "//visibility:public", -]) - -licenses([ - "notice", # MIT from expression "MIT" -]) - -# Generated Targets - -# Unsupported target "decode" with type "bench" omitted - -rust_library( - name = "tonic", - srcs = glob(["**/*.rs"]), - aliases = { - "@raze__prost__0_8_0//:prost": "prost1", - }, - crate_features = [ - "async-trait", - "codegen", - "default", - "h2", - "hyper", - "hyper-timeout", - "prost", - "prost-derive", - "prost1", - "tokio", - "tower", - "tracing-futures", - "transport", - ], - crate_root = "src/lib.rs", - crate_type = "lib", - data = [], - edition = "2018", - proc_macro_deps = [ - "@raze__async_trait__0_1_51//:async_trait", - "@raze__prost_derive__0_8_0//:prost_derive", - ], - rustc_flags = [ - "--cap-lints=allow", - ], - tags = [ - "cargo-raze", - "manual", - ], - version = "0.5.2", - # buildifier: leave-alone - deps = [ - "@raze__async_stream__0_3_2//:async_stream", - "@raze__base64__0_13_0//:base64", - "@raze__bytes__1_1_0//:bytes", - "@raze__futures_core__0_3_17//:futures_core", - "@raze__futures_util__0_3_17//:futures_util", - "@raze__h2__0_3_4//:h2", - "@raze__http__0_2_4//:http", - "@raze__http_body__0_4_3//:http_body", - "@raze__hyper__0_14_12//:hyper", - "@raze__hyper_timeout__0_4_1//:hyper_timeout", - "@raze__percent_encoding__2_1_0//:percent_encoding", - "@raze__pin_project__1_0_8//:pin_project", - "@raze__prost__0_8_0//:prost", - "@raze__tokio__1_11_0//:tokio", - "@raze__tokio_stream__0_1_7//:tokio_stream", - "@raze__tokio_util__0_6_8//:tokio_util", - "@raze__tower__0_4_8//:tower", - "@raze__tower_layer__0_3_1//:tower_layer", - "@raze__tower_service__0_3_1//:tower_service", - "@raze__tracing__0_1_26//:tracing", - "@raze__tracing_futures__0_2_5//:tracing_futures", - ], -) diff --git a/cargo/remote/BUILD.tonic-build-0.5.2.bazel b/cargo/remote/BUILD.tonic-build-0.5.2.bazel deleted file mode 100644 index d2e17b0..0000000 --- a/cargo/remote/BUILD.tonic-build-0.5.2.bazel +++ /dev/null @@ -1,60 +0,0 @@ -""" -@generated -cargo-raze crate build file. - -DO NOT EDIT! Replaced on runs of cargo-raze -""" - -# buildifier: disable=load -load("@bazel_skylib//lib:selects.bzl", "selects") - -# buildifier: disable=load -load( - "@rules_rust//rust:rust.bzl", - "rust_binary", - "rust_library", - "rust_test", -) - -package(default_visibility = [ - # Public for visibility by "@raze__crate__version//" targets. - # - # Prefer access through "//cargo", which limits external - # visibility to explicit Cargo.toml dependencies. - "//visibility:public", -]) - -licenses([ - "notice", # MIT from expression "MIT" -]) - -# Generated Targets - -rust_library( - name = "tonic_build", - srcs = glob(["**/*.rs"]), - crate_features = [ - "prost", - "prost-build", - "transport", - ], - crate_root = "src/lib.rs", - crate_type = "lib", - data = [], - edition = "2018", - rustc_flags = [ - "--cap-lints=allow", - ], - tags = [ - "cargo-raze", - "manual", - ], - version = "0.5.2", - # buildifier: leave-alone - deps = [ - "@raze__proc_macro2__1_0_29//:proc_macro2", - "@raze__prost_build__0_8_0//:prost_build", - "@raze__quote__1_0_9//:quote", - "@raze__syn__1_0_76//:syn", - ], -) diff --git a/cargo/remote/BUILD.tower-0.4.8.bazel b/cargo/remote/BUILD.tower-0.4.8.bazel deleted file mode 100644 index 2fa5af3..0000000 --- a/cargo/remote/BUILD.tower-0.4.8.bazel +++ /dev/null @@ -1,110 +0,0 @@ -""" -@generated -cargo-raze crate build file. - -DO NOT EDIT! Replaced on runs of cargo-raze -""" - -# buildifier: disable=load -load("@bazel_skylib//lib:selects.bzl", "selects") - -# buildifier: disable=load -load( - "@rules_rust//rust:rust.bzl", - "rust_binary", - "rust_library", - "rust_test", -) - -package(default_visibility = [ - # Public for visibility by "@raze__crate__version//" targets. - # - # Prefer access through "//cargo", which limits external - # visibility to explicit Cargo.toml dependencies. - "//visibility:public", -]) - -licenses([ - "notice", # MIT from expression "MIT" -]) - -# Generated Targets - -# Unsupported target "tower-balance" with type "example" omitted - -rust_library( - name = "tower", - srcs = glob(["**/*.rs"]), - crate_features = [ - "balance", - "buffer", - "default", - "discover", - "futures-util", - "indexmap", - "limit", - "load", - "log", - "make", - "rand", - "ready-cache", - "slab", - "timeout", - "tokio", - "tokio-stream", - "tokio-util", - "tracing", - "util", - ], - crate_root = "src/lib.rs", - crate_type = "lib", - data = [], - edition = "2018", - rustc_flags = [ - "--cap-lints=allow", - ], - tags = [ - "cargo-raze", - "manual", - ], - version = "0.4.8", - # buildifier: leave-alone - deps = [ - "@raze__futures_core__0_3_17//:futures_core", - "@raze__futures_util__0_3_17//:futures_util", - "@raze__indexmap__1_7_0//:indexmap", - "@raze__pin_project__1_0_8//:pin_project", - "@raze__rand__0_8_4//:rand", - "@raze__slab__0_4_4//:slab", - "@raze__tokio__1_11_0//:tokio", - "@raze__tokio_stream__0_1_7//:tokio_stream", - "@raze__tokio_util__0_6_8//:tokio_util", - "@raze__tower_layer__0_3_1//:tower_layer", - "@raze__tower_service__0_3_1//:tower_service", - "@raze__tracing__0_1_26//:tracing", - ], -) - -# Unsupported target "balance" with type "test" omitted - -# Unsupported target "buffer" with type "test" omitted - -# Unsupported target "builder" with type "test" omitted - -# Unsupported target "hedge" with type "test" omitted - -# Unsupported target "limit" with type "test" omitted - -# Unsupported target "load_shed" with type "test" omitted - -# Unsupported target "ready_cache" with type "test" omitted - -# Unsupported target "retry" with type "test" omitted - -# Unsupported target "spawn_ready" with type "test" omitted - -# Unsupported target "steer" with type "test" omitted - -# Unsupported target "support" with type "test" omitted - -# Unsupported target "util" with type "test" omitted diff --git a/cargo/remote/BUILD.tower-layer-0.3.1.bazel b/cargo/remote/BUILD.tower-layer-0.3.1.bazel deleted file mode 100644 index f1204c6..0000000 --- a/cargo/remote/BUILD.tower-layer-0.3.1.bazel +++ /dev/null @@ -1,53 +0,0 @@ -""" -@generated -cargo-raze crate build file. - -DO NOT EDIT! Replaced on runs of cargo-raze -""" - -# buildifier: disable=load -load("@bazel_skylib//lib:selects.bzl", "selects") - -# buildifier: disable=load -load( - "@rules_rust//rust:rust.bzl", - "rust_binary", - "rust_library", - "rust_test", -) - -package(default_visibility = [ - # Public for visibility by "@raze__crate__version//" targets. - # - # Prefer access through "//cargo", which limits external - # visibility to explicit Cargo.toml dependencies. - "//visibility:public", -]) - -licenses([ - "notice", # MIT from expression "MIT" -]) - -# Generated Targets - -rust_library( - name = "tower_layer", - srcs = glob(["**/*.rs"]), - crate_features = [ - ], - crate_root = "src/lib.rs", - crate_type = "lib", - data = [], - edition = "2018", - rustc_flags = [ - "--cap-lints=allow", - ], - tags = [ - "cargo-raze", - "manual", - ], - version = "0.3.1", - # buildifier: leave-alone - deps = [ - ], -) diff --git a/cargo/remote/BUILD.tracing-0.1.26.bazel b/cargo/remote/BUILD.tracing-0.1.26.bazel index c66b5dc..b9b15f3 100644 --- a/cargo/remote/BUILD.tracing-0.1.26.bazel +++ b/cargo/remote/BUILD.tracing-0.1.26.bazel @@ -40,19 +40,12 @@ rust_library( aliases = { }, crate_features = [ - "attributes", - "default", - "log", "std", - "tracing-attributes", ], crate_root = "src/lib.rs", crate_type = "lib", data = [], edition = "2018", - proc_macro_deps = [ - "@raze__tracing_attributes__0_1_15//:tracing_attributes", - ], rustc_flags = [ "--cap-lints=allow", ], @@ -64,7 +57,6 @@ rust_library( # buildifier: leave-alone deps = [ "@raze__cfg_if__1_0_0//:cfg_if", - "@raze__log__0_4_14//:log", "@raze__pin_project_lite__0_2_7//:pin_project_lite", "@raze__tracing_core__0_1_19//:tracing_core", ] + selects.with_or({ diff --git a/cargo/remote/BUILD.tracing-attributes-0.1.15.bazel b/cargo/remote/BUILD.tracing-attributes-0.1.15.bazel deleted file mode 100644 index d0d79ee..0000000 --- a/cargo/remote/BUILD.tracing-attributes-0.1.15.bazel +++ /dev/null @@ -1,74 +0,0 @@ -""" -@generated -cargo-raze crate build file. - -DO NOT EDIT! Replaced on runs of cargo-raze -""" - -# buildifier: disable=load -load("@bazel_skylib//lib:selects.bzl", "selects") - -# buildifier: disable=load -load( - "@rules_rust//rust:rust.bzl", - "rust_binary", - "rust_library", - "rust_test", -) - -package(default_visibility = [ - # Public for visibility by "@raze__crate__version//" targets. - # - # Prefer access through "//cargo", which limits external - # visibility to explicit Cargo.toml dependencies. - "//visibility:public", -]) - -licenses([ - "notice", # MIT from expression "MIT" -]) - -# Generated Targets - -rust_library( - name = "tracing_attributes", - srcs = glob(["**/*.rs"]), - crate_features = [ - ], - crate_root = "src/lib.rs", - crate_type = "proc-macro", - data = [], - edition = "2018", - rustc_flags = [ - "--cap-lints=allow", - ], - tags = [ - "cargo-raze", - "manual", - ], - version = "0.1.15", - # buildifier: leave-alone - deps = [ - "@raze__proc_macro2__1_0_29//:proc_macro2", - "@raze__quote__1_0_9//:quote", - "@raze__syn__1_0_76//:syn", - ], -) - -# Unsupported target "async_fn" with type "test" omitted - -# Unsupported target "destructuring" with type "test" omitted - -# Unsupported target "err" with type "test" omitted - -# Unsupported target "fields" with type "test" omitted - -# Unsupported target "instrument" with type "test" omitted - -# Unsupported target "levels" with type "test" omitted - -# Unsupported target "names" with type "test" omitted - -# Unsupported target "support" with type "test" omitted - -# Unsupported target "targets" with type "test" omitted diff --git a/cargo/remote/BUILD.tracing-futures-0.2.5.bazel b/cargo/remote/BUILD.tracing-futures-0.2.5.bazel deleted file mode 100644 index 066b633..0000000 --- a/cargo/remote/BUILD.tracing-futures-0.2.5.bazel +++ /dev/null @@ -1,63 +0,0 @@ -""" -@generated -cargo-raze crate build file. - -DO NOT EDIT! Replaced on runs of cargo-raze -""" - -# buildifier: disable=load -load("@bazel_skylib//lib:selects.bzl", "selects") - -# buildifier: disable=load -load( - "@rules_rust//rust:rust.bzl", - "rust_binary", - "rust_library", - "rust_test", -) - -package(default_visibility = [ - # Public for visibility by "@raze__crate__version//" targets. - # - # Prefer access through "//cargo", which limits external - # visibility to explicit Cargo.toml dependencies. - "//visibility:public", -]) - -licenses([ - "notice", # MIT from expression "MIT" -]) - -# Generated Targets - -rust_library( - name = "tracing_futures", - srcs = glob(["**/*.rs"]), - crate_features = [ - "default", - "pin-project", - "std", - "std-future", - ], - crate_root = "src/lib.rs", - crate_type = "lib", - data = [], - edition = "2018", - rustc_flags = [ - "--cap-lints=allow", - ], - tags = [ - "cargo-raze", - "manual", - ], - version = "0.2.5", - # buildifier: leave-alone - deps = [ - "@raze__pin_project__1_0_8//:pin_project", - "@raze__tracing__0_1_26//:tracing", - ], -) - -# Unsupported target "std_future" with type "test" omitted - -# Unsupported target "support" with type "test" omitted diff --git a/cargo/remote/BUILD.multimap-0.8.3.bazel b/cargo/remote/BUILD.vcpkg-0.2.15.bazel similarity index 95% rename from cargo/remote/BUILD.multimap-0.8.3.bazel rename to cargo/remote/BUILD.vcpkg-0.2.15.bazel index b720afa..fd21e4d 100644 --- a/cargo/remote/BUILD.multimap-0.8.3.bazel +++ b/cargo/remote/BUILD.vcpkg-0.2.15.bazel @@ -31,7 +31,7 @@ licenses([ # Generated Targets rust_library( - name = "multimap", + name = "vcpkg", srcs = glob(["**/*.rs"]), crate_features = [ ], @@ -46,7 +46,7 @@ rust_library( "cargo-raze", "manual", ], - version = "0.8.3", + version = "0.2.15", # buildifier: leave-alone deps = [ ], diff --git a/cargo/remote/BUILD.which-4.2.2.bazel b/cargo/remote/BUILD.which-4.2.2.bazel deleted file mode 100644 index ad77755..0000000 --- a/cargo/remote/BUILD.which-4.2.2.bazel +++ /dev/null @@ -1,68 +0,0 @@ -""" -@generated -cargo-raze crate build file. - -DO NOT EDIT! Replaced on runs of cargo-raze -""" - -# buildifier: disable=load -load("@bazel_skylib//lib:selects.bzl", "selects") - -# buildifier: disable=load -load( - "@rules_rust//rust:rust.bzl", - "rust_binary", - "rust_library", - "rust_test", -) - -package(default_visibility = [ - # Public for visibility by "@raze__crate__version//" targets. - # - # Prefer access through "//cargo", which limits external - # visibility to explicit Cargo.toml dependencies. - "//visibility:public", -]) - -licenses([ - "notice", # MIT from expression "MIT" -]) - -# Generated Targets - -rust_library( - name = "which", - srcs = glob(["**/*.rs"]), - aliases = { - }, - crate_features = [ - ], - crate_root = "src/lib.rs", - crate_type = "lib", - data = [], - edition = "2018", - rustc_flags = [ - "--cap-lints=allow", - ], - tags = [ - "cargo-raze", - "manual", - ], - version = "4.2.2", - # buildifier: leave-alone - deps = [ - "@raze__either__1_6_1//:either", - "@raze__libc__0_2_101//:libc", - ] + selects.with_or({ - # cfg(windows) - ( - "@rules_rust//rust/platform:i686-pc-windows-msvc", - "@rules_rust//rust/platform:x86_64-pc-windows-msvc", - ): [ - "@raze__lazy_static__1_4_0//:lazy_static", - ], - "//conditions:default": [], - }), -) - -# Unsupported target "basic" with type "test" omitted diff --git a/common/rust/Cargo.toml b/common/rust/Cargo.toml index ec81c4b..a373caa 100644 --- a/common/rust/Cargo.toml +++ b/common/rust/Cargo.toml @@ -11,4 +11,5 @@ config = "0.11" hyper = { version = "0.14", features = ["full"] } tokio = { version = "1", features = ["full"] } prometheus = "0.12.0" -nats = "0.15.2" \ No newline at end of file +nats = "0.15.2" +testcontainers = "0.12.0" \ No newline at end of file diff --git a/common/rust/cargo/BUILD.bazel b/common/rust/cargo/BUILD.bazel index f92a2e9..88b84fa 100644 --- a/common/rust/cargo/BUILD.bazel +++ b/common/rust/cargo/BUILD.bazel @@ -75,6 +75,15 @@ alias( ], ) +alias( + name = "testcontainers", + actual = "@raze__testcontainers__0_12_0//:testcontainers", + tags = [ + "cargo-raze", + "manual", + ], +) + alias( name = "tokio", actual = "@raze__tokio__1_11_0//:tokio", diff --git a/common/rust/src/config.rs b/common/rust/src/config.rs index 3dcd72c..c4ad7b0 100644 --- a/common/rust/src/config.rs +++ b/common/rust/src/config.rs @@ -1,5 +1,5 @@ use std::env; -use config::{Config, ConfigError, Environment, File, Source}; +use config::{Config, ConfigError, Environment, File}; use log::info; use serde::Deserialize; @@ -24,6 +24,8 @@ where /// Initializes a new configuration like the other components of nova /// And starts the prometheus metrics server if needed. pub fn new(service_name: &str) -> Result, ConfigError> { + pretty_env_logger::init(); + let mut default = Config::default(); // this file my be shared with all the components default.merge(File::with_name("config/default"))?; @@ -34,17 +36,19 @@ where default.merge(File::with_name("config/local").required(false))?; let env = Environment::with_prefix("NOVA").separator("__"); - println!("{:?}", env.collect()); // we can configure each component using environment variables default.merge(env)?; let mut config: Settings = default.clone().try_into().unwrap(); // try to load the config config.config = default.get::(&service_name).unwrap(); - pretty_env_logger::init(); // start the monitoring system if needed crate::monitoring::start_monitoring(&config.monitoring); Ok(config) } } + +pub fn test_init() { + pretty_env_logger::init(); +} diff --git a/common/rust/src/lib.rs b/common/rust/src/lib.rs index 1125f5a..be3c913 100644 --- a/common/rust/src/lib.rs +++ b/common/rust/src/lib.rs @@ -5,3 +5,10 @@ pub mod monitoring; pub mod nats; pub mod payloads; pub mod error; + +pub use log as log; +pub use serde as serde; +pub use ::config as config_crate; +pub use prometheus as prometheus; +pub use ::nats as nats_crate; +pub use testcontainers as testcontainers; \ No newline at end of file diff --git a/common/rust/src/monitoring.rs b/common/rust/src/monitoring.rs index ded1d95..4bff043 100644 --- a/common/rust/src/monitoring.rs +++ b/common/rust/src/monitoring.rs @@ -1,19 +1,19 @@ use hyper::{ - Response, Body, Request, Server, - header::{CONTENT_TYPE}, + header::CONTENT_TYPE, service::{make_service_fn, service_fn}, + Body, Request, Response, Server, }; -use std::net::ToSocketAddrs; +use log::{error, info}; use prometheus::{Encoder, TextEncoder}; -use log::{info,error}; use serde::Deserialize; +use std::net::ToSocketAddrs; #[derive(Clone, Debug, Deserialize)] /// Options for the monitoring service pub struct MonitoringConfiguration { - enabled: bool, - address: Option, - port: Option, + pub enabled: bool, + pub address: Option, + pub port: Option, } /// Handler for the hyper http server @@ -37,17 +37,18 @@ pub fn start_monitoring(configuration: &MonitoringConfiguration) { let config = configuration.clone(); tokio::task::spawn(async move { if config.enabled { - let address = format!("{}:{}", - config.address.expect("a listening address must be specified for the metrics server"), - config.port.expect("a listening port must be specified for the metrics server") + let address = format!( + "{}:{}", + config + .address + .expect("a listening address must be specified for the metrics server"), + config + .port + .expect("a listening port must be specified for the metrics server") ); info!("Starting monitoring server on {}", address); - - let listen_address = address - .to_socket_addrs() - .unwrap() - .next() - .unwrap(); + + let listen_address = address.to_socket_addrs().unwrap().next().unwrap(); let server = Server::bind(&listen_address).serve(make_service_fn(|_| async { Ok::<_, hyper::Error>(service_fn(serve_metrics)) })); @@ -57,4 +58,4 @@ pub fn start_monitoring(configuration: &MonitoringConfiguration) { } } }); -} \ No newline at end of file +} diff --git a/common/rust/src/nats.rs b/common/rust/src/nats.rs index 437a857..c61aa4c 100644 --- a/common/rust/src/nats.rs +++ b/common/rust/src/nats.rs @@ -1,33 +1,34 @@ -use nats::{Options, Connection}; +use nats::{Connection, Options}; use serde::Deserialize; #[derive(Clone, Debug, Deserialize)] -struct NatsConfigurationClientCert { - cert: String, - key: String +pub struct NatsConfigurationClientCert { + pub cert: String, + pub key: String, } #[derive(Clone, Debug, Deserialize)] -struct NatsConfigurationTls { - mtu: Option, +pub struct NatsConfigurationTls { + pub mtu: Option, } #[derive(Clone, Debug, Deserialize)] pub struct NatsConfiguration { - client_cert: Option, - root_cert: Option>, - jetstream_api_prefix: Option, - max_reconnects: Option, - reconnect_buffer_size: Option, - tls: Option, - client_name: Option, - tls_required: Option, - host: String, + pub client_cert: Option, + pub root_cert: Option>, + pub jetstream_api_prefix: Option, + pub max_reconnects: Option, + pub reconnect_buffer_size: Option, + pub tls: Option, + pub client_name: Option, + pub tls_required: Option, + pub host: String, } +// Allows the configuration to directly create a nats connection impl Into for NatsConfiguration { fn into(self) -> Connection { let mut options = Options::new(); - + if let Some(client_cert) = self.client_cert { options = options.client_cert(client_cert.cert, client_cert.key); } @@ -48,7 +49,6 @@ impl Into for NatsConfiguration { options = options.tls_required(self.tls_required.unwrap_or(false)); options = options.with_name(&self.client_name.unwrap_or("Nova".to_string())); - if let Some(tls) = self.tls { let mut config = nats::rustls::ClientConfig::new(); config.set_mtu(&tls.mtu); diff --git a/common/rust/src/payloads.rs b/common/rust/src/payloads.rs index 2da70e3..c97ac1d 100644 --- a/common/rust/src/payloads.rs +++ b/common/rust/src/payloads.rs @@ -1,8 +1,6 @@ use serde::{Deserialize, Serialize}; use std::fmt::Debug; - - /// Data structure sent to the cache component /// by the gateway & webhook. #[derive(Serialize, Deserialize, Debug)] diff --git a/common/version.go.in b/common/version.go.in index aacaad5..c182605 100644 --- a/common/version.go.in +++ b/common/version.go.in @@ -1,5 +1,8 @@ package common +// This is a file that will be replaced +// by the `version_template` target in bazel + const ( VERSION = "$VERSION" ) diff --git a/config/default.json b/config/default.json new file mode 100644 index 0000000..d30823d --- /dev/null +++ b/config/default.json @@ -0,0 +1,17 @@ +{ + "monitoring": { + "enabled": false + }, + "nats": { + "host": "localhost" + }, + "rest": { + "server": { + "port": 8000, + "address": "0.0.0.0" + }, + "discord": { + "token": "" + } + } +} \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index 3fe92e0..3e8f924 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -2,9 +2,12 @@ version: "3.3" services: nats: image: 'nats' - expose: - - "4222:422" ports: - "8222:8222" - "4222:4222" hostname: nats-server + redis: + image: 'redis' + ports: + - "6379:6379" + hostname: redis diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index 4725367..7bdcc0b 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -22,7 +22,7 @@ const darkCodeTheme = require('prism-react-renderer/themes/dracula'); docs: { sidebarPath: require.resolve('./sidebars.js'), // Please change this to your repo. - editUrl: 'https://github.com/facebook/docusaurus/edit/main/website/docs/', + editUrl: 'https://github.com/discordnova/nova/edit/main/docs/docs/', }, theme: { customCss: require.resolve('./src/css/custom.css'), diff --git a/gateway/Cargo.toml b/gateway/Cargo.toml index 1b8e9ea..4afdbc2 100644 --- a/gateway/Cargo.toml +++ b/gateway/Cargo.toml @@ -5,12 +5,12 @@ edition = "2018" [dependencies] common = { path = "../common/rust" } -tokio = { version = "1", features = ["full"] } tokio-tungstenite = { version = "*", features = ["rustls-tls"] } +tokio = { version = "1", features = ["full"] } + url = "2.2.2" futures-util = "0.3.17" futures = "0.3.17" -log = { version = "0.4", features = ["std"] } serde_json = { version = "1.0" } serde = { version = "1.0", features = ["derive"] } @@ -19,4 +19,4 @@ enumflags2 = { version = "0.7.1", features = ["serde"] } num-traits = "0.2" num-derive = "0.3" -num = "0.4" \ No newline at end of file +num = "0.4" diff --git a/gateway/README.md b/gateway/README.md deleted file mode 100644 index 0f8b76c..0000000 --- a/gateway/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Gateway - -The gateway component managed the connexion with the Discord event gateway using a websocket connexion. \ No newline at end of file diff --git a/gateway/cargo/BUILD.bazel b/gateway/cargo/BUILD.bazel index e85683f..211b096 100644 --- a/gateway/cargo/BUILD.bazel +++ b/gateway/cargo/BUILD.bazel @@ -39,15 +39,6 @@ alias( ], ) -alias( - name = "log", - actual = "@raze__log__0_4_14//:log", - tags = [ - "cargo-raze", - "manual", - ], -) - alias( name = "num", actual = "@raze__num__0_4_0//:num", diff --git a/gateway/config/default.toml b/gateway/config/default.toml deleted file mode 100644 index 4bfac9d..0000000 --- a/gateway/config/default.toml +++ /dev/null @@ -1,12 +0,0 @@ -[monitoring] -enabled = false - -[nats] -host = "localhost" - -[gateway] -max_reconnects = 5 -reconnect_delay_growth_factor = 1.25 -reconnect_delay_minimum = 5000 -reconnect_delay_maximum = 60000 -intents = 32767 diff --git a/gateway/src/connection/stream.rs b/gateway/src/connection/stream.rs index 767feec..5a12daf 100644 --- a/gateway/src/connection/stream.rs +++ b/gateway/src/connection/stream.rs @@ -2,7 +2,7 @@ use crate::{error::GatewayError, payloads::gateway::BaseMessage}; use super::Connection; use futures::{FutureExt, Sink, SinkExt, Stream, StreamExt}; -use log::info; +use common::log::info; use serde::Serialize; use std::{ pin::Pin, diff --git a/gateway/src/connection/utils.rs b/gateway/src/connection/utils.rs index fb07229..bb425da 100644 --- a/gateway/src/connection/utils.rs +++ b/gateway/src/connection/utils.rs @@ -1,6 +1,6 @@ use std::str::from_utf8; use tokio_tungstenite::tungstenite::Message; -use log::info; +use common::log::info; use crate::error::GatewayError; diff --git a/gateway/src/management/mod.rs b/gateway/src/management/mod.rs deleted file mode 100644 index e69de29..0000000 diff --git a/gateway/src/payloads/events/resume.rs b/gateway/src/payloads/events/resume.rs deleted file mode 100644 index e69de29..0000000 diff --git a/gateway/src/shard/actions.rs b/gateway/src/shard/actions.rs index 86e5f98..b6ef038 100644 --- a/gateway/src/shard/actions.rs +++ b/gateway/src/shard/actions.rs @@ -1,7 +1,7 @@ use std::env; use futures::SinkExt; -use log::{debug, error, info}; +use common::log::{debug, error, info}; use serde::Serialize; use serde_json::Value; use std::fmt::Debug; diff --git a/gateway/src/shard/connection.rs b/gateway/src/shard/connection.rs index f31a89b..2f7f2d5 100644 --- a/gateway/src/shard/connection.rs +++ b/gateway/src/shard/connection.rs @@ -7,8 +7,8 @@ use crate::{connection::Connection, error::GatewayError, payloads::{ use super::{state::ConnectionState, ConnectionWithState, Shard}; use futures::StreamExt; -use log::{error, info}; -use tokio::{select, time::{Instant, sleep}}; +use common::{log::{error, info}}; +use tokio::{select, time::{Instant, interval_at, sleep}}; impl Shard { pub async fn start(self: &mut Self) { @@ -159,7 +159,7 @@ impl Shard { info!("Server hello received"); self._util_set_seq(msg.sequence); if let Some(conn) = &mut self.connection { - conn.state.interval = Some(tokio::time::interval_at( + conn.state.interval = Some(interval_at( Instant::now() + Duration::from_millis(msg.data.heartbeat_interval), Duration::from_millis(msg.data.heartbeat_interval), )); diff --git a/novactl/README.md b/novactl/README.md deleted file mode 100644 index 480524a..0000000 --- a/novactl/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Novactl - -Novactl is a simple command-line utility used to interact with your nova projects, and the nova infrastructure. \ No newline at end of file diff --git a/ratelimiter/BUILD b/ratelimiter/BUILD deleted file mode 100644 index eeb957a..0000000 --- a/ratelimiter/BUILD +++ /dev/null @@ -1,36 +0,0 @@ -load("@rules_rust//rust:rust.bzl", "rust_binary") -load("@rules_rust//cargo:cargo_build_script.bzl", "cargo_build_script") -load("//cargo:crates.bzl", "all_crate_deps", "crate_deps") -load("@io_bazel_rules_docker//rust:image.bzl", "rust_image") - -test_suite(name = "tests") - -cargo_build_script( - name = "build_script", - srcs = ["build.rs"], - build_script_env = { - "PROTOC": "$(location @com_google_protobuf//:protoc)", - }, - data = [ - "//ratelimiter/proto:nova.ratelimit.v1alpha.proto", - ] + [ - "@com_google_protobuf//:protoc", - "@com_google_protobuf//:protobuf_headers", - ], - deps = all_crate_deps() + crate_deps(["tonic-build"]), -) - -rust_binary( - name = "ratelimiter", - srcs = ["src/main.rs"], - visibility = ["//visibility:public"], - deps = all_crate_deps() + [":build_script"], -) - -rust_image( - name = "image", - srcs = ["src/main.rs"], - base = "//bazel:base", - visibility = ["//visibility:public"], - deps = all_crate_deps() + [":build_script"], -) diff --git a/ratelimiter/Cargo.toml b/ratelimiter/Cargo.toml deleted file mode 100644 index 873017c..0000000 --- a/ratelimiter/Cargo.toml +++ /dev/null @@ -1,20 +0,0 @@ -[package] -name = "rest-ratelimiter" -version = "0.1.0" -edition = "2018" - -[dependencies] -tonic = "0.5" -prost = "0.8" -tokio = { version = "1", features = ["full"] } - -[[bin]] -name = "rest-ratelimiter" -path = "src/main.rs" - -[build-dependencies] -tonic-build = { version = "0.5", features = ["transport", "prost"], default-features = false } - -[dev-dependencies] -tonic-build = { version = "0.5", features = ["transport", "prost"], default-features = false } - diff --git a/ratelimiter/README.md b/ratelimiter/README.md deleted file mode 100644 index a6e400e..0000000 --- a/ratelimiter/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Ratelimiter - -This is an implementation of the ratelimiting service described in the `proto/nova.ratelimit.v1.proto`. -The library is divied in two part, a Rust library, built as a static library, and a rust executable that implements -the rate limiting algorithm. A FFI interface is exposed by the Rust static library for use in the nova-lite component. \ No newline at end of file diff --git a/ratelimiter/build.rs b/ratelimiter/build.rs deleted file mode 100644 index dad6fbe..0000000 --- a/ratelimiter/build.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() -> Result<(), Box> { - tonic_build::compile_protos("proto/nova.ratelimit.v1alpha.proto").unwrap(); - Ok(()) -} diff --git a/ratelimiter/proto/BUILD.bazel b/ratelimiter/proto/BUILD.bazel deleted file mode 100644 index 364df7e..0000000 --- a/ratelimiter/proto/BUILD.bazel +++ /dev/null @@ -1,26 +0,0 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") -load("@io_bazel_rules_go//go:def.bzl", "go_library") -load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") - -exports_files(["nova.ratelimit.v1alpha.proto"]) - -proto_library( - name = "nova_ratelimit_v1_proto", - srcs = ["nova.ratelimit.v1alpha.proto"], - visibility = ["//visibility:public"], -) - -go_proto_library( - name = "nova_ratelimit_v1_go_proto", - compilers = ["@io_bazel_rules_go//proto:go_grpc"], - importpath = "github.com/discordnova/nova/ratelimiter/proto", - proto = ":nova_ratelimit_v1_proto", - visibility = ["//visibility:public"], -) - -go_library( - name = "proto", - embed = [":nova_ratelimit_v1_go_proto"], - importpath = "github.com/discordnova/nova/ratelimiter/proto", - visibility = ["//visibility:public"], -) diff --git a/ratelimiter/proto/nova.ratelimit.v1alpha.proto b/ratelimiter/proto/nova.ratelimit.v1alpha.proto deleted file mode 100644 index 8ef606f..0000000 --- a/ratelimiter/proto/nova.ratelimit.v1alpha.proto +++ /dev/null @@ -1,39 +0,0 @@ -// How does this works ? -// Every request, the proxy (envoy) requests the rate-limiting service if -// the requested route bucket or global rate-limit is hit. - -syntax = "proto3"; -package nova.ratelimit.v1alpha; - -// The reponse of a RatelimitRequest, it includes the status of the reponse and -// the bucket informations. -message RatelimitResponse { - enum Status { - OK = 0; - RATELIMITED = 1; - GLOBAL_RATELIMITED = 2; - } - Status status = 1; - bool updateAsked = 2; -} - -// Requests the ratelimit status of a route request, it also takes the -// indentifiables of the request in question. -message RatelimitRequest { - string routeName = 1; - repeated string indentifiables = 2; -} - -// Used when "updateAsked" is sed to true -// this means the bucket is unknown to the ratelimit server. -message CreateBucketData { - RatelimitRequest request = 1; - int32 limit = 2; - int32 remaining = 3; - int32 reset = 4; -} - -service RatelimitService { - rpc GetRatelimitStatus (RatelimitRequest) returns (RatelimitResponse); - rpc CreateBucket (CreateBucketData) returns (CreateBucketData); -} \ No newline at end of file diff --git a/ratelimiter/src/main.rs b/ratelimiter/src/main.rs deleted file mode 100644 index 706077f..0000000 --- a/ratelimiter/src/main.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Some implementation of the gRPC service using the shared library. - -pub mod ratelimit_pb { - tonic::include_proto!("nova.ratelimit.v1alpha"); -} - -use ratelimit_pb::ratelimit_service_server::{RatelimitService, RatelimitServiceServer}; -use ratelimit_pb::{CreateBucketData, RatelimitRequest, RatelimitResponse}; -use std::error::Error; -use tonic::transport::Server; -use tonic::{Request, Response, Status}; - -#[derive(Default)] -pub struct MyRatelimitService {} - -#[tonic::async_trait] -impl RatelimitService for MyRatelimitService { - async fn get_ratelimit_status( - &self, - _request: Request, - ) -> Result, Status> { - return Err(Status::not_found("Not implmented")); - } - async fn create_bucket( - &self, - _request: Request, - ) -> Result, Status> { - return Err(tonic::Status::not_found("Not implmented")); - } -} - -#[tokio::main] -async fn main() -> Result<(), Box> { - let addr = "[::1]:50051".parse().unwrap(); - let service = MyRatelimitService::default(); - - println!("GreeterServer listening on {}", addr); - - Server::builder() - .add_service(RatelimitServiceServer::new(service)) - .serve(addr) - .await?; - - Ok(()) -} diff --git a/rest/BUILD b/rest/BUILD new file mode 100644 index 0000000..2487187 --- /dev/null +++ b/rest/BUILD @@ -0,0 +1,24 @@ +load("@rules_rust//rust:rust.bzl", "rust_binary", "rust_test") +load("//cargo:crates.bzl", "all_crate_deps") +load("@io_bazel_rules_docker//rust:image.bzl", "rust_image") + +test_suite(name = "tests") + +rust_binary( + name = "rest", + srcs = glob(["src/**"]), + visibility = ["//visibility:public"], + deps = all_crate_deps() + ["//common/rust:common"], +) + +rust_test( + name = "rest_test", + crate = ":rest", +) + +rust_image( + name = "image", + base = "//bazel:base", + binary = ":rest", + visibility = ["//visibility:public"], +) diff --git a/rest/Cargo.toml b/rest/Cargo.toml new file mode 100644 index 0000000..08e7911 --- /dev/null +++ b/rest/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "rest" +version = "0.1.0" +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +common = { path = "../common/rust" } +hyper = { version = "0.14", features = ["full"] } +tokio = { version = "1", features = ["full"] } +serde = { version = "1.0.8", features = ["derive"] } +futures-util = "0.3.17" +hyper-tls = "0.5.0" diff --git a/rest/cargo/BUILD.bazel b/rest/cargo/BUILD.bazel new file mode 100644 index 0000000..d664b3c --- /dev/null +++ b/rest/cargo/BUILD.bazel @@ -0,0 +1,58 @@ +""" +@generated +cargo-raze generated Bazel file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +package(default_visibility = ["//visibility:public"]) + +licenses([ + "notice", # See individual crates for specific licenses +]) + +# Aliased targets +alias( + name = "futures_util", + actual = "@raze__futures_util__0_3_17//:futures_util", + tags = [ + "cargo-raze", + "manual", + ], +) + +alias( + name = "hyper", + actual = "@raze__hyper__0_14_12//:hyper", + tags = [ + "cargo-raze", + "manual", + ], +) + +alias( + name = "hyper_tls", + actual = "@raze__hyper_tls__0_5_0//:hyper_tls", + tags = [ + "cargo-raze", + "manual", + ], +) + +alias( + name = "serde", + actual = "@raze__serde__1_0_130//:serde", + tags = [ + "cargo-raze", + "manual", + ], +) + +alias( + name = "tokio", + actual = "@raze__tokio__1_11_0//:tokio", + tags = [ + "cargo-raze", + "manual", + ], +) diff --git a/rest/src/config.rs b/rest/src/config.rs new file mode 100644 index 0000000..559929f --- /dev/null +++ b/rest/src/config.rs @@ -0,0 +1,18 @@ +use serde::Deserialize; + +#[derive(Debug, Deserialize, Clone, Default)] +pub struct ServerSettings { + pub port: u16, + pub address: String, +} + +#[derive(Debug, Deserialize, Clone, Default)] +pub struct Discord { + pub token: String +} + +#[derive(Debug, Deserialize, Clone, Default)] +pub struct Config { + pub server: ServerSettings, + pub discord: Discord, +} diff --git a/rest/src/main.rs b/rest/src/main.rs new file mode 100644 index 0000000..703c9f4 --- /dev/null +++ b/rest/src/main.rs @@ -0,0 +1,35 @@ +use std::{convert::Infallible, sync::Arc}; + +use crate::config::Config; +use common::{config::Settings, log::{error, info}}; +use hyper::{server::conn::AddrStream, service::make_service_fn, Server}; +use std::net::ToSocketAddrs; + +use crate::proxy::ServiceProxy; + +mod config; +mod proxy; + +#[tokio::main] +async fn main() { + let settings: Settings = Settings::new("rest").unwrap(); + let config = Arc::new(settings.config); + + let addr = format!("{}:{}", config.server.address, config.server.port) + .to_socket_addrs() + .unwrap() + .next() + .unwrap(); + + let service_fn = make_service_fn(move |_: &AddrStream| { + let service_proxy = ServiceProxy::new(config.clone()); + async move { Ok::<_, Infallible>(service_proxy) } + }); + + let server = Server::bind(&addr).serve(service_fn); + + info!("starting ratelimit server"); + if let Err(e) = server.await { + error!("server error: {}", e); + } +} diff --git a/rest/src/proxy/mod.rs b/rest/src/proxy/mod.rs new file mode 100644 index 0000000..fafbf9a --- /dev/null +++ b/rest/src/proxy/mod.rs @@ -0,0 +1,74 @@ +use crate::config::Config; +use futures_util::future::TryFutureExt; +use hyper::{ + client::HttpConnector, header::HeaderValue, http::uri::Parts, service::Service, Body, Client, + HeaderMap, Request, Response, Uri, +}; +use hyper_tls::HttpsConnector; +use std::{future::Future, pin::Pin, sync::Arc, task::Poll}; + +#[derive(Clone)] +pub struct ServiceProxy { + client: Client>, + config: Arc, +} + +impl Service> for ServiceProxy { + type Response = Response; + type Error = hyper::Error; + type Future = Pin> + Send>>; + + fn poll_ready( + &mut self, + cx: &mut std::task::Context<'_>, + ) -> std::task::Poll> { + match self.client.poll_ready(cx) { + Poll::Ready(Ok(())) => Poll::Ready(Ok(())), + Poll::Ready(Err(e)) => Poll::Ready(Err(e)), + Poll::Pending => Poll::Pending, + } + } + + fn call(&mut self, mut req: Request) -> Self::Future { + let host = "discord.com"; + let mut new_parts = Parts::default(); + + let path = req.uri().path().to_string(); + + new_parts.scheme = Some("https".parse().unwrap()); + new_parts.authority = Some(host.parse().unwrap()); + new_parts.path_and_query = Some(path.parse().unwrap()); + + *req.uri_mut() = Uri::from_parts(new_parts).unwrap(); + + let mut headers = HeaderMap::default(); + + headers.insert("Host", HeaderValue::from_str("discord.com").unwrap()); + headers.insert( + "Authorization", + HeaderValue::from_str(&format!("Bot {}", self.config.discord.token)).unwrap(), + ); + + *req.headers_mut() = headers; + let res = self.client + .request(req) + .map_ok(move |res| { + if let Some(bucket) = res.headers().get("x-ratelimit-bucket") { + + println!("bucket ratelimit! {:?} : {:?}", path, bucket); + } + + res + }); + + return Box::pin(res); + } +} + +impl ServiceProxy { + pub fn new(config: Arc) -> Self { + let https = HttpsConnector::new(); + let client = Client::builder().build::<_, hyper::Body>(https); + ServiceProxy { client, config } + } +} diff --git a/webhook/Cargo.toml b/webhook/Cargo.toml index 045c710..ba0b2f8 100644 --- a/webhook/Cargo.toml +++ b/webhook/Cargo.toml @@ -6,14 +6,12 @@ edition = "2018" [dependencies] hyper = { version = "0.14", features = ["full"] } tokio = { version = "1", features = ["full"] } -log = { version = "0.4", features = ["std"] } -config = "0.11" +common = { path = "../common/rust" } serde = { version = "1.0.8", features = ["derive"] } libsodium-sys = "0.2.7" hex = "0.4.3" serde_json = { version = "1.0" } -common = { path = "../common/rust" } -nats = "0.15.2" +libc = "0.2.101" [[bin]] name = "webhook" diff --git a/webhook/README.md b/webhook/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/webhook/cargo/BUILD.bazel b/webhook/cargo/BUILD.bazel index e035ab6..8eb8336 100644 --- a/webhook/cargo/BUILD.bazel +++ b/webhook/cargo/BUILD.bazel @@ -12,15 +12,6 @@ licenses([ ]) # Aliased targets -alias( - name = "config", - actual = "@raze__config__0_11_0//:config", - tags = [ - "cargo-raze", - "manual", - ], -) - alias( name = "hex", actual = "@raze__hex__0_4_3//:hex", @@ -40,17 +31,8 @@ alias( ) alias( - name = "libsodium_sys", - actual = "@raze__libsodium_sys__0_2_7//:libsodium_sys", - tags = [ - "cargo-raze", - "manual", - ], -) - -alias( - name = "log", - actual = "@raze__log__0_4_14//:log", + name = "libc", + actual = "@raze__libc__0_2_101//:libc", tags = [ "cargo-raze", "manual", @@ -58,8 +40,8 @@ alias( ) alias( - name = "nats", - actual = "@raze__nats__0_15_2//:nats", + name = "libsodium_sys", + actual = "@raze__libsodium_sys__0_2_7//:libsodium_sys", tags = [ "cargo-raze", "manual", diff --git a/webhook/src/handler/handler.rs b/webhook/src/handler/handler.rs index 9545bec..b3dc8a6 100644 --- a/webhook/src/handler/handler.rs +++ b/webhook/src/handler/handler.rs @@ -5,17 +5,10 @@ use hyper::{ service::Service, Body, Method, Request, Response, StatusCode, }; -use log::{error, info, trace}; -use nats::Connection; +use common::log::{error, info, trace}; +use common::nats_crate::Connection; use serde::{Deserialize, Serialize}; -use std::{ - future::Future, - io::{Error, ErrorKind}, - pin::Pin, - str::from_utf8, - sync::Arc, - task::{Context, Poll}, -}; +use std::{future::Future, io::{Error, ErrorKind}, pin::Pin, str::from_utf8, sync::Arc, task::{Context, Poll}, time::Duration}; /// Hyper service used to handle the discord webhooks #[derive(Clone)] @@ -105,13 +98,14 @@ impl Service> for HandlerService { node_id: "".to_string(), span: None, }, + operation: "".to_string(), data: value, }) .unwrap(); match self_clone .nats - .request("nova.cache.dispatch.interaction", payload) + .request_timeout("nova.cache.dispatch.interaction", payload, Duration::from_secs(2)) { Ok(response) => Ok(Response::builder() .header("Content-Type", "application/json") diff --git a/webhook/src/handler/make_service.rs b/webhook/src/handler/make_service.rs index 0778ad0..deeb2fe 100644 --- a/webhook/src/handler/make_service.rs +++ b/webhook/src/handler/make_service.rs @@ -1,7 +1,7 @@ use super::handler::HandlerService; use crate::config::Config; use hyper::service::Service; -use nats::Connection; +use common::nats_crate::Connection; use std::{ future::{ready, Ready}, sync::Arc, diff --git a/webhook/src/handler/mod.rs b/webhook/src/handler/mod.rs index 490c580..598906b 100644 --- a/webhook/src/handler/mod.rs +++ b/webhook/src/handler/mod.rs @@ -1,4 +1,5 @@ pub mod make_service; mod signature; mod handler; -mod types; \ No newline at end of file +mod types; +pub mod tests; \ No newline at end of file diff --git a/webhook/src/handler/tests/handler.rs b/webhook/src/handler/tests/handler.rs new file mode 100644 index 0000000..3e5ccd0 --- /dev/null +++ b/webhook/src/handler/tests/handler.rs @@ -0,0 +1,174 @@ +fn generate_keypair() -> ( + String, + [u8; libsodium_sys::crypto_sign_ed25519_SECRETKEYBYTES as usize], +) { + use libsodium_sys::crypto_sign_ed25519_keypair; + let pk_s: String; + + let mut pk = [0; libsodium_sys::crypto_sign_ed25519_PUBLICKEYBYTES as usize]; + let mut sk = [0; libsodium_sys::crypto_sign_ed25519_SECRETKEYBYTES as usize]; + + let pk_p = pk.as_mut_ptr(); + let sk_p = sk.as_mut_ptr(); + + // generate keypair + unsafe { + if crypto_sign_ed25519_keypair(pk_p, sk_p) < 0 { + panic!("keypair generation failed!"); + } + }; + + pk_s = hex::encode(pk); + return (pk_s, sk); +} + +fn sign_message( + msg: Vec, + sk: [u8; libsodium_sys::crypto_sign_ed25519_SECRETKEYBYTES as usize], +) -> String { + use libc::c_ulonglong; + use libsodium_sys::crypto_sign_ed25519_detached; + + let len = msg.len(); + let mut signature_len: c_ulonglong = 0; + let mut str = [0; 64]; + unsafe { + crypto_sign_ed25519_detached( + str.as_mut_ptr(), + &mut signature_len, + msg.as_ptr(), + len as u64, + sk.as_ptr(), + ); + }; + + return hex::encode(str); +} + +#[tokio::test] +async fn respond_to_pings_and_deny_invalid() { + use crate::start; + use common::config::test_init; + use common::config::Settings; + use common::log::info; + use common::testcontainers::images::generic::GenericImage; + use common::testcontainers::Docker; + use hyper::{Body, Method, Request}; + use libsodium_sys::sodium_init; + use serde_json::json; + use std::time::Duration; + + test_init(); + + unsafe { + if sodium_init() < 0 { + panic!("libsodium init error!"); + } + } + + let (private_key, secret_key) = generate_keypair(); + let ping = json!({ "type": 1 }).to_string(); + let timestamp = "my datetime :)"; + let signature_data = [timestamp.as_bytes().to_vec(), ping.as_bytes().to_vec()].concat(); + let signature = sign_message(signature_data, secret_key); + + // start nats + let docker = common::testcontainers::clients::Cli::default(); + let image = GenericImage::new("nats"); + let node = docker.run(image); + node.start(); + let port = node.get_host_port(4222).unwrap(); + + let settings: Settings = common::config::Settings { + config: crate::config::Config { + server: crate::config::ServerSettings { + port: 5003, + address: "0.0.0.0".to_string(), + }, + discord: crate::config::Discord { + public_key: private_key, + client_id: 0, + }, + }, + monitoring: common::monitoring::MonitoringConfiguration { + enabled: false, + address: None, + port: None, + }, + nats: common::nats::NatsConfiguration { + client_cert: None, + root_cert: None, + jetstream_api_prefix: None, + max_reconnects: None, + reconnect_buffer_size: None, + tls: None, + client_name: None, + tls_required: None, + host: format!("localhost:{}", port), + }, + }; + + let nats: common::nats_crate::Connection = settings.nats.clone().into(); + // start the server + tokio::task::spawn(start(settings)); + tokio::time::sleep(Duration::from_secs(1)).await; + + let req = Request::builder() + .method(Method::POST) + .uri("http://localhost:5003/") + .header("X-Signature-Ed25519", signature) + .header("X-Signature-Timestamp", timestamp) + .body(Body::from(ping.clone())) + .expect("request builder"); + let client = hyper::client::Client::new(); + let result = client.request(req).await.unwrap(); + assert!(result.status() == 200); + + let req = Request::builder() + .method(Method::POST) + .uri("http://localhost:5003/") + .header("X-Signature-Ed25519", "inva&lid signature :)") + .header("X-Signature-Timestamp", timestamp) + .body(Body::from(ping.clone())) + .expect("request builder"); + let client = hyper::client::Client::new(); + let result = client.request(req).await.unwrap(); + assert!(result.status() == 401); + + // setup nats mock listener + let sub = nats.subscribe("nova.cache.dispatch.interaction").unwrap(); + + let ping = json!({ "type": 0 }).to_string(); + let timestamp = "my datetime :)"; + let signature_data = [timestamp.as_bytes().to_vec(), ping.as_bytes().to_vec()].concat(); + let signature = sign_message(signature_data, secret_key); + + // we must timeout + let req = Request::builder() + .method(Method::POST) + .uri("http://localhost:5003/") + .header("X-Signature-Ed25519", signature.clone()) + .header("X-Signature-Timestamp", timestamp) + .body(Body::from(ping.clone())) + .expect("request builder"); + let client = hyper::client::Client::new(); + let result = client.request(req).await.unwrap(); + assert!(result.status() == 500); + + sub.with_handler(move |msg| { + info!("Received {}", &msg); + msg.respond("ok :)").unwrap(); + Ok(()) + }); + + let req = Request::builder() + .method(Method::POST) + .uri("http://localhost:5003/") + .header("X-Signature-Ed25519", signature.clone()) + .header("X-Signature-Timestamp", timestamp) + .body(Body::from(ping.clone())) + .expect("request builder"); + let client = hyper::client::Client::new(); + let result = client.request(req).await.unwrap(); + assert!(result.status() == 200); +} diff --git a/webhook/src/handler/tests/mod.rs b/webhook/src/handler/tests/mod.rs new file mode 100644 index 0000000..ef7d850 --- /dev/null +++ b/webhook/src/handler/tests/mod.rs @@ -0,0 +1 @@ +pub mod handler; \ No newline at end of file diff --git a/webhook/src/main.rs b/webhook/src/main.rs index 6ea22fc..b213e9d 100644 --- a/webhook/src/main.rs +++ b/webhook/src/main.rs @@ -5,14 +5,16 @@ use crate::handler::make_service::MakeSvc; use crate::config::Config; use common::config::Settings; +use common::log::{error, info}; use hyper::Server; -use log::{error, info}; #[tokio::main] async fn main() { let settings: Settings = Settings::new("webhook").unwrap(); - println!("{:?}", settings); + start(settings).await; +} +async fn start(settings: Settings) { let addr = format!( "{}:{}", settings.config.server.address, settings.config.server.port @@ -27,12 +29,13 @@ async fn main() { settings.config.server.address, settings.config.server.port ); + let config = Arc::new(settings.config); let server = Server::bind(&addr).serve(MakeSvc { - settings: settings.config.clone(), + settings: config, nats: Arc::new(settings.nats.into()), }); if let Err(e) = server.await { - error!("server error: {}", e); + panic!("server error: {}", e); } } -- 2.39.5