✨ Compress
This commit is contained in:
parent
d75ac2999b
commit
515f086f19
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,5 +1,6 @@
|
||||
/config
|
||||
/certs
|
||||
/test/data
|
||||
/letsencrypt
|
||||
|
||||
# Added by cargo
|
||||
|
@ -63,13 +63,13 @@ impl Destination {
|
||||
}
|
||||
|
||||
pub fn get_host(&self) -> &str {
|
||||
(self
|
||||
self
|
||||
.uri
|
||||
.as_str()
|
||||
.splitn(2, "://")
|
||||
.collect::<Vec<_>>()
|
||||
.get(1)
|
||||
.unwrap_or(&""))
|
||||
.unwrap_or(&"")
|
||||
.splitn(2, '?')
|
||||
.collect::<Vec<_>>()[0]
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ impl RoadTrace {
|
||||
) -> RoadTrace {
|
||||
let mut trace = Self::from_structs(ip, ua, reg, loc, end);
|
||||
trace.error = Some(err);
|
||||
return trace;
|
||||
trace
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,12 +2,12 @@ use crate::proxies::ProxyError;
|
||||
use crate::proxies::ProxyError::{BadGateway, UpgradeRequired};
|
||||
use actix_files::NamedFile;
|
||||
use actix_web::http::{header, Method};
|
||||
use actix_web::web::BytesMut;
|
||||
use actix_web::{web, Error, HttpRequest, HttpResponse};
|
||||
use actix_web::{web, HttpRequest, HttpResponse};
|
||||
use awc::error::HeaderValue;
|
||||
use awc::http::Uri;
|
||||
use awc::Client;
|
||||
use futures::{channel::mpsc::unbounded, Sink, sink::SinkExt, stream::StreamExt};
|
||||
use futures::Sink;
|
||||
use futures::stream::StreamExt;
|
||||
use std::str::FromStr;
|
||||
use std::time::Duration;
|
||||
use std::{
|
||||
@ -18,7 +18,6 @@ use actix::io::{SinkWrite, WriteHandler};
|
||||
use actix::{Actor, ActorContext, AsyncContext, StreamHandler};
|
||||
use actix_web_actors::ws;
|
||||
use actix_web_actors::ws::{CloseReason, handshake, ProtocolError, WebsocketContext};
|
||||
use tokio::io::{AsyncReadExt, AsyncWriteExt};
|
||||
use tracing::log::warn;
|
||||
|
||||
pub async fn respond_hypertext(
|
||||
|
@ -1,7 +1,7 @@
|
||||
use std::error;
|
||||
use actix_web::{App, HttpServer, web};
|
||||
use actix_web::dev::Server;
|
||||
use actix_web::middleware::Logger;
|
||||
use actix_web::middleware::{Compress, Logger};
|
||||
use awc::Client;
|
||||
use crate::config::CFG;
|
||||
use crate::proxies::route;
|
||||
@ -28,6 +28,7 @@ pub fn build_single_proxy(cfg: ServerBindConfig) -> Result<Server, Box<dyn error
|
||||
let server = HttpServer::new(|| {
|
||||
App::new()
|
||||
.wrap(Logger::default())
|
||||
.wrap(Compress::default())
|
||||
.app_data(web::Data::new(Client::default()))
|
||||
.default_service(web::to(route::handle))
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user