From ba5c9a8515b1f9488bae4d50b8f4c5574f1f25ea Mon Sep 17 00:00:00 2001 From: Matthieu Date: Sun, 26 Sep 2021 19:08:40 +0400 Subject: NovaCtl cluster command & control proto --- common/rust/src/error.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common/rust/src') diff --git a/common/rust/src/error.rs b/common/rust/src/error.rs index b602940..be1607a 100644 --- a/common/rust/src/error.rs +++ b/common/rust/src/error.rs @@ -7,6 +7,6 @@ pub struct NovaError { impl fmt::Display for NovaError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "An error occured wihind the nova system: {}", self.message) // user-facing output + write!(f, "An error occurred within the nova system: {}", self.message) // user-facing output } } -- cgit v1.2.3 From 4a08838b902d7f7c0c4daec5fe121707d794ec6e Mon Sep 17 00:00:00 2001 From: Matthieu Date: Sat, 2 Oct 2021 16:40:48 +0400 Subject: fix: unable to set nested variables --- common/rust/src/config.rs | 14 +++++++++----- webhook/config/default.yaml | 13 +++++++++++++ webhook/src/main.rs | 22 +++++++++++++--------- 3 files changed, 35 insertions(+), 14 deletions(-) create mode 100644 webhook/config/default.yaml (limited to 'common/rust/src') diff --git a/common/rust/src/config.rs b/common/rust/src/config.rs index c158a21..d4437a9 100644 --- a/common/rust/src/config.rs +++ b/common/rust/src/config.rs @@ -1,9 +1,8 @@ use std::env; -use config::{Config, ConfigError, Environment, File}; +use config::{Config, ConfigError, Environment, File, Source}; use log::info; -use serde::{Deserialize}; - +use serde::Deserialize; #[derive(Debug, Deserialize, Clone)] #[serde(bound(deserialize = "T: Deserialize<'de> + std::default::Default + Clone"))] @@ -14,7 +13,10 @@ pub struct Settings { pub nats: crate::nats::NatsConfiguration, } -impl Settings where T: Deserialize<'static> + std::default::Default + Clone { +impl Settings +where + T: Deserialize<'static> + std::default::Default + Clone, +{ pub fn new(service_name: &str) -> Result, ConfigError> { let mut default = Config::default(); // this file my be shared with all the components @@ -25,8 +27,10 @@ impl Settings where T: Deserialize<'static> + std::default::Default + Clon default.merge(File::with_name(&format!("config/{}", mode)).required(false))?; 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(Environment::with_prefix("NOVA").separator("_"))?; + default.merge(env)?; let mut config: Settings = default.clone().try_into().unwrap(); // try to load the config diff --git a/webhook/config/default.yaml b/webhook/config/default.yaml new file mode 100644 index 0000000..7f88e6f --- /dev/null +++ b/webhook/config/default.yaml @@ -0,0 +1,13 @@ +monitoring: + enabled: true + address: "0.0.0.0" + port: 5000 +nats: + host: "nova-infra-nats" +webhook: + server: + port: 8080 + address: "0.0.0.0" + discord: + client_id: 0 + public_key: "" \ No newline at end of file diff --git a/webhook/src/main.rs b/webhook/src/main.rs index c127c2c..6ea22fc 100644 --- a/webhook/src/main.rs +++ b/webhook/src/main.rs @@ -1,22 +1,26 @@ use std::{net::ToSocketAddrs, sync::Arc}; -mod handler; mod config; +mod handler; use crate::handler::make_service::MakeSvc; -use hyper::Server; -use log::{info, error}; -use common::config::Settings; use crate::config::Config; +use common::config::Settings; +use hyper::Server; +use log::{error, info}; #[tokio::main] async fn main() { let settings: Settings = Settings::new("webhook").unwrap(); + println!("{:?}", settings); - let addr = format!("{}:{}", settings.config.server.address, settings.config.server.port) - .to_socket_addrs() - .unwrap() - .next() - .unwrap(); + let addr = format!( + "{}:{}", + settings.config.server.address, settings.config.server.port + ) + .to_socket_addrs() + .unwrap() + .next() + .unwrap(); info!( "Starting server on {}:{}", -- cgit v1.2.3 From a02b25f235ba6eff33c6fd965c97071d5f112b6d Mon Sep 17 00:00:00 2001 From: Matthieu Date: Fri, 8 Oct 2021 14:48:39 +0400 Subject: changes in the proto names, and new spec for nats --- Makefile | 6 +- WORKSPACE | 13 +- cache/cargo/BUILD.bazel | 58 +++++++ common/management/BUILD.bazel | 10 +- common/management/nova.management.v1alpha.proto | 2 +- common/management/rpc/BUILD.bazel | 25 +++ .../rpc/nova.management.rpc.v1alpha.proto | 3 +- common/rust/cargo/BUILD.bazel | 85 ++++++++++ common/rust/src/config.rs | 8 +- common/rust/src/lib.rs | 6 +- common/rust/src/nats.rs | 1 - common/rust/src/payloads.rs | 23 ++- deps.bzl | 184 ++++++++++++++++----- docs/docs/intro.md | 2 +- gateway/cargo/BUILD.bazel | 130 +++++++++++++++ gateway/src/payloads/gateway.rs | 62 ++++--- go.mod | 6 +- go.sum | 105 ++++++++++++ ratelimiter/BUILD | 2 +- ratelimiter/build.rs | 4 +- ratelimiter/proto/BUILD.bazel | 4 +- ratelimiter/proto/nova.ratelimit.v1alpha.proto | 2 +- ratelimiter/src/main.rs | 20 +-- webhook/cargo/BUILD.bazel | 94 +++++++++++ webhook/src/config.rs | 2 +- webhook/src/handler/handler.rs | 70 ++++---- webhook/src/handler/make_service.rs | 13 +- 27 files changed, 791 insertions(+), 149 deletions(-) create mode 100644 cache/cargo/BUILD.bazel create mode 100644 common/management/rpc/BUILD.bazel create mode 100644 common/rust/cargo/BUILD.bazel create mode 100644 gateway/cargo/BUILD.bazel create mode 100644 webhook/cargo/BUILD.bazel (limited to 'common/rust/src') diff --git a/Makefile b/Makefile index 7fa2915..663502f 100644 --- a/Makefile +++ b/Makefile @@ -1,2 +1,6 @@ +.PHONY: gazelle gazelle: - bazel run //:gazelle -- update-repos -build_file_name BUILD.bazel -from_file=go.mod -to_macro=deps.bzl%go_dependencies \ No newline at end of file + 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 95f4074..bdc8b17 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -34,9 +34,10 @@ http_archive( http_archive( name = "io_bazel_rules_go", - sha256 = "e26c54a224f705feee511b24a0c0a11eb8e7ecbbae1fa2a1b7ba3e50a0820c36", + sha256 = "8e968b5fcea1d2d64071872b12737bbb5514524ee5f0a4f54f5920266c261acb", urls = [ - "https://github.com/csstaub/gopackagesdriver-repro/blob/main/external/rules_go-70b8365a.tar.gz?raw=true", + "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.28.0/rules_go-v0.28.0.zip", + "https://github.com/bazelbuild/rules_go/releases/download/v0.28.0/rules_go-v0.28.0.zip", ], ) @@ -58,6 +59,10 @@ http_archive( ], ) +load("//bazel:go.bzl", "load_golang_toolchains") + +load_golang_toolchains() + load("//bazel:utils.bzl", "get_toolchain_utils_protocolbuffers", "get_toolchain_utils_rules_pkg") load("//:deps.bzl", "go_dependencies") @@ -72,10 +77,6 @@ load("//bazel:rust.bzl", "load_rust_toolchains") load_rust_toolchains() -load("//bazel:go.bzl", "load_golang_toolchains") - -load_golang_toolchains() - load("//bazel:docker.bzl", "load_docker") load_docker() diff --git a/cache/cargo/BUILD.bazel b/cache/cargo/BUILD.bazel new file mode 100644 index 0000000..1543954 --- /dev/null +++ b/cache/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 = "log", + actual = "@raze__log__0_4_14//:log", + tags = [ + "cargo-raze", + "manual", + ], +) + +alias( + name = "nats", + actual = "@raze__nats__0_15_2//:nats", + tags = [ + "cargo-raze", + "manual", + ], +) + +alias( + name = "redis", + actual = "@raze__redis__0_21_2//:redis", + tags = [ + "cargo-raze", + "manual", + ], +) + +alias( + name = "serde", + actual = "@raze__serde__1_0_130//:serde", + tags = [ + "cargo-raze", + "manual", + ], +) + +alias( + name = "serde_json", + actual = "@raze__serde_json__1_0_67//:serde_json", + tags = [ + "cargo-raze", + "manual", + ], +) diff --git a/common/management/BUILD.bazel b/common/management/BUILD.bazel index 2e8f53f..fd2bdeb 100644 --- a/common/management/BUILD.bazel +++ b/common/management/BUILD.bazel @@ -1,24 +1,24 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") load("@io_bazel_rules_go//go:def.bzl", "go_library") +load("@rules_proto//proto:defs.bzl", "proto_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") proto_library( - name = "nova_ratelimit_v1_proto", + name = "nova_management_v1alpha_proto", srcs = ["nova.management.v1alpha.proto"], visibility = ["//visibility:public"], ) go_proto_library( - name = "nova_ratelimit_v1_go_proto", + name = "nova_management_v1alpha_go_proto", compilers = ["@io_bazel_rules_go//proto:go_grpc"], importpath = "github.com/discordnova/nova/common/management", - proto = ":nova_ratelimit_v1_proto", + proto = ":nova_management_v1alpha_proto", visibility = ["//visibility:public"], ) go_library( name = "management", - embed = [":nova_ratelimit_v1_go_proto"], + embed = [":nova_management_v1alpha_go_proto"], importpath = "github.com/discordnova/nova/common/management", visibility = ["//visibility:public"], ) diff --git a/common/management/nova.management.v1alpha.proto b/common/management/nova.management.v1alpha.proto index f07aa9b..d0d6baf 100644 --- a/common/management/nova.management.v1alpha.proto +++ b/common/management/nova.management.v1alpha.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -package nova.ratelimit.v1; +package nova.management.v1alpha; message Empty {} diff --git a/common/management/rpc/BUILD.bazel b/common/management/rpc/BUILD.bazel new file mode 100644 index 0000000..ed06686 --- /dev/null +++ b/common/management/rpc/BUILD.bazel @@ -0,0 +1,25 @@ +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") + +proto_library( + name = "v1alpha_proto", + srcs = ["nova.management.rpc.v1alpha.proto"], + visibility = ["//visibility:public"], + deps = ["//common/management:nova_management_v1alpha_proto"], +) + +go_proto_library( + name = "v1alpha_go_proto", + importpath = "github.com/discordnova/nova/common/management/rpc", + proto = ":v1alpha_proto", + visibility = ["//visibility:public"], + deps = ["//common/management"], +) + +go_library( + name = "rpc", + embed = [":v1alpha_go_proto"], + importpath = "github.com/discordnova/nova/common/management/rpc", + visibility = ["//visibility:public"], +) diff --git a/common/management/rpc/nova.management.rpc.v1alpha.proto b/common/management/rpc/nova.management.rpc.v1alpha.proto index e3b5c96..1ec0168 100644 --- a/common/management/rpc/nova.management.rpc.v1alpha.proto +++ b/common/management/rpc/nova.management.rpc.v1alpha.proto @@ -1,4 +1,5 @@ syntax = "proto3"; import "common/management/nova.management.v1alpha.proto"; -package nova.management.rpc.v1alpha; \ No newline at end of file +package nova.management.rpc.v1alpha; + diff --git a/common/rust/cargo/BUILD.bazel b/common/rust/cargo/BUILD.bazel new file mode 100644 index 0000000..f92a2e9 --- /dev/null +++ b/common/rust/cargo/BUILD.bazel @@ -0,0 +1,85 @@ +""" +@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 = "config", + actual = "@raze__config__0_11_0//:config", + tags = [ + "cargo-raze", + "manual", + ], +) + +alias( + name = "hyper", + actual = "@raze__hyper__0_14_12//:hyper", + tags = [ + "cargo-raze", + "manual", + ], +) + +alias( + name = "log", + actual = "@raze__log__0_4_14//:log", + tags = [ + "cargo-raze", + "manual", + ], +) + +alias( + name = "nats", + actual = "@raze__nats__0_15_2//:nats", + tags = [ + "cargo-raze", + "manual", + ], +) + +alias( + name = "pretty_env_logger", + actual = "@raze__pretty_env_logger__0_4_0//:pretty_env_logger", + tags = [ + "cargo-raze", + "manual", + ], +) + +alias( + name = "prometheus", + actual = "@raze__prometheus__0_12_0//:prometheus", + 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/common/rust/src/config.rs b/common/rust/src/config.rs index d4437a9..3dcd72c 100644 --- a/common/rust/src/config.rs +++ b/common/rust/src/config.rs @@ -1,9 +1,12 @@ use std::env; - use config::{Config, ConfigError, Environment, File, Source}; use log::info; use serde::Deserialize; +/// Settings is the base structure for all the nova's component config +/// you can specify a type T and the name of the component. the "config" +/// field will be equals to the key named after the given component name +/// and will be of type T #[derive(Debug, Deserialize, Clone)] #[serde(bound(deserialize = "T: Deserialize<'de> + std::default::Default + Clone"))] pub struct Settings { @@ -13,10 +16,13 @@ pub struct Settings { pub nats: crate::nats::NatsConfiguration, } +/// impl Settings where T: Deserialize<'static> + std::default::Default + Clone, { + /// 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> { let mut default = Config::default(); // this file my be shared with all the components diff --git a/common/rust/src/lib.rs b/common/rust/src/lib.rs index 943d7cc..1125f5a 100644 --- a/common/rust/src/lib.rs +++ b/common/rust/src/lib.rs @@ -1,7 +1,7 @@ -/// This crate contains shared code in all the rust projects -/// It contains utilities such as monitoring, logging and more. +/// This crate is all the utilities shared by the nova rust projects +/// It includes loging, config and protocols. pub mod config; pub mod monitoring; pub mod nats; pub mod payloads; -pub mod error; \ No newline at end of file +pub mod error; diff --git a/common/rust/src/nats.rs b/common/rust/src/nats.rs index 59b480c..437a857 100644 --- a/common/rust/src/nats.rs +++ b/common/rust/src/nats.rs @@ -24,7 +24,6 @@ pub struct NatsConfiguration { host: String, } -/// impl Into for NatsConfiguration { fn into(self) -> Connection { let mut options = Options::new(); diff --git a/common/rust/src/payloads.rs b/common/rust/src/payloads.rs index 6eb35c8..2da70e3 100644 --- a/common/rust/src/payloads.rs +++ b/common/rust/src/payloads.rs @@ -1,15 +1,26 @@ use serde::{Deserialize, Serialize}; +use std::fmt::Debug; -/// Payload send to the nova cache queues -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(bound(deserialize = "T: Deserialize<'de> + std::default::Default + Clone"))] + + +/// Data structure sent to the cache component +/// by the gateway & webhook. +#[derive(Serialize, Deserialize, Debug)] +#[serde(bound(deserialize = "T: Deserialize<'de> + Debug"))] pub struct CachePayload { + + #[serde(rename = "tr")] pub tracing: Tracing, - pub data: T + + #[serde(rename = "d")] + pub data: T, + + #[serde(rename = "o")] + pub operation: String, } -#[derive(Serialize, Deserialize, Debug, Clone)] +#[derive(Serialize, Deserialize, Debug)] pub struct Tracing { pub node_id: String, pub span: Option -} \ No newline at end of file +} diff --git a/deps.bzl b/deps.bzl index 3ade3f5..0479279 100644 --- a/deps.bzl +++ b/deps.bzl @@ -58,8 +58,8 @@ def go_dependencies(): go_repository( name = "com_github_armon_go_metrics", importpath = "github.com/armon/go-metrics", - sum = "h1:8GUt8eRujhVEGZFFEjBj46YV4rDjvGrNxb0KMWYkL2I=", - version = "v0.0.0-20180917152333-f0300d1749da", + sum = "h1:O2sNqxBdvq8Eq5xmzljcYzAORli6RWCvEym4cJf9m18=", + version = "v0.3.9", ) go_repository( name = "com_github_armon_go_radix", @@ -109,6 +109,13 @@ def go_dependencies(): sum = "h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY=", version = "v0.1.0", ) + go_repository( + name = "com_github_boltdb_bolt", + importpath = "github.com/boltdb/bolt", + sum = "h1:JQmyP4ZBrce+ZQu0dY660FMfatumYDLun9hBCUVIkF4=", + version = "v1.3.1", + ) + go_repository( name = "com_github_buraksezer_consistent", importpath = "github.com/buraksezer/consistent", @@ -153,6 +160,19 @@ def go_dependencies(): sum = "h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=", version = "v2.1.1", ) + go_repository( + name = "com_github_circonus_labs_circonus_gometrics", + importpath = "github.com/circonus-labs/circonus-gometrics", + sum = "h1:C29Ae4G5GtYyYMm1aztcyj/J5ckgJm2zwdDajFbx1NY=", + version = "v2.3.1+incompatible", + ) + go_repository( + name = "com_github_circonus_labs_circonusllhist", + importpath = "github.com/circonus-labs/circonusllhist", + sum = "h1:TJH+oke8D16535+jHExHj4nQvzlZrj7ug5D7I/orNUA=", + version = "v0.1.3", + ) + go_repository( name = "com_github_clbanning_x2j", importpath = "github.com/clbanning/x2j", @@ -226,6 +246,13 @@ def go_dependencies(): sum = "h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w=", version = "v1.1.9", ) + go_repository( + name = "com_github_datadog_datadog_go", + importpath = "github.com/DataDog/datadog-go", + sum = "h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4=", + version = "v3.2.0+incompatible", + ) + go_repository( name = "com_github_davecgh_go_spew", importpath = "github.com/davecgh/go-spew", @@ -296,8 +323,8 @@ def go_dependencies(): go_repository( name = "com_github_fatih_color", importpath = "github.com/fatih/color", - sum = "h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=", - version = "v1.7.0", + sum = "h1:mRhaKNwANqRgUBGKmnI5ZxEk7QXmjQeCcuYFMX2bfcc=", + version = "v1.12.0", ) go_repository( name = "com_github_flynn_go_shlex", @@ -484,8 +511,8 @@ def go_dependencies(): go_repository( name = "com_github_google_gofuzz", importpath = "github.com/google/gofuzz", - sum = "h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw=", - version = "v1.0.0", + sum = "h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=", + version = "v1.2.0", ) go_repository( name = "com_github_google_renameio", @@ -565,17 +592,24 @@ def go_dependencies(): sum = "h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM=", version = "v0.5.1", ) + go_repository( + name = "com_github_hashicorp_go_hclog", + importpath = "github.com/hashicorp/go-hclog", + sum = "h1:K4ev2ib4LdQETX5cSZBG0DVLk1jwGqSPXBjdah3veNs=", + version = "v0.16.2", + ) + go_repository( name = "com_github_hashicorp_go_immutable_radix", importpath = "github.com/hashicorp/go-immutable-radix", - sum = "h1:AKDB1HM5PWEA7i4nhcpwOrO2byshxBjXVn/J/3+z5/0=", - version = "v1.0.0", + sum = "h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc=", + version = "v1.3.1", ) go_repository( name = "com_github_hashicorp_go_msgpack", importpath = "github.com/hashicorp/go-msgpack", - sum = "h1:zKjpN5BK/P5lMYrLmBHdBULWbJ0XpYR+7NGzqkZzoD4=", - version = "v0.5.3", + sum = "h1:9byZdVjKTe5mce63pRVNP1L7UAmdHOTEMGehn6KvJWs=", + version = "v1.1.5", ) go_repository( name = "com_github_hashicorp_go_multierror", @@ -589,6 +623,13 @@ def go_dependencies(): sum = "h1:sNCoNyDEvN1xa+X0baata4RdcpKwcMS6DH+xwfqPgjw=", version = "v0.0.1", ) + go_repository( + name = "com_github_hashicorp_go_retryablehttp", + importpath = "github.com/hashicorp/go-retryablehttp", + sum = "h1:QlWt0KvWT0lq8MFppF9tsJGF+ynG7ztc2KIPhzRGk7s=", + version = "v0.5.3", + ) + go_repository( name = "com_github_hashicorp_go_rootcerts", importpath = "github.com/hashicorp/go-rootcerts", @@ -622,8 +663,8 @@ def go_dependencies(): go_repository( name = "com_github_hashicorp_golang_lru", importpath = "github.com/hashicorp/golang-lru", - sum = "h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU=", - version = "v0.5.1", + sum = "h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=", + version = "v0.5.4", ) go_repository( name = "com_github_hashicorp_logutils", @@ -643,6 +684,19 @@ def go_dependencies(): sum = "h1:EmmoJme1matNzb+hMpDuR/0sbJSUisxyqBGG676r31M=", version = "v0.1.3", ) + go_repository( + name = "com_github_hashicorp_raft", + importpath = "github.com/hashicorp/raft", + sum = "h1:zDT8ke8y2aP4wf9zPTB2uSIeavJ3Hx/ceY4jxI2JxuY=", + version = "v1.3.1", + ) + go_repository( + name = "com_github_hashicorp_raft_boltdb", + importpath = "github.com/hashicorp/raft-boltdb", + sum = "h1:EfDtu7qY4bD9hNY9sIryn1L/Ycvo+/WPEFT2Crwdclg=", + version = "v0.0.0-20210422161416-485fa74b0b01", + ) + go_repository( name = "com_github_hashicorp_serf", importpath = "github.com/hashicorp/serf", @@ -691,6 +745,13 @@ def go_dependencies(): sum = "h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc=", version = "v1.5.0", ) + go_repository( + name = "com_github_jille_raft_grpc_transport", + importpath = "github.com/Jille/raft-grpc-transport", + sum = "h1:W/YSPz8IsirEyomjKmDog5Xk71o9+l4KhyMEX2TsgSs=", + version = "v1.2.0", + ) + go_repository( name = "com_github_jmespath_go_jmespath", importpath = "github.com/jmespath/go-jmespath", @@ -781,6 +842,19 @@ def go_dependencies(): sum = "h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=", version = "v0.2.0", ) + go_repository( + name = "com_github_labstack_echo", + importpath = "github.com/labstack/echo", + sum = "h1:pGRcYk231ExFAyoAjAfD85kQzRJCRI8bbnE7CX5OEgg=", + version = "v3.3.10+incompatible", + ) + go_repository( + name = "com_github_labstack_gommon", + importpath = "github.com/labstack/gommon", + sum = "h1:JEeO0bvc78PKdyHxloTKiF8BD5iGrH8T6MSeGvSgob0=", + version = "v0.3.0", + ) + go_repository( name = "com_github_lightstep_lightstep_tracer_common_golang_gogo", importpath = "github.com/lightstep/lightstep-tracer-common/golang/gogo", @@ -799,6 +873,19 @@ def go_dependencies(): sum = "h1:KNt/RhmQTOLr7Aj8PsJ7mTronaFyx80mRTT9qF261dA=", version = "v0.0.13", ) + go_repository( + name = "com_github_matoous_go_nanoid", + importpath = "github.com/matoous/go-nanoid", + sum = "h1:VRorl6uCngneC4oUQqOYtO3S0H5QKFtKuKycFG3euek=", + version = "v1.5.0", + ) + go_repository( + name = "com_github_matoous_go_nanoid_v2", + importpath = "github.com/matoous/go-nanoid/v2", + sum = "h1:d19kur2QuLeHmJBkvYkFdhFBzLoo1XVm2GgTpL+9Tj0=", + version = "v2.0.0", + ) + go_repository( name = "com_github_matryer_is", importpath = "github.com/matryer/is", @@ -808,14 +895,14 @@ def go_dependencies(): go_repository( name = "com_github_mattn_go_colorable", importpath = "github.com/mattn/go-colorable", - sum = "h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4=", - version = "v0.0.9", + sum = "h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=", + version = "v0.1.8", ) go_repository( name = "com_github_mattn_go_isatty", importpath = "github.com/mattn/go-isatty", - sum = "h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs=", - version = "v0.0.4", + sum = "h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=", + version = "v0.0.14", ) go_repository( name = "com_github_mattn_go_runewidth", @@ -1020,8 +1107,8 @@ def go_dependencies(): go_repository( name = "com_github_pascaldekloe_goe", importpath = "github.com/pascaldekloe/goe", - sum = "h1:Lgl0gzECD8GnQ5QCWA8o6BtfL6mDH5rQgM4/fX3avOs=", - version = "v0.0.0-20180627143212-57f6aae5913c", + sum = "h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=", + version = "v0.1.0", ) go_repository( name = "com_github_pborman_uuid", @@ -1259,6 +1346,13 @@ def go_dependencies(): sum = "h1:ndzgwNDnKIqyCvHTXaCqh9KlOWKvBry6nuXMJmonVsE=", version = "v0.0.0-20170815181823-89b8d40f7ca8", ) + go_repository( + name = "com_github_tv42_httpunix", + importpath = "github.com/tv42/httpunix", + sum = "h1:G3dpKMzFDjgEh2q1Z7zUUtKa8ViPtH+ocF0bE0g00O8=", + version = "v0.0.0-20150427012821-b75d8614f926", + ) + go_repository( name = "com_github_twinproduction_go_color", importpath = "github.com/TwinProduction/go-color", @@ -1271,6 +1365,19 @@ def go_dependencies(): sum = "h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY=", version = "v1.22.1", ) + go_repository( + name = "com_github_valyala_bytebufferpool", + importpath = "github.com/valyala/bytebufferpool", + sum = "h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=", + version = "v1.0.0", + ) + go_repository( + name = "com_github_valyala_fasttemplate", + importpath = "github.com/valyala/fasttemplate", + sum = "h1:tY9CJiPnMXf1ERmG2EyK7gNUd+c6RKGD0IfU8WdUSz8=", + version = "v1.0.1", + ) + go_repository( name = "com_github_vividcortex_gohistogram", importpath = "github.com/VividCortex/gohistogram", @@ -1292,8 +1399,8 @@ def go_dependencies(): go_repository( name = "com_github_yuin_goldmark", importpath = "github.com/yuin/goldmark", - sum = "h1:ruQGxdhGHe7FWOJPT0mKs5+pD2Xs1Bm/kdGlHO04FmM=", - version = "v1.2.1", + sum = "h1:dPmz1Snjq0kmkz159iL7S6WzdahUTHnHB5M56WFVifs=", + version = "v1.3.5", ) go_repository( name = "com_google_cloud_go", @@ -1443,8 +1550,8 @@ def go_dependencies(): go_repository( name = "org_golang_google_genproto", importpath = "google.golang.org/genproto", - sum = "h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY=", - version = "v0.0.0-20200526211855-cb27e3aa2013", + sum = "h1:3V2dxSZpz4zozWWUq36vUxXEKnSYitEH2LdsAx+RUmg=", + version = "v0.0.0-20210903162649-d08c68adba83", ) go_repository( name = "org_golang_google_grpc", @@ -1456,8 +1563,8 @@ def go_dependencies(): go_repository( name = "org_golang_google_protobuf", importpath = "google.golang.org/protobuf", - sum = "h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=", - version = "v1.26.0", + sum = "h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ=", + version = "v1.27.1", ) go_repository( name = "org_golang_x_crypto", @@ -1474,20 +1581,20 @@ def go_dependencies(): go_repository( name = "org_golang_x_lint", importpath = "golang.org/x/lint", - sum = "h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs=", - version = "v0.0.0-20190930215403-16217165b5de", + sum = "h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug=", + version = "v0.0.0-20210508222113-6edffad5e616", ) go_repository( name = "org_golang_x_mod", importpath = "golang.org/x/mod", - sum = "h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=", - version = "v0.3.0", + sum = "h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=", + version = "v0.4.2", ) go_repository( name = "org_golang_x_net", importpath = "golang.org/x/net", - sum = "h1:KrsHThm5nFk34YtATK1LsThyGhGbGe1olrte/HInHvs=", - version = "v0.0.0-20210326060303-6b1517762897", + sum = "h1:kuk8nKPQ25KCDODLCDXt99tnTVeOyOM8HGvtJ0NzAvw=", + version = "v0.0.0-20210907225631-ff17edfbf26d", ) go_repository( name = "org_golang_x_oauth2", @@ -1498,14 +1605,14 @@ def go_dependencies(): go_repository( name = "org_golang_x_sync", importpath = "golang.org/x/sync", - sum = "h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck=", - version = "v0.0.0-20201020160332-67f06af15bc9", + sum = "h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=", + version = "v0.0.0-20210220032951-036812b2e83c", ) go_repository( name = "org_golang_x_sys", importpath = "golang.org/x/sys", - sum = "h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE=", - version = "v0.0.0-20210510120138-977fb7262007", + sum = "h1:GkvMjFtXUmahfDtashnc1mnrCtuBVcwse5QV2lUk/tI=", + version = "v0.0.0-20210906170528-6f6e22806c34", ) go_repository( name = "org_golang_x_term", @@ -1516,8 +1623,8 @@ def go_dependencies(): go_repository( name = "org_golang_x_text", importpath = "golang.org/x/text", - sum = "h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=", - version = "v0.3.3", + sum = "h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=", + version = "v0.3.7", ) go_repository( name = "org_golang_x_time", @@ -1528,9 +1635,10 @@ def go_dependencies(): go_repository( name = "org_golang_x_tools", importpath = "golang.org/x/tools", - sum = "h1:po9/4sTYwZU9lPhi1tOrb4hCv3qrhiQ77LZfGa2OjwY=", - version = "v0.1.0", + sum = "h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA=", + version = "v0.1.5", ) + go_repository( name = "org_golang_x_xerrors", importpath = "golang.org/x/xerrors", diff --git a/docs/docs/intro.md b/docs/docs/intro.md index 451d2ab..625bcdc 100644 --- a/docs/docs/intro.md +++ b/docs/docs/intro.md @@ -25,5 +25,5 @@ With the help of Nova, you can achieve a number of things, such as ### How did we solve this ? -Nova separates the gateway into multiple smaller components corresponding to multiple +Nova separates the gateway into multiple smaller components corresponding to each discord apis diff --git a/gateway/cargo/BUILD.bazel b/gateway/cargo/BUILD.bazel new file mode 100644 index 0000000..e85683f --- /dev/null +++ b/gateway/cargo/BUILD.bazel @@ -0,0 +1,130 @@ +""" +@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 = "enumflags2", + actual = "@raze__enumflags2__0_7_1//:enumflags2", + tags = [ + "cargo-raze", + "manual", + ], +) + +alias( + name = "futures", + actual = "@raze__futures__0_3_17//:futures", + tags = [ + "cargo-raze", + "manual", + ], +) + +alias( + name = "futures_util", + actual = "@raze__futures_util__0_3_17//:futures_util", + tags = [ + "cargo-raze", + "manual", + ], +) + +alias( + name = "log", + actual = "@raze__log__0_4_14//:log", + tags = [ + "cargo-raze", + "manual", + ], +) + +alias( + name = "num", + actual = "@raze__num__0_4_0//:num", + tags = [ + "cargo-raze", + "manual", + ], +) + +alias( + name = "num_derive", + actual = "@raze__num_derive__0_3_3//:num_derive", + tags = [ + "cargo-raze", + "manual", + ], +) + +alias( + name = "num_traits", + actual = "@raze__num_traits__0_2_14//:num_traits", + tags = [ + "cargo-raze", + "manual", + ], +) + +alias( + name = "serde", + actual = "@raze__serde__1_0_130//:serde", + tags = [ + "cargo-raze", + "manual", + ], +) + +alias( + name = "serde_json", + actual = "@raze__serde_json__1_0_67//:serde_json", + tags = [ + "cargo-raze", + "manual", + ], +) + +alias( + name = "serde_repr", + actual = "@raze__serde_repr__0_1_7//:serde_repr", + tags = [ + "cargo-raze", + "manual", + ], +) + +alias( + name = "tokio", + actual = "@raze__tokio__1_11_0//:tokio", + tags = [ + "cargo-raze", + "manual", + ], +) + +alias( + name = "tokio_tungstenite", + actual = "@raze__tokio_tungstenite__0_15_0//:tokio_tungstenite", + tags = [ + "cargo-raze", + "manual", + ], +) + +alias( + name = "url", + actual = "@raze__url__2_2_2//:url", + tags = [ + "cargo-raze", + "manual", + ], +) diff --git a/gateway/src/payloads/gateway.rs b/gateway/src/payloads/gateway.rs index fe77e7c..4f24890 100644 --- a/gateway/src/payloads/gateway.rs +++ b/gateway/src/payloads/gateway.rs @@ -1,7 +1,10 @@ -use super::{dispatch::Dispatch, opcodes::{OpCodes, hello::Hello}}; +use super::{ + dispatch::Dispatch, + opcodes::{hello::Hello, OpCodes}, +}; +use serde::de::Error; use serde::{Deserialize, Serialize}; use serde_json::Value; -use serde::de::Error; #[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] #[serde(bound(deserialize = "T: Deserialize<'de> + std::fmt::Debug"))] @@ -24,7 +27,10 @@ pub enum Message { } impl<'de> serde::Deserialize<'de> for Message { - fn deserialize>(d: D) -> Result where D::Error : Error { + fn deserialize>(d: D) -> Result + where + D::Error: Error, + { let value = Value::deserialize(d)?; let val = value.get("op").and_then(Value::as_u64).unwrap(); @@ -37,41 +43,31 @@ impl<'de> serde::Deserialize<'de> for Message { // we need to find a better solution than clone match Dispatch::deserialize(value) { - Ok(data) => { - Ok(Message::Dispatch(BaseMessage { - op, - t, - sequence, - data - })) - }, - Err(e) => Err(Error::custom(e)), - } - }, - - OpCodes::Reconnect => { - match BaseMessage::deserialize(value) { - Ok(data) => Ok(Message::Reconnect(data)), + Ok(data) => Ok(Message::Dispatch(BaseMessage { + op, + t, + sequence, + data, + })), Err(e) => Err(Error::custom(e)), } + } + + OpCodes::Reconnect => match BaseMessage::deserialize(value) { + Ok(data) => Ok(Message::Reconnect(data)), + Err(e) => Err(Error::custom(e)), }, - OpCodes::InvalidSession => { - match BaseMessage::deserialize(value) { - Ok(data) => Ok(Message::InvalidSession(data)), - Err(e) => Err(Error::custom(e)), - } + OpCodes::InvalidSession => match BaseMessage::deserialize(value) { + Ok(data) => Ok(Message::InvalidSession(data)), + Err(e) => Err(Error::custom(e)), }, - OpCodes::Hello => { - match BaseMessage::deserialize(value) { - Ok(data) => Ok(Message::Hello(data)), - Err(e) => Err(Error::custom(e)), - } + OpCodes::Hello => match BaseMessage::deserialize(value) { + Ok(data) => Ok(Message::Hello(data)), + Err(e) => Err(Error::custom(e)), }, - OpCodes::HeartbeatACK => { - match BaseMessage::deserialize(value) { - Ok(data) => Ok(Message::HeartbeatACK(data)), - Err(e) => Err(Error::custom(e)), - } + OpCodes::HeartbeatACK => match BaseMessage::deserialize(value) { + Ok(data) => Ok(Message::HeartbeatACK(data)), + Err(e) => Err(Error::custom(e)), }, _ => panic!("Cannot convert"), } diff --git a/go.mod b/go.mod index 35fc963..aa23e64 100644 --- a/go.mod +++ b/go.mod @@ -3,15 +3,19 @@ module github.com/discordnova/nova go 1.16 require ( + github.com/Jille/raft-grpc-transport v1.2.0 // indirect github.com/TwinProduction/go-color v1.0.0 github.com/buraksezer/consistent v0.9.0 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/go-git/go-git/v5 v5.4.2 github.com/go-redsync/redsync/v4 v4.4.1 // indirect github.com/golang/protobuf v1.5.2 // indirect + github.com/hashicorp/raft-boltdb v0.0.0-20210422161416-485fa74b0b01 // indirect + github.com/labstack/echo v3.3.10+incompatible // indirect + github.com/labstack/gommon v0.3.0 // indirect + github.com/matoous/go-nanoid/v2 v2.0.0 // indirect github.com/prometheus/client_golang v1.9.0 github.com/rs/zerolog v1.23.0 github.com/spf13/cobra v0.0.3 - golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect google.golang.org/grpc v1.41.0 ) diff --git a/go.sum b/go.sum index 821cb03..af03806 100644 --- a/go.sum +++ b/go.sum @@ -3,6 +3,11 @@ cloud.google.com/go v0.34.0 h1:eOI3/cP2VTU6uZLDYAoic+eyzzB9YyGmJ7eIjl8rOPg= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/DataDog/datadog-go v2.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4= +github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/Jille/raft-grpc-transport v1.2.0 h1:W/YSPz8IsirEyomjKmDog5Xk71o9+l4KhyMEX2TsgSs= +github.com/Jille/raft-grpc-transport v1.2.0/go.mod h1:GQGUXJfjlzwA390Ox1AyVYpjCLhtGd6yqY9Sb5hpQfc= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible h1:1G1pk05UrOh0NlF1oeaaix1x8XzrfjIDK47TY0Zehcw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= @@ -42,6 +47,9 @@ github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e h1:QEF07wC0T1rKkctt1 github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da h1:8GUt8eRujhVEGZFFEjBj46YV4rDjvGrNxb0KMWYkL2I= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878/go.mod h1:3AMJUQhVx52RsWOnlkpikZr01T/yAVN2gn0861vByNg= +github.com/armon/go-metrics v0.3.9 h1:O2sNqxBdvq8Eq5xmzljcYzAORli6RWCvEym4cJf9m18= +github.com/armon/go-metrics v0.3.9/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310 h1:BUAU3CGlLvorLI26FmByPp2eC2qla6E1Tw+scpcg/to= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= @@ -60,6 +68,8 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/boltdb/bolt v1.3.1 h1:JQmyP4ZBrce+ZQu0dY660FMfatumYDLun9hBCUVIkF4= +github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= github.com/buraksezer/consistent v0.9.0 h1:Zfs6bX62wbP3QlbPGKUhqDw7SmNkOzY5bHZIYXYpR5g= github.com/buraksezer/consistent v0.9.0/go.mod h1:6BrVajWq7wbKZlTOUPs/XVfR8c0maujuPowduSpZqmw= github.com/casbin/casbin/v2 v2.1.2 h1:bTwon/ECRx9dwBy2ewRVr5OiqjeXSGiTUY74sDPQi/g= @@ -72,6 +82,10 @@ github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible h1:C29Ae4G5GtYyYMm1aztcyj/J5ckgJm2zwdDajFbx1NY= +github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= +github.com/circonus-labs/circonusllhist v0.1.3 h1:TJH+oke8D16535+jHExHj4nQvzlZrj7ug5D7I/orNUA= +github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec h1:EdRZT3IeKQmfCSrgo8SZ8V3MEnskuJP0wCYNpe+aiXo= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI= @@ -79,6 +93,7 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403 h1:cqQfy1jclcSy/FwLjemeg3SR1yaINm74aQyupQ0Bl8M= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158 h1:CevA8fI91PAnP8vpnXuB8ZYAZ5wqY86nAbxfgK8tWO4= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa h1:OaNxuTZr7kxeODyLWsRMC+OD03aFUH+mW6r2d+MWa5Y= @@ -123,12 +138,15 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473 h1:4 github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021 h1:fP+fF0up6oPY49OrjPrhIJ8yQfdIM85NXMLkMg1EXVs= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0 h1:EQciDnbrYxy13PgWoY8AqoxGiPrpgBZ1R8UNe3ddc+A= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.12.0 h1:mRhaKNwANqRgUBGKmnI5ZxEk7QXmjQeCcuYFMX2bfcc= +github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db h1:gb2Z18BhTPJPpLQWj4T+rfKHYCHxRHCtRxhKKjRidVw= @@ -219,6 +237,8 @@ github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/renameio v0.1.0 h1:GOZbcHa3HfsPKPlmyPyN2KEohoMXOhdMbHrvbpl2QaA= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.0.0 h1:b4Gk+7WdP/d3HZH8EJsZpvV7EtDOgaZLtnaNGIu1adA= @@ -248,16 +268,27 @@ github.com/hashicorp/consul/sdk v0.3.0 h1:UOxjlb4xVNF93jak1mzzoBatyFju9nrkxpVwIp github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-hclog v0.9.1/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= +github.com/hashicorp/go-hclog v0.16.2 h1:K4ev2ib4LdQETX5cSZBG0DVLk1jwGqSPXBjdah3veNs= +github.com/hashicorp/go-hclog v0.16.2/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-immutable-radix v1.0.0 h1:AKDB1HM5PWEA7i4nhcpwOrO2byshxBjXVn/J/3+z5/0= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= +github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-msgpack v0.5.3 h1:zKjpN5BK/P5lMYrLmBHdBULWbJ0XpYR+7NGzqkZzoD4= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-msgpack v0.5.5/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-msgpack v1.1.5 h1:9byZdVjKTe5mce63pRVNP1L7UAmdHOTEMGehn6KvJWs= +github.com/hashicorp/go-msgpack v1.1.5/go.mod h1:gWVc3sv/wbDmR3rQsj1CAktEZzoz1YNK9NfGLXJ69/4= github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.0 h1:B9UzwGQJehnUY1yNrnwREHc3fGbC2xefo8g4TbElacI= github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= +github.com/hashicorp/go-retryablehttp v0.5.3 h1:QlWt0KvWT0lq8MFppF9tsJGF+ynG7ztc2KIPhzRGk7s= +github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-rootcerts v1.0.0 h1:Rqb66Oo1X/eSV1x66xbDccZjhJigjg0+e82kpwzSwCI= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= github.com/hashicorp/go-sockaddr v1.0.0 h1:GeH6tui99pF4NJgfnhp+L6+FfobzVW3Ah46sLo0ICXs= @@ -274,12 +305,19 @@ github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= +github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/mdns v1.0.0 h1:WhIgCr5a7AaVH6jPUwjtRuuE7/RDufnUvzIr48smyxs= github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3 h1:EmmoJme1matNzb+hMpDuR/0sbJSUisxyqBGG676r31M= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/raft v1.1.0/go.mod h1:4Ak7FSPnuvmb0GV6vgIAJ4vYT4bek9bb6Q+7HVbyzqM= +github.com/hashicorp/raft v1.3.1 h1:zDT8ke8y2aP4wf9zPTB2uSIeavJ3Hx/ceY4jxI2JxuY= +github.com/hashicorp/raft v1.3.1/go.mod h1:4Ak7FSPnuvmb0GV6vgIAJ4vYT4bek9bb6Q+7HVbyzqM= +github.com/hashicorp/raft-boltdb v0.0.0-20210422161416-485fa74b0b01 h1:EfDtu7qY4bD9hNY9sIryn1L/Ycvo+/WPEFT2Crwdclg= +github.com/hashicorp/raft-boltdb v0.0.0-20210422161416-485fa74b0b01/go.mod h1:L6EUYfWjwPIkX9uqJBsGb3fppuOcRx3t7z2joJnIf/g= github.com/hashicorp/serf v0.8.2 h1:YZ7UKsJv+hKjqGVUUbtE3HNj79Eln2oQ75tniF6iPt0= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= @@ -305,6 +343,7 @@ github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= @@ -331,19 +370,37 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/labstack/echo v3.3.10+incompatible h1:pGRcYk231ExFAyoAjAfD85kQzRJCRI8bbnE7CX5OEgg= +github.com/labstack/echo v3.3.10+incompatible/go.mod h1:0INS7j/VjnFxD4E2wkz67b8cVwCLbBmJyDaka6Cmk1s= +github.com/labstack/gommon v0.3.0 h1:JEeO0bvc78PKdyHxloTKiF8BD5iGrH8T6MSeGvSgob0= +github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743 h1:143Bb8f8DuGWck/xpNUOckBVYfFbBTnLevfRZ1aVVqo= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1 h1:vi1F1IQ8N7hNWytK9DpJsUfQhGuNSc19z330K6vl4zk= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= github.com/lyft/protoc-gen-validate v0.0.13 h1:KNt/RhmQTOLr7Aj8PsJ7mTronaFyx80mRTT9qF261dA= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= +github.com/matoous/go-nanoid v1.5.0 h1:VRorl6uCngneC4oUQqOYtO3S0H5QKFtKuKycFG3euek= +github.com/matoous/go-nanoid v1.5.0/go.mod h1:zyD2a71IubI24efhpvkJz+ZwfwagzgSO6UNiFsZKN7U= +github.com/matoous/go-nanoid/v2 v2.0.0 h1:d19kur2QuLeHmJBkvYkFdhFBzLoo1XVm2GgTpL+9Tj0= +github.com/matoous/go-nanoid/v2 v2.0.0/go.mod h1:FtS4aGPVfEkxKxhdWPAspZpZSh1cOjtM7Ej/So3hR0g= github.com/matryer/is v1.2.0 h1:92UTHpy8CDwaJ08GqLDzhhuixiBUUD1p3AU6PHddz4A= github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= +github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= +github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-runewidth v0.0.2 h1:UnlwIPBGaTZfPQ6T1IGzPI0EkYAQmT9fAEJ/poFC63o= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= @@ -428,6 +485,8 @@ github.com/pact-foundation/pact-go v1.0.4 h1:OYkFijGHoZAYbOIb1LWXrwKQbMMRUv1oQ89 github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c h1:Lgl0gzECD8GnQ5QCWA8o6BtfL6mDH5rQgM4/fX3avOs= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= +github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/performancecopilot/speed v3.0.0+incompatible h1:2WnRzIquHa5QxaJKShDkLM+sc0JPuwhXzK8OYOyt3Vg= @@ -446,9 +505,11 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/posener/complete v1.1.1 h1:ccV59UEOTzVDnDUEFdT95ZzHVZ+5+158q8+SJb2QV5w= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM= github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= +github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.9.0 h1:Rrch9mh17XcxvEu9D9DEpb4isxjGBtcevQjKvxPRQIU= github.com/prometheus/client_golang v1.9.0/go.mod h1:FqZLKOZnGdFAhOK4nqGHa7D66IdsO+O441Eve7ptJDU= @@ -459,13 +520,16 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= +github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0 h1:4fgOnadei3EZvgRwxJ7RMpG1k1pOZth5Pc13tyspaKM= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= @@ -534,15 +598,23 @@ github.com/stvp/tempredis v0.0.0-20181119212430-b82af8480203 h1:QVqDTf3h2WHt08Yu github.com/stvp/tempredis v0.0.0-20181119212430-b82af8480203/go.mod h1:oqN97ltKNihBbwlX8dLpwxCl3+HnXKV/R0e+sRLd9C8= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8 h1:ndzgwNDnKIqyCvHTXaCqh9KlOWKvBry6nuXMJmonVsE= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926 h1:G3dpKMzFDjgEh2q1Z7zUUtKa8ViPtH+ocF0bE0g00O8= +github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasttemplate v1.0.1 h1:tY9CJiPnMXf1ERmG2EyK7gNUd+c6RKGD0IfU8WdUSz8= +github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI= github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/yuin/goldmark v1.2.1 h1:ruQGxdhGHe7FWOJPT0mKs5+pD2Xs1Bm/kdGlHO04FmM= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5 h1:dPmz1Snjq0kmkz159iL7S6WzdahUTHnHB5M56WFVifs= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.etcd.io/bbolt v1.3.3 h1:MUGmc65QhB3pIlaQ5bB4LwqSj6GIonVJXpZiaKNyaKk= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738 h1:VcrIfasaLFkyjk6KNlXQSzO+B0fZcnECiDrKJsfxka0= @@ -585,10 +657,14 @@ golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTk golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -613,6 +689,9 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210326060303-6b1517762897 h1:KrsHThm5nFk34YtATK1LsThyGhGbGe1olrte/HInHvs= golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210907225631-ff17edfbf26d h1:kuk8nKPQ25KCDODLCDXt99tnTVeOyOM8HGvtJ0NzAvw= +golang.org/x/net v0.0.0-20210907225631-ff17edfbf26d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421 h1:Wo7BWFiOk0QRFMLYMqJGFMd9CgUAcGx7V+qEg/h5IBI= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -626,6 +705,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -635,19 +716,25 @@ golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -659,15 +746,24 @@ golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34 h1:GkvMjFtXUmahfDtashnc1mnrCtuBVcwse5QV2lUk/tI= +golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -679,14 +775,18 @@ golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3 golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190424220101-1e8e1cfdf96b/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.1.0 h1:po9/4sTYwZU9lPhi1tOrb4hCv3qrhiQ77LZfGa2OjwY= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -707,6 +807,8 @@ google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98 google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83 h1:3V2dxSZpz4zozWWUq36vUxXEKnSYitEH2LdsAx+RUmg= +google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= @@ -721,6 +823,7 @@ google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.41.0 h1:f+PlOh7QV4iIJkPrx5NQ7qaNGFQ3OTse67yaDHfju4E= google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -735,6 +838,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/ratelimiter/BUILD b/ratelimiter/BUILD index 9e0e823..eeb957a 100644 --- a/ratelimiter/BUILD +++ b/ratelimiter/BUILD @@ -12,7 +12,7 @@ cargo_build_script( "PROTOC": "$(location @com_google_protobuf//:protoc)", }, data = [ - "//ratelimiter/proto:nova.ratelimit.v1.proto", + "//ratelimiter/proto:nova.ratelimit.v1alpha.proto", ] + [ "@com_google_protobuf//:protoc", "@com_google_protobuf//:protobuf_headers", diff --git a/ratelimiter/build.rs b/ratelimiter/build.rs index e0a62ca..dad6fbe 100644 --- a/ratelimiter/build.rs +++ b/ratelimiter/build.rs @@ -1,4 +1,4 @@ fn main() -> Result<(), Box> { - tonic_build::compile_protos("proto/nova.ratelimit.v1.proto").unwrap(); + tonic_build::compile_protos("proto/nova.ratelimit.v1alpha.proto").unwrap(); Ok(()) -} \ No newline at end of file +} diff --git a/ratelimiter/proto/BUILD.bazel b/ratelimiter/proto/BUILD.bazel index ffb258d..364df7e 100644 --- a/ratelimiter/proto/BUILD.bazel +++ b/ratelimiter/proto/BUILD.bazel @@ -2,11 +2,11 @@ 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.v1.proto"]) +exports_files(["nova.ratelimit.v1alpha.proto"]) proto_library( name = "nova_ratelimit_v1_proto", - srcs = ["nova.ratelimit.v1.proto"], + srcs = ["nova.ratelimit.v1alpha.proto"], visibility = ["//visibility:public"], ) diff --git a/ratelimiter/proto/nova.ratelimit.v1alpha.proto b/ratelimiter/proto/nova.ratelimit.v1alpha.proto index 5f06392..8ef606f 100644 --- a/ratelimiter/proto/nova.ratelimit.v1alpha.proto +++ b/ratelimiter/proto/nova.ratelimit.v1alpha.proto @@ -3,7 +3,7 @@ // the requested route bucket or global rate-limit is hit. syntax = "proto3"; -package nova.ratelimit.v1; +package nova.ratelimit.v1alpha; // The reponse of a RatelimitRequest, it includes the status of the reponse and // the bucket informations. diff --git a/ratelimiter/src/main.rs b/ratelimiter/src/main.rs index 633af68..706077f 100644 --- a/ratelimiter/src/main.rs +++ b/ratelimiter/src/main.rs @@ -1,14 +1,14 @@ // Some implementation of the gRPC service using the shared library. pub mod ratelimit_pb { - tonic::include_proto!("nova.ratelimit.v1"); + tonic::include_proto!("nova.ratelimit.v1alpha"); } use ratelimit_pb::ratelimit_service_server::{RatelimitService, RatelimitServiceServer}; -use ratelimit_pb::{CreateBucketData, RatelimitResponse, RatelimitRequest}; -use tonic::{Request, Status, Response}; -use tonic::transport::Server; +use ratelimit_pb::{CreateBucketData, RatelimitRequest, RatelimitResponse}; use std::error::Error; +use tonic::transport::Server; +use tonic::{Request, Response, Status}; #[derive(Default)] pub struct MyRatelimitService {} @@ -17,15 +17,15 @@ pub struct MyRatelimitService {} impl RatelimitService for MyRatelimitService { async fn get_ratelimit_status( &self, - _request: Request + _request: Request, ) -> Result, Status> { - return Err(Status::not_found("Not implmented")) + return Err(Status::not_found("Not implmented")); } async fn create_bucket( &self, - _request: Request - ) ->Result, Status> { - return Err(tonic::Status::not_found("Not implmented")) + _request: Request, + ) -> Result, Status> { + return Err(tonic::Status::not_found("Not implmented")); } } @@ -42,4 +42,4 @@ async fn main() -> Result<(), Box> { .await?; Ok(()) -} \ No newline at end of file +} diff --git a/webhook/cargo/BUILD.bazel b/webhook/cargo/BUILD.bazel new file mode 100644 index 0000000..e035ab6 --- /dev/null +++ b/webhook/cargo/BUILD.bazel @@ -0,0 +1,94 @@ +""" +@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 = "config", + actual = "@raze__config__0_11_0//:config", + tags = [ + "cargo-raze", + "manual", + ], +) + +alias( + name = "hex", + actual = "@raze__hex__0_4_3//:hex", + tags = [ + "cargo-raze", + "manual", + ], +) + +alias( + name = "hyper", + actual = "@raze__hyper__0_14_12//:hyper", + tags = [ + "cargo-raze", + "manual", + ], +) + +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", + tags = [ + "cargo-raze", + "manual", + ], +) + +alias( + name = "nats", + actual = "@raze__nats__0_15_2//:nats", + tags = [ + "cargo-raze", + "manual", + ], +) + +alias( + name = "serde", + actual = "@raze__serde__1_0_130//:serde", + tags = [ + "cargo-raze", + "manual", + ], +) + +alias( + name = "serde_json", + actual = "@raze__serde_json__1_0_67//:serde_json", + tags = [ + "cargo-raze", + "manual", + ], +) + +alias( + name = "tokio", + actual = "@raze__tokio__1_11_0//:tokio", + tags = [ + "cargo-raze", + "manual", + ], +) diff --git a/webhook/src/config.rs b/webhook/src/config.rs index eead97b..a054d33 100644 --- a/webhook/src/config.rs +++ b/webhook/src/config.rs @@ -16,4 +16,4 @@ pub struct Discord { pub struct Config { pub server: ServerSettings, pub discord: Discord, -} \ No newline at end of file +} diff --git a/webhook/src/handler/handler.rs b/webhook/src/handler/handler.rs index b993aaa..9545bec 100644 --- a/webhook/src/handler/handler.rs +++ b/webhook/src/handler/handler.rs @@ -1,15 +1,26 @@ use super::{signature::validate_signature, types::Interaction}; use crate::config::Config; -use hyper::{Body, Method, Request, Response, StatusCode, body::{to_bytes, Bytes}, service::Service}; +use hyper::{ + body::{to_bytes, Bytes}, + service::Service, + Body, Method, Request, Response, StatusCode, +}; use log::{error, info, trace}; use nats::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}, +}; /// Hyper service used to handle the discord webhooks #[derive(Clone)] pub struct HandlerService { - pub config: Config, + pub config: Arc, pub nats: Arc, } @@ -56,7 +67,7 @@ impl HandlerService { #[derive(Debug, Serialize, Deserialize)] pub struct Ping { #[serde(rename = "type")] - t: i32 + t: i32, } /// Implementation of the service @@ -75,17 +86,19 @@ impl Service> for HandlerService { Box::pin(async move { match self_clone.check_request(req).await { Ok(data) => { - let value: Interaction = serde_json::from_str(from_utf8(&data).unwrap()).unwrap(); + let value: Interaction = + serde_json::from_str(from_utf8(&data).unwrap()).unwrap(); trace!("received value: {:?}", value); match value.t { 1 => { info!("sending pong"); // a ping must be responded with another ping - return Ok(Response::builder().header("Content-Type", "application/json").body(serde_json::to_string(&Ping { - t: 1 - }).unwrap().into()).unwrap()); - }, + return Ok(Response::builder() + .header("Content-Type", "application/json") + .body(serde_json::to_string(&Ping { t: 1 }).unwrap().into()) + .unwrap()); + } _ => { let payload = serde_json::to_string(&common::payloads::CachePayload { tracing: common::payloads::Tracing { @@ -93,33 +106,32 @@ impl Service> for HandlerService { span: None, }, data: value, - }).unwrap(); + }) + .unwrap(); - match self_clone.nats.request("nova.cache.dispatch.interaction", payload) { - Ok(response) => { - Ok( - Response::builder() - .header("Content-Type", "application/json") - .body(from_utf8(&response.data).unwrap().to_string().into()) - .unwrap() - ) - }, + match self_clone + .nats + .request("nova.cache.dispatch.interaction", payload) + { + Ok(response) => Ok(Response::builder() + .header("Content-Type", "application/json") + .body(from_utf8(&response.data).unwrap().to_string().into()) + .unwrap()), Err(error) => { error!("failed to request nats: {}", error); - Ok( - Response::builder() - .status(500) - .body("an internal server error occured".to_string().into()) - .unwrap() - ) + Ok(Response::builder() + .status(500) + .body("an internal server error occured".to_string().into()) + .unwrap()) } } - }, + } } - }, - Err(error) => { - Ok(Response::builder().status(StatusCode::UNAUTHORIZED).body(error.to_string().into()).unwrap()) } + Err(error) => Ok(Response::builder() + .status(StatusCode::UNAUTHORIZED) + .body(error.to_string().into()) + .unwrap()), } }) } diff --git a/webhook/src/handler/make_service.rs b/webhook/src/handler/make_service.rs index 96b203d..0778ad0 100644 --- a/webhook/src/handler/make_service.rs +++ b/webhook/src/handler/make_service.rs @@ -1,12 +1,15 @@ -use std::{future::{Ready, ready}, sync::Arc, task::{Context, Poll}}; +use super::handler::HandlerService; +use crate::config::Config; use hyper::service::Service; use nats::Connection; -use crate::config::Config; -use super::handler::HandlerService; - +use std::{ + future::{ready, Ready}, + sync::Arc, + task::{Context, Poll}, +}; pub struct MakeSvc { - pub settings: Config, + pub settings: Arc, pub nats: Arc, } -- cgit v1.2.3 From 005dadb342c6a79d154d3eaf5a5fbb86f3a7e641 Mon Sep 17 00:00:00 2001 From: Matthieu Date: Tue, 12 Oct 2021 22:51:30 +0400 Subject: tests, cleanup & rest base --- BUILD | 6 +- Cargo.lock | 384 +++++++-------------- Cargo.toml | 10 +- Makefile | 3 - WORKSPACE | 2 - cargo/crates.bzl | 361 ++++++------------- cargo/remote/BUILD.anyhow-1.0.43.bazel | 113 ------ cargo/remote/BUILD.async-stream-0.3.2.bazel | 65 ---- cargo/remote/BUILD.async-stream-impl-0.3.2.bazel | 56 --- cargo/remote/BUILD.crypto-mac-0.10.1.bazel | 55 +++ cargo/remote/BUILD.either-1.6.1.bazel | 55 --- cargo/remote/BUILD.fixedbitset-0.2.0.bazel | 55 --- cargo/remote/BUILD.foreign-types-0.3.2.bazel | 54 +++ .../remote/BUILD.foreign-types-shared-0.1.1.bazel | 53 +++ cargo/remote/BUILD.heck-0.3.3.bazel | 54 --- cargo/remote/BUILD.hmac-0.10.1.bazel | 57 +++ cargo/remote/BUILD.hyper-timeout-0.4.1.bazel | 59 ---- cargo/remote/BUILD.hyper-tls-0.5.0.bazel | 60 ++++ cargo/remote/BUILD.itertools-0.10.1.bazel | 99 ------ cargo/remote/BUILD.multimap-0.8.3.bazel | 53 --- cargo/remote/BUILD.native-tls-0.2.8.bazel | 177 ++++++++++ cargo/remote/BUILD.openssl-0.10.36.bazel | 95 +++++ cargo/remote/BUILD.openssl-sys-0.9.67.bazel | 107 ++++++ cargo/remote/BUILD.petgraph-0.5.1.bazel | 79 ----- cargo/remote/BUILD.prost-0.8.0.bazel | 62 ---- cargo/remote/BUILD.prost-build-0.8.0.bazel | 93 ----- 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 + cargo/remote/BUILD.testcontainers-0.12.0.bazel | 64 ++++ cargo/remote/BUILD.tokio-io-timeout-1.1.1.bazel | 55 --- cargo/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 - cargo/remote/BUILD.tracing-attributes-0.1.15.bazel | 74 ---- cargo/remote/BUILD.tracing-futures-0.2.5.bazel | 63 ---- .../remote/BUILD.unicode-segmentation-1.8.0.bazel | 59 ---- cargo/remote/BUILD.vcpkg-0.2.15.bazel | 53 +++ 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 -- ratelimiter/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 +- 89 files changed, 1643 insertions(+), 2504 deletions(-) delete mode 100644 cargo/remote/BUILD.anyhow-1.0.43.bazel 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 create mode 100644 cargo/remote/BUILD.crypto-mac-0.10.1.bazel delete mode 100644 cargo/remote/BUILD.either-1.6.1.bazel delete mode 100644 cargo/remote/BUILD.fixedbitset-0.2.0.bazel create mode 100644 cargo/remote/BUILD.foreign-types-0.3.2.bazel create mode 100644 cargo/remote/BUILD.foreign-types-shared-0.1.1.bazel delete mode 100644 cargo/remote/BUILD.heck-0.3.3.bazel create mode 100644 cargo/remote/BUILD.hmac-0.10.1.bazel delete mode 100644 cargo/remote/BUILD.hyper-timeout-0.4.1.bazel create mode 100644 cargo/remote/BUILD.hyper-tls-0.5.0.bazel delete mode 100644 cargo/remote/BUILD.itertools-0.10.1.bazel delete mode 100644 cargo/remote/BUILD.multimap-0.8.3.bazel create mode 100644 cargo/remote/BUILD.native-tls-0.2.8.bazel create mode 100644 cargo/remote/BUILD.openssl-0.10.36.bazel create mode 100644 cargo/remote/BUILD.openssl-sys-0.9.67.bazel 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-build-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 create mode 100644 cargo/remote/BUILD.testcontainers-0.12.0.bazel delete mode 100644 cargo/remote/BUILD.tokio-io-timeout-1.1.1.bazel 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 delete mode 100644 cargo/remote/BUILD.unicode-segmentation-1.8.0.bazel create mode 100644 cargo/remote/BUILD.vcpkg-0.2.15.bazel 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 (limited to 'common/rust/src') 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.anyhow-1.0.43.bazel b/cargo/remote/BUILD.anyhow-1.0.43.bazel deleted file mode 100644 index 65e94d6..0000000 --- a/cargo/remote/BUILD.anyhow-1.0.43.bazel +++ /dev/null @@ -1,113 +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 -# 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 = "anyhow_build_script", - srcs = glob(["**/*.rs"]), - build_script_env = { - }, - crate_features = [ - "default", - "std", - ], - crate_root = "build.rs", - data = glob(["**"]), - edition = "2018", - rustc_flags = [ - "--cap-lints=allow", - ], - tags = [ - "cargo-raze", - "manual", - ], - version = "1.0.43", - visibility = ["//visibility:private"], - deps = [ - ], -) - -rust_library( - name = "anyhow", - srcs = glob(["**/*.rs"]), - crate_features = [ - "default", - "std", - ], - crate_root = "src/lib.rs", - crate_type = "lib", - data = [], - edition = "2018", - rustc_flags = [ - "--cap-lints=allow", - ], - tags = [ - "cargo-raze", - "manual", - ], - version = "1.0.43", - # buildifier: leave-alone - deps = [ - ":anyhow_build_script", - ], -) - -# 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.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.crypto-mac-0.10.1.bazel b/cargo/remote/BUILD.crypto-mac-0.10.1.bazel new file mode 100644 index 0000000..5d4c629 --- /dev/null +++ b/cargo/remote/BUILD.crypto-mac-0.10.1.bazel @@ -0,0 +1,55 @@ +""" +@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 + +rust_library( + name = "crypto_mac", + 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.10.1", + # buildifier: leave-alone + deps = [ + "@raze__generic_array__0_14_4//:generic_array", + "@raze__subtle__2_4_1//:subtle", + ], +) diff --git a/cargo/remote/BUILD.either-1.6.1.bazel b/cargo/remote/BUILD.either-1.6.1.bazel deleted file mode 100644 index 29a576b..0000000 --- a/cargo/remote/BUILD.either-1.6.1.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", # MIT from expression "MIT OR Apache-2.0" -]) - -# Generated Targets - -rust_library( - name = "either", - srcs = glob(["**/*.rs"]), - crate_features = [ - "default", - "use_std", - ], - crate_root = "src/lib.rs", - crate_type = "lib", - data = [], - edition = "2015", - rustc_flags = [ - "--cap-lints=allow", - ], - tags = [ - "cargo-raze", - "manual", - ], - version = "1.6.1", - # buildifier: leave-alone - deps = [ - ], -) diff --git a/cargo/remote/BUILD.fixedbitset-0.2.0.bazel b/cargo/remote/BUILD.fixedbitset-0.2.0.bazel deleted file mode 100644 index 260256f..0000000 --- a/cargo/remote/BUILD.fixedbitset-0.2.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", # MIT from expression "MIT OR Apache-2.0" -]) - -# Generated Targets - -# Unsupported target "benches" with type "bench" omitted - -rust_library( - name = "fixedbitset", - srcs = glob(["**/*.rs"]), - 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.0", - # buildifier: leave-alone - deps = [ - ], -) diff --git a/cargo/remote/BUILD.foreign-types-0.3.2.bazel b/cargo/remote/BUILD.foreign-types-0.3.2.bazel new file mode 100644 index 0000000..6ef7960 --- /dev/null +++ b/cargo/remote/BUILD.foreign-types-0.3.2.bazel @@ -0,0 +1,54 @@ +""" +@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 + +rust_library( + name = "foreign_types", + srcs = glob(["**/*.rs"]), + crate_features = [ + ], + crate_root = "src/lib.rs", + crate_type = "lib", + data = [], + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.3.2", + # buildifier: leave-alone + deps = [ + "@raze__foreign_types_shared__0_1_1//:foreign_types_shared", + ], +) diff --git a/cargo/remote/BUILD.foreign-types-shared-0.1.1.bazel b/cargo/remote/BUILD.foreign-types-shared-0.1.1.bazel new file mode 100644 index 0000000..c003ce7 --- /dev/null +++ b/cargo/remote/BUILD.foreign-types-shared-0.1.1.bazel @@ -0,0 +1,53 @@ +""" +@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 + +rust_library( + name = "foreign_types_shared", + srcs = glob(["**/*.rs"]), + crate_features = [ + ], + crate_root = "src/lib.rs", + crate_type = "lib", + data = [], + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.1.1", + # buildifier: leave-alone + deps = [ + ], +) diff --git a/cargo/remote/BUILD.heck-0.3.3.bazel b/cargo/remote/BUILD.heck-0.3.3.bazel deleted file mode 100644 index 45ff7e4..0000000 --- a/cargo/remote/BUILD.heck-0.3.3.bazel +++ /dev/null @@ -1,54 +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 - -rust_library( - name = "heck", - 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.3", - # buildifier: leave-alone - deps = [ - "@raze__unicode_segmentation__1_8_0//:unicode_segmentation", - ], -) diff --git a/cargo/remote/BUILD.hmac-0.10.1.bazel b/cargo/remote/BUILD.hmac-0.10.1.bazel new file mode 100644 index 0000000..e129998 --- /dev/null +++ b/cargo/remote/BUILD.hmac-0.10.1.bazel @@ -0,0 +1,57 @@ +""" +@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 + +rust_library( + name = "hmac", + 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.10.1", + # buildifier: leave-alone + deps = [ + "@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-timeout-0.4.1.bazel deleted file mode 100644 index 9fc071f..0000000 --- a/cargo/remote/BUILD.hyper-timeout-0.4.1.bazel +++ /dev/null @@ -1,59 +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 "client" with type "example" omitted - -rust_library( - name = "hyper_timeout", - 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.4.1", - # buildifier: leave-alone - deps = [ - "@raze__hyper__0_14_12//:hyper", - "@raze__pin_project_lite__0_2_7//:pin_project_lite", - "@raze__tokio__1_11_0//:tokio", - "@raze__tokio_io_timeout__1_1_1//:tokio_io_timeout", - ], -) diff --git a/cargo/remote/BUILD.hyper-tls-0.5.0.bazel b/cargo/remote/BUILD.hyper-tls-0.5.0.bazel new file mode 100644 index 0000000..5cfb670 --- /dev/null +++ b/cargo/remote/BUILD.hyper-tls-0.5.0.bazel @@ -0,0 +1,60 @@ +""" +@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 "client" with type "example" omitted + +rust_library( + name = "hyper_tls", + 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.0", + # buildifier: leave-alone + deps = [ + "@raze__bytes__1_1_0//:bytes", + "@raze__hyper__0_14_12//:hyper", + "@raze__native_tls__0_2_8//:native_tls", + "@raze__tokio__1_11_0//:tokio", + "@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.multimap-0.8.3.bazel b/cargo/remote/BUILD.multimap-0.8.3.bazel deleted file mode 100644 index b720afa..0000000 --- a/cargo/remote/BUILD.multimap-0.8.3.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 OR Apache-2.0" -]) - -# Generated Targets - -rust_library( - name = "multimap", - srcs = glob(["**/*.rs"]), - crate_features = [ - ], - crate_root = "src/lib.rs", - crate_type = "lib", - data = [], - edition = "2015", - rustc_flags = [ - "--cap-lints=allow", - ], - tags = [ - "cargo-raze", - "manual", - ], - version = "0.8.3", - # buildifier: leave-alone - deps = [ - ], -) 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.openssl-0.10.36.bazel b/cargo/remote/BUILD.openssl-0.10.36.bazel new file mode 100644 index 0000000..e70a454 --- /dev/null +++ b/cargo/remote/BUILD.openssl-0.10.36.bazel @@ -0,0 +1,95 @@ +""" +@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 +# 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 = "openssl_build_script", + srcs = glob(["**/*.rs"]), + build_script_env = { + }, + crate_features = [ + ], + crate_root = "build.rs", + data = glob(["**"]), + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.10.36", + visibility = ["//visibility:private"], + deps = [ + "@raze__openssl_sys__0_9_67//:openssl_sys", + ], +) + +# Unsupported target "mk_certs" with type "example" omitted + +rust_library( + name = "openssl", + srcs = glob(["**/*.rs"]), + aliases = { + "@raze__openssl_sys__0_9_67//:openssl_sys": "ffi", + }, + crate_features = [ + ], + crate_root = "src/lib.rs", + crate_type = "lib", + data = [], + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.10.36", + # buildifier: leave-alone + deps = [ + ":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.openssl-sys-0.9.67.bazel b/cargo/remote/BUILD.openssl-sys-0.9.67.bazel new file mode 100644 index 0000000..a97fdb8 --- /dev/null +++ b/cargo/remote/BUILD.openssl-sys-0.9.67.bazel @@ -0,0 +1,107 @@ +""" +@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 +# 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 = "openssl_sys_build_script", + srcs = glob(["**/*.rs"]), + build_script_env = { + }, + crate_features = [ + ], + crate_root = "build/main.rs", + data = glob(["**"]), + edition = "2015", + links = "openssl", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + 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 = "openssl_sys", + 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.9.67", + # buildifier: leave-alone + deps = [ + ":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": [], + }), +) 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-build-0.8.0.bazel b/cargo/remote/BUILD.prost-build-0.8.0.bazel deleted file mode 100644 index 998d95e..0000000 --- a/cargo/remote/BUILD.prost-build-0.8.0.bazel +++ /dev/null @@ -1,93 +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 -# 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 = "prost_build_build_script", - srcs = glob(["**/*.rs"]), - build_script_env = { - }, - crate_features = [ - ], - crate_root = "build.rs", - data = glob(["**"]), - edition = "2018", - rustc_flags = [ - "--cap-lints=allow", - ], - tags = [ - "cargo-raze", - "manual", - ], - version = "0.8.0", - visibility = ["//visibility:private"], - deps = [ - "@raze__which__4_2_2//:which", - ], -) - -rust_library( - name = "prost_build", - 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 = [ - ":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", - ], -) 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.testcontainers-0.12.0.bazel b/cargo/remote/BUILD.testcontainers-0.12.0.bazel new file mode 100644 index 0000000..e35b1e5 --- /dev/null +++ b/cargo/remote/BUILD.testcontainers-0.12.0.bazel @@ -0,0 +1,64 @@ +""" +@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 + +rust_library( + name = "testcontainers", + 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.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-io-timeout-1.1.1.bazel b/cargo/remote/BUILD.tokio-io-timeout-1.1.1.bazel deleted file mode 100644 index 33a8951..0000000 --- a/cargo/remote/BUILD.tokio-io-timeout-1.1.1.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", # MIT from expression "MIT OR Apache-2.0" -]) - -# Generated Targets - -rust_library( - name = "tokio_io_timeout", - 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 = "1.1.1", - # buildifier: leave-alone - deps = [ - "@raze__pin_project_lite__0_2_7//:pin_project_lite", - "@raze__tokio__1_11_0//:tokio", - ], -) 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.unicode-segmentation-1.8.0.bazel b/cargo/remote/BUILD.unicode-segmentation-1.8.0.bazel deleted file mode 100644 index dec202b..0000000 --- a/cargo/remote/BUILD.unicode-segmentation-1.8.0.bazel +++ /dev/null @@ -1,59 +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 "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", - 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 = "1.8.0", - # buildifier: leave-alone - deps = [ - ], -) diff --git a/cargo/remote/BUILD.vcpkg-0.2.15.bazel b/cargo/remote/BUILD.vcpkg-0.2.15.bazel new file mode 100644 index 0000000..fd21e4d --- /dev/null +++ b/cargo/remote/BUILD.vcpkg-0.2.15.bazel @@ -0,0 +1,53 @@ +""" +@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 + +rust_library( + name = "vcpkg", + srcs = glob(["**/*.rs"]), + 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.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); } } -- cgit v1.2.3 From f96d8caf1622b8494bcbc5318ac7db6e582035f5 Mon Sep 17 00:00:00 2001 From: Matthieu Date: Wed, 13 Oct 2021 13:54:00 +0400 Subject: circleci for macos, windows and arm/x86 macos --- .circleci/config.yml | 92 ++++++++++++++++++++++++++---- .devcontainer/Dockerfile | 2 +- Cargo.lock | 35 ++++++++++++ cargo/crates.bzl | 34 +++++++++++ cargo/remote/BUILD.arc-swap-1.4.0.bazel | 63 ++++++++++++++++++++ cargo/remote/BUILD.combine-4.6.1.bazel | 13 +++++ cargo/remote/BUILD.crc16-0.4.0.bazel | 83 +++++++++++++++++++++++++++ cargo/remote/BUILD.redis-0.21.2.bazel | 22 +++++++ cargo/remote/BUILD.tokio-util-0.6.8.bazel | 1 + cargo/remote/BUILD.xxhash-rust-0.8.2.bazel | 58 +++++++++++++++++++ common/rust/Cargo.toml | 6 +- common/rust/cargo/BUILD.bazel | 9 +++ common/rust/src/config.rs | 1 + common/rust/src/lib.rs | 4 +- common/rust/src/redis.rs | 15 +++++ rest/Cargo.toml | 2 + rest/cargo/BUILD.bazel | 18 ++++++ rest/src/main.rs | 17 +++++- rest/src/proxy/mod.rs | 7 ++- rest/src/ratelimit/mod.rs | 31 ++++++++++ 20 files changed, 494 insertions(+), 19 deletions(-) create mode 100644 cargo/remote/BUILD.arc-swap-1.4.0.bazel create mode 100644 cargo/remote/BUILD.crc16-0.4.0.bazel create mode 100644 cargo/remote/BUILD.xxhash-rust-0.8.2.bazel create mode 100644 common/rust/src/redis.rs create mode 100644 rest/src/ratelimit/mod.rs (limited to 'common/rust/src') diff --git a/.circleci/config.yml b/.circleci/config.yml index 5539cce..f49c47b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,10 @@ version: 2.1 +orbs: + win: circleci/windows@2.2.0 + commands: - setup-bazel: + setup-bazel-linux: description: | Setup the Bazel build system used for building Android projects steps: @@ -15,24 +18,90 @@ commands: - run: name: Install Bazel from Apt command: sudo apt update && sudo apt install bazel + setup-ci-linux: + description: | + Prepare all the requirements for the CI + steps: + - checkout + - setup-bazel + - setup_remote_docker: + version: 19.03.13 + docker_layer_caching: true + - run: + name: Docker login + command: echo "$GHCR_PASS" | docker login ghcr.io -u "$GHCR_USER" --password-stdin + build-and-test: + description: | + Builds and test + steps: + - run: + name: "Test" + command: "bazel test //:tests" + - run: + name: "Build" + command: "bazel build //:packages" + - run: + name: "Move artifacts" + command: | + mkdir ~/project/artifacts + mv ~/project/bazel-bin/packages* ~/project/artifacts + - store_artifacts: + path: ~/project/artifacts jobs: - build: + build-linux-arm64: machine: - image: 'ubuntu-2004:202010-01' + image: ubuntu-2004:202101-01 + resource_class: arm.medium steps: - - checkout - - setup-bazel + - setup-ci-linux - restore_cache: keys: - - bazel-cache-{{ .Branch }} + - bazel-cache-linux-arm-{{ .Branch }} + - build-and-test - run: - name: "Build" - command: "bazel build //:packages" + name: Publish docker images + command: | + bazel run --define docker_repo=ghcr.io --define docker_tag=arm-{{ .Branch }} //:container_publish + + build-linux-x86: + machine: + image: ubuntu-2004:202010-01 + steps: + - setup-ci-linux - save_cache: paths: - ~/.cache/bazel - key: bazel-cache-{{ .Branch }} + key: bazel-cache-linux-x86-{{ .Branch }} + - build-and-test + - run: + name: Publish docker images + command: | + bazel run --define docker_repo=ghcr.io --define docker_tag={{ .Branch }} //:container_publish + build-windows: + executor: + name: win/default + shell: powershell.exe + steps: + - checkout + - run: systeminfo + - run: choco install bazel + - restore_cache: + keys: + - bazel-cache-windows-{{ .Branch }} + - build-and-test + build-macos: + macos: + xcode: 11.3.0 + steps: + - checkout + - run: brew install bazel + - restore_cache: + keys: + - bazel-cache-macos-{{ .Branch }} + - run: + name: "Build" + command: "bazel build //:packages" - run: name: "Move artifacts" command: | @@ -44,4 +113,7 @@ jobs: workflows: build-workflow: jobs: - - build + - build-x86 + - build-arm64 + - build-windows + - build-macos diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 2c6a8bd..63585dc 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -2,7 +2,7 @@ FROM mcr.microsoft.com/vscode/devcontainers/base:0-focal ARG NONROOT_USER=vscode # Install required programs for the container -RUN apt update -y && apt install apt-transport-https curl sudo gnupg python build-essential ca-certificates lsb-release -y && \ +RUN apt update -y && apt install libssl-dev pkg-config apt-transport-https curl sudo gnupg python build-essential ca-certificates lsb-release -y && \ # Add bazel repository gpg keys curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor -o /etc/apt/trusted.gpg.d/bazel.gpg && \ # Add docker repository gpg keys diff --git a/Cargo.lock b/Cargo.lock index df69d5a..dfdd79d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11,6 +11,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "arc-swap" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6df5aef5c5830360ce5218cecb8f018af3438af5686ae945094affc86fdec63" + [[package]] name = "arrayvec" version = "0.5.2" @@ -181,7 +187,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a909e4d93292cd8e9c42e189f61681eff9d67b6541f96b8a1a737f23737bd001" dependencies = [ "bytes", + "futures-core", "memchr", + "pin-project-lite", + "tokio", + "tokio-util", ] [[package]] @@ -194,6 +204,7 @@ dependencies = [ "nats", "pretty_env_logger", "prometheus", + "redis", "serde 1.0.130", "testcontainers", "tokio", @@ -249,6 +260,12 @@ dependencies = [ "libc", ] +[[package]] +name = "crc16" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "338089f42c427b86394a5ee60ff321da23a5c89c9d89514c829687b26359fcff" + [[package]] name = "crossbeam-channel" version = "0.5.1" @@ -1335,12 +1352,21 @@ version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "202c5bf92cad3d57605c366e644a7fbf305a83f19754fc66678c6265dcc9b8b4" dependencies = [ + "arc-swap", "async-trait", + "bytes", "combine", + "crc16", "dtoa", + "futures", + "futures-util", "itoa", "percent-encoding", + "pin-project-lite", + "rand 0.8.4", "sha1", + "tokio", + "tokio-util", "url", ] @@ -1387,8 +1413,10 @@ dependencies = [ "futures-util", "hyper", "hyper-tls", + "lazy_static", "serde 1.0.130", "tokio", + "xxhash-rust", ] [[package]] @@ -2095,6 +2123,7 @@ dependencies = [ "common", "hex", "hyper", + "lazy_static", "libc", "libsodium-sys", "serde 1.0.130", @@ -2152,6 +2181,12 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "xxhash-rust" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575e15bedf6e57b5c2d763ffc6c3c760143466cbd09d762d539680ab5992ded" + [[package]] name = "yaml-rust" version = "0.4.5" diff --git a/cargo/crates.bzl b/cargo/crates.bzl index 2d934cc..00b9b60 100644 --- a/cargo/crates.bzl +++ b/cargo/crates.bzl @@ -14,6 +14,7 @@ _DEPENDENCIES = { "webhook": { "hex": "@raze__hex__0_4_3//:hex", "hyper": "@raze__hyper__0_14_12//:hyper", + "lazy_static": "@raze__lazy_static__1_4_0//:lazy_static", "libc": "@raze__libc__0_2_101//:libc", "libsodium-sys": "@raze__libsodium_sys__0_2_7//:libsodium_sys", "serde": "@raze__serde__1_0_130//:serde", @@ -27,6 +28,7 @@ _DEPENDENCIES = { "nats": "@raze__nats__0_15_2//:nats", "pretty_env_logger": "@raze__pretty_env_logger__0_4_0//:pretty_env_logger", "prometheus": "@raze__prometheus__0_12_0//:prometheus", + "redis": "@raze__redis__0_21_2//:redis", "serde": "@raze__serde__1_0_130//:serde", "testcontainers": "@raze__testcontainers__0_12_0//:testcontainers", "tokio": "@raze__tokio__1_11_0//:tokio", @@ -54,8 +56,10 @@ _DEPENDENCIES = { "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", + "lazy_static": "@raze__lazy_static__1_4_0//:lazy_static", "serde": "@raze__serde__1_0_130//:serde", "tokio": "@raze__tokio__1_11_0//:tokio", + "xxhash-rust": "@raze__xxhash_rust__0_8_2//:xxhash_rust", }, "": { "libc": "@raze__libc__0_2_101//:libc", @@ -257,6 +261,16 @@ def raze_fetch_remote_crates(): build_file = Label("//cargo/remote:BUILD.aho-corasick-0.7.18.bazel"), ) + maybe( + http_archive, + name = "raze__arc_swap__1_4_0", + url = "https://crates.io/api/v1/crates/arc-swap/1.4.0/download", + type = "tar.gz", + sha256 = "e6df5aef5c5830360ce5218cecb8f018af3438af5686ae945094affc86fdec63", + strip_prefix = "arc-swap-1.4.0", + build_file = Label("//cargo/remote:BUILD.arc-swap-1.4.0.bazel"), + ) + maybe( http_archive, name = "raze__arrayvec__0_5_2", @@ -507,6 +521,16 @@ def raze_fetch_remote_crates(): build_file = Label("//cargo/remote:BUILD.cpufeatures-0.2.1.bazel"), ) + maybe( + http_archive, + name = "raze__crc16__0_4_0", + url = "https://crates.io/api/v1/crates/crc16/0.4.0/download", + type = "tar.gz", + sha256 = "338089f42c427b86394a5ee60ff321da23a5c89c9d89514c829687b26359fcff", + strip_prefix = "crc16-0.4.0", + build_file = Label("//cargo/remote:BUILD.crc16-0.4.0.bazel"), + ) + maybe( http_archive, name = "raze__crossbeam_channel__0_5_1", @@ -2407,6 +2431,16 @@ def raze_fetch_remote_crates(): build_file = Label("//cargo/remote:BUILD.winapi-x86_64-pc-windows-gnu-0.4.0.bazel"), ) + maybe( + http_archive, + name = "raze__xxhash_rust__0_8_2", + url = "https://crates.io/api/v1/crates/xxhash-rust/0.8.2/download", + type = "tar.gz", + sha256 = "e575e15bedf6e57b5c2d763ffc6c3c760143466cbd09d762d539680ab5992ded", + strip_prefix = "xxhash-rust-0.8.2", + build_file = Label("//cargo/remote:BUILD.xxhash-rust-0.8.2.bazel"), + ) + maybe( http_archive, name = "raze__yaml_rust__0_4_5", diff --git a/cargo/remote/BUILD.arc-swap-1.4.0.bazel b/cargo/remote/BUILD.arc-swap-1.4.0.bazel new file mode 100644 index 0000000..ddb399c --- /dev/null +++ b/cargo/remote/BUILD.arc-swap-1.4.0.bazel @@ -0,0 +1,63 @@ +""" +@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 OR MIT" +]) + +# Generated Targets + +# Unsupported target "background" with type "bench" omitted + +# Unsupported target "int-access" with type "bench" omitted + +# Unsupported target "track" with type "bench" omitted + +rust_library( + name = "arc_swap", + 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 = "1.4.0", + # buildifier: leave-alone + deps = [ + ], +) + +# Unsupported target "random" with type "test" omitted + +# Unsupported target "stress" with type "test" omitted diff --git a/cargo/remote/BUILD.combine-4.6.1.bazel b/cargo/remote/BUILD.combine-4.6.1.bazel index 6a52e24..afefc7c 100644 --- a/cargo/remote/BUILD.combine-4.6.1.bazel +++ b/cargo/remote/BUILD.combine-4.6.1.bazel @@ -49,10 +49,19 @@ licenses([ rust_library( name = "combine", srcs = glob(["**/*.rs"]), + aliases = { + "@raze__futures_core__0_3_17//:futures_core": "futures_core_03", + "@raze__tokio__1_11_0//:tokio": "tokio_dep", + }, crate_features = [ "alloc", "bytes", + "futures-core-03", + "pin-project-lite", "std", + "tokio", + "tokio-dep", + "tokio-util", ], crate_root = "src/lib.rs", crate_type = "lib", @@ -69,7 +78,11 @@ rust_library( # buildifier: leave-alone deps = [ "@raze__bytes__1_1_0//:bytes", + "@raze__futures_core__0_3_17//:futures_core", "@raze__memchr__2_4_1//:memchr", + "@raze__pin_project_lite__0_2_7//:pin_project_lite", + "@raze__tokio__1_11_0//:tokio", + "@raze__tokio_util__0_6_8//:tokio_util", ], ) diff --git a/cargo/remote/BUILD.crc16-0.4.0.bazel b/cargo/remote/BUILD.crc16-0.4.0.bazel new file mode 100644 index 0000000..b32cc8b --- /dev/null +++ b/cargo/remote/BUILD.crc16-0.4.0.bazel @@ -0,0 +1,83 @@ +""" +@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 +# 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 = "crc16_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.4.0", + visibility = ["//visibility:private"], + deps = [ + ], +) + +rust_library( + name = "crc16", + srcs = glob(["**/*.rs"]), + crate_features = [ + ], + crate_root = "src/lib.rs", + crate_type = "lib", + data = [], + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.4.0", + # buildifier: leave-alone + deps = [ + ":crc16_build_script", + ], +) diff --git a/cargo/remote/BUILD.redis-0.21.2.bazel b/cargo/remote/BUILD.redis-0.21.2.bazel index 6305a27..adf435c 100644 --- a/cargo/remote/BUILD.redis-0.21.2.bazel +++ b/cargo/remote/BUILD.redis-0.21.2.bazel @@ -55,11 +55,24 @@ rust_library( srcs = glob(["**/*.rs"]), crate_features = [ "acl", + "aio", + "arc-swap", + "bytes", + "cluster", + "connection-manager", + "crc16", "default", + "futures", + "futures-util", "geospatial", + "pin-project-lite", + "rand", "script", "sha1", "streams", + "tokio", + "tokio-comp", + "tokio-util", ], crate_root = "src/lib.rs", crate_type = "lib", @@ -78,11 +91,20 @@ rust_library( version = "0.21.2", # buildifier: leave-alone deps = [ + "@raze__arc_swap__1_4_0//:arc_swap", + "@raze__bytes__1_1_0//:bytes", "@raze__combine__4_6_1//:combine", + "@raze__crc16__0_4_0//:crc16", "@raze__dtoa__0_4_8//:dtoa", + "@raze__futures__0_3_17//:futures", + "@raze__futures_util__0_3_17//:futures_util", "@raze__itoa__0_4_8//:itoa", "@raze__percent_encoding__2_1_0//:percent_encoding", + "@raze__pin_project_lite__0_2_7//:pin_project_lite", + "@raze__rand__0_8_4//:rand", "@raze__sha1__0_6_0//:sha1", + "@raze__tokio__1_11_0//:tokio", + "@raze__tokio_util__0_6_8//:tokio_util", "@raze__url__2_2_2//:url", ], ) diff --git a/cargo/remote/BUILD.tokio-util-0.6.8.bazel b/cargo/remote/BUILD.tokio-util-0.6.8.bazel index 63a17e8..7f8ee44 100644 --- a/cargo/remote/BUILD.tokio-util-0.6.8.bazel +++ b/cargo/remote/BUILD.tokio-util-0.6.8.bazel @@ -36,6 +36,7 @@ rust_library( crate_features = [ "codec", "default", + "io", ], crate_root = "src/lib.rs", crate_type = "lib", diff --git a/cargo/remote/BUILD.xxhash-rust-0.8.2.bazel b/cargo/remote/BUILD.xxhash-rust-0.8.2.bazel new file mode 100644 index 0000000..c76cb22 --- /dev/null +++ b/cargo/remote/BUILD.xxhash-rust-0.8.2.bazel @@ -0,0 +1,58 @@ +""" +@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", # BSL-1.0 from expression "BSL-1.0" +]) + +# Generated Targets + +# Unsupported target "compare_c" with type "bench" omitted + +rust_library( + name = "xxhash_rust", + srcs = glob(["**/*.rs"]), + crate_features = [ + "xxh32", + ], + crate_root = "src/lib.rs", + crate_type = "lib", + data = [], + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.8.2", + # buildifier: leave-alone + deps = [ + ], +) + +# Unsupported target "assert_correctness" with type "test" omitted diff --git a/common/rust/Cargo.toml b/common/rust/Cargo.toml index a373caa..e546cba 100644 --- a/common/rust/Cargo.toml +++ b/common/rust/Cargo.toml @@ -12,4 +12,8 @@ hyper = { version = "0.14", features = ["full"] } tokio = { version = "1", features = ["full"] } prometheus = "0.12.0" nats = "0.15.2" -testcontainers = "0.12.0" \ No newline at end of file +testcontainers = "0.12.0" + +[dependencies.redis] +version = "*" +features = ["cluster", "connection-manager", "tokio-comp"] diff --git a/common/rust/cargo/BUILD.bazel b/common/rust/cargo/BUILD.bazel index 88b84fa..e0e6aa6 100644 --- a/common/rust/cargo/BUILD.bazel +++ b/common/rust/cargo/BUILD.bazel @@ -66,6 +66,15 @@ alias( ], ) +alias( + name = "redis", + actual = "@raze__redis__0_21_2//:redis", + tags = [ + "cargo-raze", + "manual", + ], +) + alias( name = "serde", actual = "@raze__serde__1_0_130//:serde", diff --git a/common/rust/src/config.rs b/common/rust/src/config.rs index c4ad7b0..e4dbade 100644 --- a/common/rust/src/config.rs +++ b/common/rust/src/config.rs @@ -14,6 +14,7 @@ pub struct Settings { pub config: T, pub monitoring: crate::monitoring::MonitoringConfiguration, pub nats: crate::nats::NatsConfiguration, + pub redis: crate::redis::RedisConfiguration, } /// diff --git a/common/rust/src/lib.rs b/common/rust/src/lib.rs index be3c913..f4e27fc 100644 --- a/common/rust/src/lib.rs +++ b/common/rust/src/lib.rs @@ -5,10 +5,12 @@ pub mod monitoring; pub mod nats; pub mod payloads; pub mod error; +pub mod redis; 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 +pub use testcontainers as testcontainers; +pub use ::redis as redis_crate; \ No newline at end of file diff --git a/common/rust/src/redis.rs b/common/rust/src/redis.rs new file mode 100644 index 0000000..a196f8d --- /dev/null +++ b/common/rust/src/redis.rs @@ -0,0 +1,15 @@ +use redis::Client; +use serde::Deserialize; + + +#[derive(Clone, Debug, Deserialize)] +pub struct RedisConfiguration { + pub url: String, +} + +// Allows the configuration to directly create a nats connection +impl Into for RedisConfiguration { + fn into(self) -> Client { + redis::Client::open(self.url).unwrap() + } +} diff --git a/rest/Cargo.toml b/rest/Cargo.toml index 08e7911..0264852 100644 --- a/rest/Cargo.toml +++ b/rest/Cargo.toml @@ -12,3 +12,5 @@ tokio = { version = "1", features = ["full"] } serde = { version = "1.0.8", features = ["derive"] } futures-util = "0.3.17" hyper-tls = "0.5.0" +lazy_static = "1.4.0" +xxhash-rust = { version = "0.8.2", features = ["xxh32"] } \ No newline at end of file diff --git a/rest/cargo/BUILD.bazel b/rest/cargo/BUILD.bazel index d664b3c..c56ad3d 100644 --- a/rest/cargo/BUILD.bazel +++ b/rest/cargo/BUILD.bazel @@ -39,6 +39,15 @@ alias( ], ) +alias( + name = "lazy_static", + actual = "@raze__lazy_static__1_4_0//:lazy_static", + tags = [ + "cargo-raze", + "manual", + ], +) + alias( name = "serde", actual = "@raze__serde__1_0_130//:serde", @@ -56,3 +65,12 @@ alias( "manual", ], ) + +alias( + name = "xxhash_rust", + actual = "@raze__xxhash_rust__0_8_2//:xxhash_rust", + tags = [ + "cargo-raze", + "manual", + ], +) diff --git a/rest/src/main.rs b/rest/src/main.rs index 703c9f4..ae993d9 100644 --- a/rest/src/main.rs +++ b/rest/src/main.rs @@ -1,19 +1,30 @@ use std::{convert::Infallible, sync::Arc}; -use crate::config::Config; -use common::{config::Settings, log::{error, info}}; +use crate::{config::Config, ratelimit::Ratelimiter}; +use common::{ + config::Settings, + log::{error, info}, + redis_crate::Client, +}; use hyper::{server::conn::AddrStream, service::make_service_fn, Server}; use std::net::ToSocketAddrs; +use tokio::sync::Mutex; use crate::proxy::ServiceProxy; mod config; mod proxy; +mod ratelimit; #[tokio::main] async fn main() { let settings: Settings = Settings::new("rest").unwrap(); let config = Arc::new(settings.config); + let redis_client: Client = settings.redis.into(); + let redis = Arc::new(Mutex::new( + redis_client.get_async_connection().await.unwrap(), + )); + let ratelimiter = Arc::new(Ratelimiter::new(redis)); let addr = format!("{}:{}", config.server.address, config.server.port) .to_socket_addrs() @@ -22,7 +33,7 @@ async fn main() { .unwrap(); let service_fn = make_service_fn(move |_: &AddrStream| { - let service_proxy = ServiceProxy::new(config.clone()); + let service_proxy = ServiceProxy::new(config.clone(), ratelimiter.clone()); async move { Ok::<_, Infallible>(service_proxy) } }); diff --git a/rest/src/proxy/mod.rs b/rest/src/proxy/mod.rs index fafbf9a..a684290 100644 --- a/rest/src/proxy/mod.rs +++ b/rest/src/proxy/mod.rs @@ -1,4 +1,4 @@ -use crate::config::Config; +use crate::{config::Config, ratelimit::Ratelimiter}; use futures_util::future::TryFutureExt; use hyper::{ client::HttpConnector, header::HeaderValue, http::uri::Parts, service::Service, Body, Client, @@ -10,6 +10,7 @@ use std::{future::Future, pin::Pin, sync::Arc, task::Poll}; #[derive(Clone)] pub struct ServiceProxy { client: Client>, + ratelimiter: Arc, config: Arc, } @@ -66,9 +67,9 @@ impl Service> for ServiceProxy { } impl ServiceProxy { - pub fn new(config: Arc) -> Self { + pub fn new(config: Arc, ratelimiter: Arc) -> Self { let https = HttpsConnector::new(); let client = Client::builder().build::<_, hyper::Body>(https); - ServiceProxy { client, config } + ServiceProxy { client, config, ratelimiter } } } diff --git a/rest/src/ratelimit/mod.rs b/rest/src/ratelimit/mod.rs new file mode 100644 index 0000000..c9c7643 --- /dev/null +++ b/rest/src/ratelimit/mod.rs @@ -0,0 +1,31 @@ +use common::redis_crate::{AsyncCommands, RedisError, aio::Connection}; +use hyper::{Body, Request}; +use tokio::sync::Mutex; +use std::sync::Arc; +use xxhash_rust::xxh32::xxh32; + +pub struct Ratelimiter { + redis: Arc> +} + +impl Ratelimiter { + pub fn new(redis: Arc>) -> Ratelimiter { + return Ratelimiter { + redis + } + } + + pub async fn check(&mut self,request: Request) -> bool { + // we lookup if the route hash is stored in the redis table + let path = request.uri().path(); + let hash = xxh32(path.as_bytes(), 32); + let key = format!("nova:rest:ratelimit:url_store:{}", hash); + let mut redis = self.redis.lock().await; + let value: Result = redis.get(key).await; + + match value { + Ok(_) => true, + Err(error) => false, + } + } +} -- cgit v1.2.3 From bd637cc3c77dd246ff3a154461ae7e83e1e648b5 Mon Sep 17 00:00:00 2001 From: Matthieu Date: Fri, 15 Oct 2021 14:20:59 +0400 Subject: fix circle ci --- .circleci/config.yml | 11 +++++++++-- .devcontainer/devcontainer.json | 2 +- common/rust/src/error.rs | 6 ++++++ rest/src/proxy/mod.rs | 40 +++++++++++++++++++++++++++++----------- rest/src/ratelimit/mod.rs | 10 ++++++---- webhook/src/main.rs | 1 - 6 files changed, 51 insertions(+), 19 deletions(-) (limited to 'common/rust/src') diff --git a/.circleci/config.yml b/.circleci/config.yml index 5ca796b..1189563 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -36,6 +36,9 @@ jobs: name: "Test" command: "bazelisk test //:tests || true" + - store_artifacts: + path: ~/project/bazel-testlogs + - store_test_results: path: ~/project/bazel-testlogs/rest - store_test_results: @@ -74,6 +77,9 @@ jobs: - store_test_results: path: ~/project/bazel-testlogs/webhook + - store_artifacts: + path: ~/project/bazel-testlogs + - run: name: "Build" command: "bazelisk build //:packages" @@ -103,13 +109,14 @@ jobs: - run: name: "Test" command: | - $ErrorActionPreference = ‘SilentlyContinue’ - bazelisk test //:tests + bazelisk test //:tests | Out-Null - store_test_results: path: ~/project/bazel-testlogs/rest - store_test_results: path: ~/project/bazel-testlogs/webhook + - store_artifacts: + path: ~/project/bazel-testlogs - run: name: "Build" diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 03c3e4c..a962bc7 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -36,5 +36,5 @@ // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. "remoteUser": "vscode", "overrideCommand": false, - "runArgs": ["--init"], + "runArgs": ["--init", "--network=host"] } \ No newline at end of file diff --git a/common/rust/src/error.rs b/common/rust/src/error.rs index be1607a..1a24657 100644 --- a/common/rust/src/error.rs +++ b/common/rust/src/error.rs @@ -10,3 +10,9 @@ impl fmt::Display for NovaError { write!(f, "An error occurred within the nova system: {}", self.message) // user-facing output } } + +impl From<&str> for NovaError { + fn from(message: &str) -> Self { + NovaError { message: message.to_string() } + } +} \ No newline at end of file diff --git a/rest/src/proxy/mod.rs b/rest/src/proxy/mod.rs index a684290..ad1abba 100644 --- a/rest/src/proxy/mod.rs +++ b/rest/src/proxy/mod.rs @@ -14,6 +14,10 @@ pub struct ServiceProxy { config: Arc, } +impl ServiceProxy { + async fn proxy_call() {} +} + impl Service> for ServiceProxy { type Response = Response; type Error = hyper::Error; @@ -51,18 +55,32 @@ impl Service> for ServiceProxy { ); *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); - } + let client = self.client.clone(); + let ratelimiter = self.ratelimiter.clone(); - res - }); - - return Box::pin(res); + return Box::pin(async move { + match ratelimiter.check(&req).await { + Ok(allowed) => match allowed { + true => { + Ok(client + .request(req) + .map_ok(move |res| { + if let Some(bucket) = res.headers().get("x-ratelimit-bucket") { + + println!("bucket ratelimit! {:?} : {:?}", path, bucket); + } + res + }).await.unwrap()) + }, + false => { + Ok(Response::builder().body("ratelimited".into()).unwrap()) + }, + }, + Err(_) => { + Ok(Response::builder().body("server error".into()).unwrap()) + }, + } + }); } } diff --git a/rest/src/ratelimit/mod.rs b/rest/src/ratelimit/mod.rs index c9c7643..07db643 100644 --- a/rest/src/ratelimit/mod.rs +++ b/rest/src/ratelimit/mod.rs @@ -1,4 +1,4 @@ -use common::redis_crate::{AsyncCommands, RedisError, aio::Connection}; +use common::{error::NovaError, redis_crate::{AsyncCommands, RedisError, aio::Connection}}; use hyper::{Body, Request}; use tokio::sync::Mutex; use std::sync::Arc; @@ -15,7 +15,7 @@ impl Ratelimiter { } } - pub async fn check(&mut self,request: Request) -> bool { + pub async fn check(&self,request: &Request) -> Result { // we lookup if the route hash is stored in the redis table let path = request.uri().path(); let hash = xxh32(path.as_bytes(), 32); @@ -24,8 +24,10 @@ impl Ratelimiter { let value: Result = redis.get(key).await; match value { - Ok(_) => true, - Err(error) => false, + Ok(response) => { + Ok(false) + }, + Err(error) => Err(NovaError::from("failed to issue redis request")), } } } diff --git a/webhook/src/main.rs b/webhook/src/main.rs index eef4751..98e5f13 100644 --- a/webhook/src/main.rs +++ b/webhook/src/main.rs @@ -15,7 +15,6 @@ async fn main() { } async fn start(settings: Settings) { - let addr = format!( "{}:{}", settings.config.server.address, settings.config.server.port -- cgit v1.2.3