mirror of https://github.com/PiyushXCoder/lupt.git
Changes
* Removed rate limiter becase it was unmaintained * updated base64, rustls
This commit is contained in:
parent
b8be7e468d
commit
170f34cd0a
File diff suppressed because it is too large
Load Diff
11
Cargo.toml
11
Cargo.toml
|
|
@ -14,11 +14,10 @@ keywords = ["chat", "Chatting", "Talk", "Stranger"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix = "0.10"
|
actix = "0.10"
|
||||||
actix-web = { version = "3", features = ["rustls"] }
|
actix-web = { version = "4", features = ["rustls"] }
|
||||||
actix-web-actors = "3"
|
actix-web-actors = "3"
|
||||||
actix-broker = "0.3"
|
actix-broker = "0.3"
|
||||||
actix-files = "0.5"
|
actix-files = "0.6"
|
||||||
actix-ratelimit = "0.3"
|
|
||||||
env_logger = "0.9"
|
env_logger = "0.9"
|
||||||
openssl = "0.10"
|
openssl = "0.10"
|
||||||
|
|
||||||
|
|
@ -31,8 +30,8 @@ rand = "0.8"
|
||||||
tokio = { version = "1.5", features = ['rt', 'rt-multi-thread', 'macros'] }
|
tokio = { version = "1.5", features = ['rt', 'rt-multi-thread', 'macros'] }
|
||||||
|
|
||||||
sha2 = "0.10"
|
sha2 = "0.10"
|
||||||
base64 = "0.13"
|
base64 = "0.21"
|
||||||
log = "0.4.17"
|
log = "0.4"
|
||||||
rustls = "0.18.0"
|
rustls = "0.20"
|
||||||
rustls-pemfile = "1.0.2"
|
rustls-pemfile = "1.0.2"
|
||||||
anyhow = { version = "1.0.71", features = ["backtrace"] }
|
anyhow = { version = "1.0.71", features = ["backtrace"] }
|
||||||
|
|
|
||||||
19
src/main.rs
19
src/main.rs
|
|
@ -39,7 +39,7 @@ use actix_web::{
|
||||||
};
|
};
|
||||||
use actix_web_actors::ws;
|
use actix_web_actors::ws;
|
||||||
use config::CONFIG;
|
use config::CONFIG;
|
||||||
use rustls::{Certificate, NoClientAuth, PrivateKey, ServerConfig};
|
use rustls::{Certificate, PrivateKey, ServerConfig};
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use ws_sansad::WsSansad;
|
use ws_sansad::WsSansad;
|
||||||
|
|
||||||
|
|
@ -59,11 +59,6 @@ async fn main() -> std::io::Result<()> {
|
||||||
|
|
||||||
let main_server = HttpServer::new(move || {
|
let main_server = HttpServer::new(move || {
|
||||||
let mut app = App::new()
|
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))
|
.wrap(Logger::new(&CONFIG.logger_pattern))
|
||||||
.service(web::resource("/ws/").route(web::get().to(ws_index)));
|
.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 private_key = PrivateKey(private_key.to_owned());
|
||||||
|
|
||||||
let mut config = ServerConfig::new(NoClientAuth::new());
|
let mut config = ServerConfig::builder()
|
||||||
config.set_single_cert(certs, private_key).unwrap();
|
.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
|
config
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue