diff options
| -rw-r--r-- | .github/workflows/build.yml | 7 | ||||
| -rw-r--r-- | Cargo.lock | 98 | ||||
| -rw-r--r-- | config/default.yml | 51 | ||||
| -rw-r--r-- | exes/all/main.go | 2 | ||||
| -rw-r--r-- | exes/rest/Cargo.toml | 2 | ||||
| -rw-r--r-- | exes/rest/src/handler.rs | 2 | ||||
| -rw-r--r-- | exes/rest/src/lib.rs | 10 | 
7 files changed, 63 insertions, 109 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 719eddb..4d0de2e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -57,12 +57,6 @@ jobs:        - uses: ATiltedTree/setup-rust@v1          with:            rust-version: stable -      - uses: actions/setup-go@v3 -        with: -          go-version: '1.18.4' -      - run: | -          brew install openssl -          brew link openssl --force        - name: Build          run: |            cargo build --release @@ -72,7 +66,6 @@ jobs:        - name: All in one          run: |            cd exes/all -          export CGO_LDFLAGS="-L/usr/local/opt/openssl@3/lib -framework Security -framework CoreFoundation"            make build        - name: Move artifacts @@ -722,21 +722,6 @@ 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.1.0"  source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1046,6 +1031,7 @@ checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c"  dependencies = [   "http",   "hyper", + "log",   "rustls",   "rustls-native-certs",   "tokio", @@ -1065,19 +1051,6 @@ dependencies = [  ]  [[package]] -name = "hyper-tls" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" -dependencies = [ - "bytes", - "hyper", - "native-tls", - "tokio", - "tokio-native-tls", -] - -[[package]]  name = "iana-time-zone"  version = "0.1.53"  source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1322,24 +1295,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"  checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a"  [[package]] -name = "native-tls" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" -dependencies = [ - "lazy_static", - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - -[[package]]  name = "nkeys"  version = "0.2.0"  source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1416,51 +1371,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"  checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"  [[package]] -name = "openssl" -version = "0.10.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1" -dependencies = [ - "bitflags", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]]  name = "openssl-probe"  version = "0.1.5"  source = "registry+https://github.com/rust-lang/crates.io-index"  checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"  [[package]] -name = "openssl-sys" -version = "0.9.80" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7" -dependencies = [ - "autocfg", - "cc", - "libc", - "pkg-config", - "vcpkg", -] - -[[package]]  name = "ordered-float"  version = "2.10.0"  source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1943,7 +1859,7 @@ dependencies = [   "hashring",   "http",   "hyper", - "hyper-tls", + "hyper-rustls",   "lazy_static",   "leash",   "proto", @@ -2550,16 +2466,6 @@ dependencies = [  ]  [[package]] -name = "tokio-native-tls" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" -dependencies = [ - "native-tls", - "tokio", -] - -[[package]]  name = "tokio-retry"  version = "0.3.0"  source = "registry+https://github.com/rust-lang/crates.io-index" diff --git a/config/default.yml b/config/default.yml new file mode 100644 index 0000000..1e42f07 --- /dev/null +++ b/config/default.yml @@ -0,0 +1,51 @@ +gateway: +  token: ODA3MTg4MzM1NzE3Mzg0MjEy.Gtk5vu.Ejt9d70tnB9W_tXYMUATsBU24nqwQjlUZy7QUo +  intents: 3276799 +  shard: 0 +  shard_total: 1 + +rest: +  discord: +    token: ODA3MTg4MzM1NzE3Mzg0MjEy.Gtk5vu.Ejt9d70tnB9W_tXYMUATsBU24nqwQjlUZy7QUo +  server: +    listening_adress: 0.0.0.0:8090 + +webhook: +  discord: +    public_key: a3d9368eda990e11ca501655d219a2d88591de93d32037f62f453a8587a46ff5 +    client_id: 807188335717384212 +  server: +    listening_adress: 0.0.0.0:8091 + +cache: +  toggles: +    - channels_cache +    - guilds_cache +    - guild_schedules_cache +    - stage_instances_cache +    - integrations_cache +    - members_cache +    - bans_cache +    - reactions_cache +    - messages_cache +    - threads_cache +    - invites_cache +    - roles_cache +    - automoderation_cache +    - voice_states_cache + +ratelimiter: +   + +# Prometheus monitoring configuration +monitoring: +  enabled: false +  address: 0.0.0.0 +  port: 9000 + +# Nats broker configuration +nats: +  host: nats + +redis: +  url: redis://redis diff --git a/exes/all/main.go b/exes/all/main.go index 3a8a9d8..3d528c9 100644 --- a/exes/all/main.go +++ b/exes/all/main.go @@ -1,7 +1,7 @@  package main  /* -#cgo LDFLAGS: -L./build -lall -lcrypto -lz -ldl -lssl -lm +#cgo LDFLAGS: -L./build -lall -lz -lm  #include "./build/all.h"  */  import "C" diff --git a/exes/rest/Cargo.toml b/exes/rest/Cargo.toml index f4c5ecc..f28018e 100644 --- a/exes/rest/Cargo.toml +++ b/exes/rest/Cargo.toml @@ -14,7 +14,7 @@ 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" +hyper-rustls = "0.23.2"  lazy_static = "1.4.0"  xxhash-rust = { version = "0.8.2", features = ["xxh32"] }  twilight-http-ratelimiting = { git = "https://github.com/MatthieuCoder/twilight.git" } diff --git a/exes/rest/src/handler.rs b/exes/rest/src/handler.rs index 004f763..6168c9d 100644 --- a/exes/rest/src/handler.rs +++ b/exes/rest/src/handler.rs @@ -12,7 +12,7 @@ use http::{      HeaderValue, Method as HttpMethod, Request, Response, Uri,  };  use hyper::{client::HttpConnector, Body, Client}; -use hyper_tls::HttpsConnector; +use hyper_rustls::HttpsConnector;  use shared::log::error;  use twilight_http_ratelimiting::{Method, Path}; diff --git a/exes/rest/src/lib.rs b/exes/rest/src/lib.rs index 02721cc..02196f4 100644 --- a/exes/rest/src/lib.rs +++ b/exes/rest/src/lib.rs @@ -6,7 +6,6 @@ use hyper::{      service::{make_service_fn, service_fn},      Body, Client, Request, Server,  }; -use hyper_tls::HttpsConnector;  use leash::{AnyhowResultFuture, Component};  use shared::config::Settings;  use std::{convert::Infallible, sync::Arc}; @@ -29,8 +28,13 @@ impl Component for ReverseProxyServer {          Box::pin(async move {              // Client to the remote ratelimiters              let ratelimiter = ratelimit_client::RemoteRatelimiter::new(); -            let client = Client::builder().build(HttpsConnector::new()); +            let https = hyper_rustls::HttpsConnectorBuilder::new() +                .with_native_roots() +                .https_only() +                .enable_http1() +                .build(); +            let client: Client<_, hyper::Body> = Client::builder().build(https);              let token = Arc::new(settings.discord.token.clone());              let service_fn = make_service_fn(move |_: &AddrStream| {                  let client = client.clone(); @@ -64,4 +68,4 @@ impl Component for ReverseProxyServer {      fn new() -> Self {          Self {}      } -}
\ No newline at end of file +}  | 
