* Removed rate limiter becase it was unmaintained
* updated base64, rustls
This commit is contained in:
Piyush मिश्रः 2023-06-16 18:09:15 +05:30
parent b8be7e468d
commit 170f34cd0a
3 changed files with 689 additions and 423 deletions

1082
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -14,11 +14,10 @@ keywords = ["chat", "Chatting", "Talk", "Stranger"]
[dependencies]
actix = "0.10"
actix-web = { version = "3", features = ["rustls"] }
actix-web = { version = "4", features = ["rustls"] }
actix-web-actors = "3"
actix-broker = "0.3"
actix-files = "0.5"
actix-ratelimit = "0.3"
actix-files = "0.6"
env_logger = "0.9"
openssl = "0.10"
@ -31,8 +30,8 @@ rand = "0.8"
tokio = { version = "1.5", features = ['rt', 'rt-multi-thread', 'macros'] }
sha2 = "0.10"
base64 = "0.13"
log = "0.4.17"
rustls = "0.18.0"
base64 = "0.21"
log = "0.4"
rustls = "0.20"
rustls-pemfile = "1.0.2"
anyhow = { version = "1.0.71", features = ["backtrace"] }

View File

@ -39,7 +39,7 @@ use actix_web::{
};
use actix_web_actors::ws;
use config::CONFIG;
use rustls::{Certificate, NoClientAuth, PrivateKey, ServerConfig};
use rustls::{Certificate, PrivateKey, ServerConfig};
use std::fs::File;
use ws_sansad::WsSansad;
@ -59,11 +59,6 @@ async fn main() -> std::io::Result<()> {
let main_server = HttpServer::new(move || {
let mut app = App::new()
.wrap(
RateLimiter::new(MemoryStoreActor::from(MemoryStore::new().clone()).start())
.with_interval(std::time::Duration::from_secs(60))
.with_max_requests(200),
)
.wrap(Logger::new(&CONFIG.logger_pattern))
.service(web::resource("/ws/").route(web::get().to(ws_index)));
@ -114,8 +109,16 @@ fn gen_rustls_server_config(key: String, cert: String) -> ServerConfig {
let private_key = PrivateKey(private_key.to_owned());
let mut config = ServerConfig::new(NoClientAuth::new());
config.set_single_cert(certs, private_key).unwrap();
let mut config = ServerConfig::builder()
.with_safe_default_cipher_suites()
.with_safe_default_kx_groups()
.with_safe_default_protocol_versions()
.map_err(|e| anyhow!(e))
.expect("Build TLS!")
.with_no_client_auth()
.with_single_cert(certs, private_key)
.map_err(|e| anyhow!(e))
.expect("Add TLS certificates!");
config
}