Skip to content

Commit

Permalink
Showing 87 changed files with 213 additions and 238 deletions.
4 changes: 2 additions & 2 deletions g3bench/src/target/h1/task.rs
Original file line number Diff line number Diff line change
@@ -101,13 +101,13 @@ impl HttpTaskContext {
r,
self.proc_args.tcp_sock_speed_limit.shift_millis,
self.proc_args.tcp_sock_speed_limit.max_south,
self.runtime_stats.clone() as _,
self.runtime_stats.clone(),
);
let w = LimitedWriter::new(
w,
self.proc_args.tcp_sock_speed_limit.shift_millis,
self.proc_args.tcp_sock_speed_limit.max_north,
self.runtime_stats.clone() as _,
self.runtime_stats.clone(),
);
Ok(SavedHttpForwardConnection::new(BufReader::new(r), w))
}
10 changes: 5 additions & 5 deletions g3proxy/src/escape/direct_fixed/http_forward/mod.rs
Original file line number Diff line number Diff line change
@@ -56,14 +56,14 @@ impl DirectFixedEscaper {
ups_r,
limit_config.shift_millis,
limit_config.max_south,
self.stats.clone() as _,
Arc::new(r_wrapper_stats) as _,
self.stats.clone(),
Arc::new(r_wrapper_stats),
);
let ups_w = LimitedWriter::new(
ups_w,
limit_config.shift_millis,
limit_config.max_north,
Arc::new(w_wrapper_stats) as _,
Arc::new(w_wrapper_stats),
);

let writer = DirectHttpForwardWriter::new(ups_w, Some(Arc::clone(&self.stats)));
@@ -99,9 +99,9 @@ impl DirectFixedEscaper {
let ups_r = LimitedBufReader::new_unlimited(
ups_r,
Arc::new(NilLimitedReaderStats::default()),
wrapper_stats.clone() as _,
wrapper_stats.clone(),
);
let ups_w = LimitedWriter::new_unlimited(ups_w, wrapper_stats as _);
let ups_w = LimitedWriter::new_unlimited(ups_w, wrapper_stats);

let writer = DirectHttpForwardWriter::<_, DirectFixedEscaperStats>::new(ups_w, None);
let reader = DirectHttpForwardReader::new(ups_r);
2 changes: 1 addition & 1 deletion g3proxy/src/escape/direct_fixed/http_forward/reader.rs
Original file line number Diff line number Diff line change
@@ -105,7 +105,7 @@ where
) {
let mut wrapper_stats = HttpForwardTaskRemoteWrapperStats::new(Arc::clone(task_stats));
wrapper_stats.push_user_io_stats(user_stats);
self.inner.reset_buffer_stats(Arc::new(wrapper_stats) as _);
self.inner.reset_buffer_stats(Arc::new(wrapper_stats));
}

async fn recv_response_header<'a>(
4 changes: 2 additions & 2 deletions g3proxy/src/escape/direct_fixed/http_forward/writer.rs
Original file line number Diff line number Diff line change
@@ -96,11 +96,11 @@ where
if let Some(escaper_stats) = &self.escaper_stats {
let mut wrapper_stats = HttpForwardRemoteWrapperStats::new(escaper_stats, task_stats);
wrapper_stats.push_user_io_stats(user_stats);
self.inner.reset_stats(Arc::new(wrapper_stats) as _);
self.inner.reset_stats(Arc::new(wrapper_stats));
} else {
let mut wrapper_stats = HttpForwardTaskRemoteWrapperStats::new(Arc::clone(task_stats));
wrapper_stats.push_user_io_stats(user_stats);
self.inner.reset_stats(Arc::new(wrapper_stats) as _);
self.inner.reset_stats(Arc::new(wrapper_stats));
}
}

4 changes: 2 additions & 2 deletions g3proxy/src/escape/direct_fixed/mod.rs
Original file line number Diff line number Diff line change
@@ -267,7 +267,7 @@ impl Escaper for DirectFixedEscaper {
}

fn get_escape_stats(&self) -> Option<ArcEscaperStats> {
Some(Arc::clone(&self.stats) as _)
Some(self.stats.clone())
}

async fn publish(&self, _data: String) -> anyhow::Result<()> {
@@ -324,7 +324,7 @@ impl Escaper for DirectFixedEscaper {
}

fn new_http_forward_context(&self, escaper: ArcEscaper) -> BoxHttpForwardContext {
let ctx = DirectHttpForwardContext::new(Arc::clone(&self.stats) as _, escaper);
let ctx = DirectHttpForwardContext::new(self.stats.clone(), escaper);
Box::new(ctx)
}

4 changes: 2 additions & 2 deletions g3proxy/src/escape/direct_fixed/tcp_connect/mod.rs
Original file line number Diff line number Diff line change
@@ -465,13 +465,13 @@ impl DirectFixedEscaper {
r,
limit_config.shift_millis,
limit_config.max_south,
wrapper_stats.clone() as _,
wrapper_stats.clone(),
);
let w = LimitedWriter::new(
w,
limit_config.shift_millis,
limit_config.max_north,
wrapper_stats as _,
wrapper_stats,
);

Ok((Box::new(r), Box::new(w)))
6 changes: 3 additions & 3 deletions g3proxy/src/escape/direct_fixed/tls_connect/mod.rs
Original file line number Diff line number Diff line change
@@ -49,7 +49,7 @@ impl DirectFixedEscaper {
limit_config.shift_millis,
limit_config.max_south,
limit_config.max_north,
self.stats.clone() as _,
self.stats.clone(),
);

let ssl = tls_config
@@ -112,8 +112,8 @@ impl DirectFixedEscaper {
wrapper_stats.push_other_stats(self.fetch_user_upstream_io_stats(task_notes));
let wrapper_stats = Arc::new(wrapper_stats);

let ups_r = LimitedReader::new_unlimited(ups_r, wrapper_stats.clone() as _);
let ups_w = LimitedWriter::new_unlimited(ups_w, wrapper_stats as _);
let ups_r = LimitedReader::new_unlimited(ups_r, wrapper_stats.clone());
let ups_w = LimitedWriter::new_unlimited(ups_w, wrapper_stats);

Ok((Box::new(ups_r), Box::new(ups_w)))
}
4 changes: 2 additions & 2 deletions g3proxy/src/escape/direct_fixed/udp_connect/mod.rs
Original file line number Diff line number Diff line change
@@ -116,14 +116,14 @@ impl DirectFixedEscaper {
self.config.general.udp_sock_speed_limit.shift_millis,
self.config.general.udp_sock_speed_limit.max_south_packets,
self.config.general.udp_sock_speed_limit.max_south_bytes,
wrapper_stats.clone() as _,
wrapper_stats.clone(),
);
let send = LimitedUdpSend::new(
send,
self.config.general.udp_sock_speed_limit.shift_millis,
self.config.general.udp_sock_speed_limit.max_north_packets,
self.config.general.udp_sock_speed_limit.max_north_bytes,
wrapper_stats as _,
wrapper_stats,
);

Ok((
4 changes: 2 additions & 2 deletions g3proxy/src/escape/direct_fixed/udp_relay/mod.rs
Original file line number Diff line number Diff line change
@@ -110,14 +110,14 @@ impl DirectFixedEscaper {
self.config.general.udp_sock_speed_limit.shift_millis,
self.config.general.udp_sock_speed_limit.max_south_packets,
self.config.general.udp_sock_speed_limit.max_south_bytes,
stats.clone() as _,
stats.clone(),
);
let send = LimitedUdpSend::new(
send,
self.config.general.udp_sock_speed_limit.shift_millis,
self.config.general.udp_sock_speed_limit.max_north_packets,
self.config.general.udp_sock_speed_limit.max_north_bytes,
stats.clone() as _,
stats.clone(),
);

Ok((bind_addr, recv, send))
10 changes: 5 additions & 5 deletions g3proxy/src/escape/direct_float/http_forward/mod.rs
Original file line number Diff line number Diff line change
@@ -54,14 +54,14 @@ impl DirectFloatEscaper {
ups_r,
limit_config.shift_millis,
limit_config.max_south,
self.stats.clone() as _,
Arc::new(r_wrapper_stats) as _,
self.stats.clone(),
Arc::new(r_wrapper_stats),
);
let ups_w = LimitedWriter::new(
ups_w,
limit_config.shift_millis,
limit_config.max_north,
Arc::new(w_wrapper_stats) as _,
Arc::new(w_wrapper_stats),
);

let writer = DirectFloatHttpForwardWriter::new(ups_w, Some(Arc::clone(&self.stats)), bind);
@@ -97,9 +97,9 @@ impl DirectFloatEscaper {
let ups_r = LimitedBufReader::new_unlimited(
ups_r,
Arc::new(NilLimitedReaderStats::default()),
wrapper_stats.clone() as _,
wrapper_stats.clone(),
);
let ups_w = LimitedWriter::new_unlimited(ups_w, wrapper_stats as _);
let ups_w = LimitedWriter::new_unlimited(ups_w, wrapper_stats);

let writer = DirectFloatHttpForwardWriter::new(ups_w, None, bind);
let reader = DirectHttpForwardReader::new(ups_r);
4 changes: 2 additions & 2 deletions g3proxy/src/escape/direct_float/http_forward/writer.rs
Original file line number Diff line number Diff line change
@@ -101,11 +101,11 @@ where
if let Some(escaper_stats) = &self.escaper_stats {
let mut wrapper_stats = HttpForwardRemoteWrapperStats::new(escaper_stats, task_stats);
wrapper_stats.push_user_io_stats(user_stats);
self.inner.reset_stats(Arc::new(wrapper_stats) as _);
self.inner.reset_stats(Arc::new(wrapper_stats));
} else {
let mut wrapper_stats = HttpForwardTaskRemoteWrapperStats::new(Arc::clone(task_stats));
wrapper_stats.push_user_io_stats(user_stats);
self.inner.reset_stats(Arc::new(wrapper_stats) as _);
self.inner.reset_stats(Arc::new(wrapper_stats));
}
}

4 changes: 2 additions & 2 deletions g3proxy/src/escape/direct_float/tcp_connect/mod.rs
Original file line number Diff line number Diff line change
@@ -475,13 +475,13 @@ impl DirectFloatEscaper {
r,
limit_config.shift_millis,
limit_config.max_south,
wrapper_stats.clone() as _,
wrapper_stats.clone(),
);
let w = LimitedWriter::new(
w,
limit_config.shift_millis,
limit_config.max_north,
wrapper_stats as _,
wrapper_stats,
);

Ok((Box::new(r), Box::new(w)))
4 changes: 2 additions & 2 deletions g3proxy/src/escape/direct_float/tls_connect/mod.rs
Original file line number Diff line number Diff line change
@@ -112,8 +112,8 @@ impl DirectFloatEscaper {
wrapper_stats.push_other_stats(self.fetch_user_upstream_io_stats(task_notes));
let wrapper_stats = Arc::new(wrapper_stats);

let ups_r = LimitedReader::new_unlimited(ups_r, wrapper_stats.clone() as _);
let ups_w = LimitedWriter::new_unlimited(ups_w, wrapper_stats as _);
let ups_r = LimitedReader::new_unlimited(ups_r, wrapper_stats.clone());
let ups_w = LimitedWriter::new_unlimited(ups_w, wrapper_stats);

Ok((Box::new(ups_r), Box::new(ups_w)))
}
4 changes: 2 additions & 2 deletions g3proxy/src/escape/direct_float/udp_connect/mod.rs
Original file line number Diff line number Diff line change
@@ -119,14 +119,14 @@ impl DirectFloatEscaper {
self.config.general.udp_sock_speed_limit.shift_millis,
self.config.general.udp_sock_speed_limit.max_south_packets,
self.config.general.udp_sock_speed_limit.max_south_bytes,
wrapper_stats.clone() as _,
wrapper_stats.clone(),
);
let send = LimitedUdpSend::new(
send,
self.config.general.udp_sock_speed_limit.shift_millis,
self.config.general.udp_sock_speed_limit.max_north_packets,
self.config.general.udp_sock_speed_limit.max_north_bytes,
wrapper_stats as _,
wrapper_stats,
);

Ok((
4 changes: 2 additions & 2 deletions g3proxy/src/escape/direct_float/udp_relay/mod.rs
Original file line number Diff line number Diff line change
@@ -112,14 +112,14 @@ impl DirectFloatEscaper {
self.config.general.udp_sock_speed_limit.shift_millis,
self.config.general.udp_sock_speed_limit.max_south_packets,
self.config.general.udp_sock_speed_limit.max_south_bytes,
stats.clone() as _,
stats.clone(),
);
let send = LimitedUdpSend::new(
send,
self.config.general.udp_sock_speed_limit.shift_millis,
self.config.general.udp_sock_speed_limit.max_north_packets,
self.config.general.udp_sock_speed_limit.max_north_bytes,
stats.clone() as _,
stats.clone(),
);

Ok((bind_addr, recv, send))
10 changes: 5 additions & 5 deletions g3proxy/src/escape/divert_tcp/http_forward/mod.rs
Original file line number Diff line number Diff line change
@@ -51,14 +51,14 @@ impl DivertTcpEscaper {
ups_r,
limit_config.shift_millis,
limit_config.max_south,
self.stats.clone() as _,
Arc::new(r_wrapper_stats) as _,
self.stats.clone(),
Arc::new(r_wrapper_stats),
);
let ups_w = LimitedWriter::new(
ups_w,
limit_config.shift_millis,
limit_config.max_north,
Arc::new(w_wrapper_stats) as _,
Arc::new(w_wrapper_stats),
);

let writer = DirectHttpForwardWriter::new(ups_w, Some(Arc::clone(&self.stats)));
@@ -94,9 +94,9 @@ impl DivertTcpEscaper {
let ups_r = LimitedBufReader::new_unlimited(
ups_r,
Arc::new(NilLimitedReaderStats::default()),
wrapper_stats.clone() as _,
wrapper_stats.clone(),
);
let ups_w = LimitedWriter::new_unlimited(ups_w, wrapper_stats as _);
let ups_w = LimitedWriter::new_unlimited(ups_w, wrapper_stats);

let writer = DirectHttpForwardWriter::<_, DivertTcpEscaperStats>::new(ups_w, None);
let reader = DirectHttpForwardReader::new(ups_r);
4 changes: 2 additions & 2 deletions g3proxy/src/escape/divert_tcp/mod.rs
Original file line number Diff line number Diff line change
@@ -214,7 +214,7 @@ impl Escaper for DivertTcpEscaper {
}

fn get_escape_stats(&self) -> Option<ArcEscaperStats> {
Some(Arc::clone(&self.stats) as _)
Some(self.stats.clone())
}

async fn publish(&self, _data: String) -> anyhow::Result<()> {
@@ -270,7 +270,7 @@ impl Escaper for DivertTcpEscaper {
}

fn new_http_forward_context(&self, escaper: ArcEscaper) -> BoxHttpForwardContext {
let ctx = DirectHttpForwardContext::new(Arc::clone(&self.stats) as _, escaper);
let ctx = DirectHttpForwardContext::new(self.stats.clone(), escaper);
Box::new(ctx)
}

4 changes: 2 additions & 2 deletions g3proxy/src/escape/divert_tcp/tcp_connect/mod.rs
Original file line number Diff line number Diff line change
@@ -314,13 +314,13 @@ impl DivertTcpEscaper {
r,
limit_config.shift_millis,
limit_config.max_south,
wrapper_stats.clone() as _,
wrapper_stats.clone(),
);
let w = LimitedWriter::new(
w,
limit_config.shift_millis,
limit_config.max_north,
wrapper_stats as _,
wrapper_stats,
);

Ok((Box::new(r), Box::new(w)))
4 changes: 2 additions & 2 deletions g3proxy/src/escape/divert_tcp/tls_connect/mod.rs
Original file line number Diff line number Diff line change
@@ -115,8 +115,8 @@ impl DivertTcpEscaper {
wrapper_stats.push_other_stats(self.fetch_user_upstream_io_stats(task_notes));
let wrapper_stats = Arc::new(wrapper_stats);

let ups_r = LimitedReader::new_unlimited(ups_r, wrapper_stats.clone() as _);
let ups_w = LimitedWriter::new_unlimited(ups_w, wrapper_stats as _);
let ups_r = LimitedReader::new_unlimited(ups_r, wrapper_stats.clone());
let ups_w = LimitedWriter::new_unlimited(ups_w, wrapper_stats);

Ok((Box::new(ups_r), Box::new(ups_w)))
}
4 changes: 2 additions & 2 deletions g3proxy/src/escape/dummy_deny/mod.rs
Original file line number Diff line number Diff line change
@@ -95,7 +95,7 @@ impl Escaper for DummyDenyEscaper {
}

fn get_escape_stats(&self) -> Option<ArcEscaperStats> {
Some(Arc::clone(&self.stats) as _)
Some(self.stats.clone())
}

async fn publish(&self, _data: String) -> anyhow::Result<()> {
@@ -149,7 +149,7 @@ impl Escaper for DummyDenyEscaper {
}

fn new_http_forward_context(&self, escaper: ArcEscaper) -> BoxHttpForwardContext {
let ctx = DirectHttpForwardContext::new(Arc::clone(&self.stats) as _, escaper);
let ctx = DirectHttpForwardContext::new(self.stats.clone(), escaper);
Box::new(ctx)
}

4 changes: 2 additions & 2 deletions g3proxy/src/escape/proxy_float/mod.rs
Original file line number Diff line number Diff line change
@@ -185,7 +185,7 @@ impl Escaper for ProxyFloatEscaper {
}

fn get_escape_stats(&self) -> Option<ArcEscaperStats> {
Some(Arc::clone(&self.stats) as _)
Some(self.stats.clone())
}

async fn publish(&self, data: String) -> anyhow::Result<()> {
@@ -263,7 +263,7 @@ impl Escaper for ProxyFloatEscaper {
}

fn new_http_forward_context(&self, escaper: ArcEscaper) -> BoxHttpForwardContext {
let ctx = DirectHttpForwardContext::new(Arc::clone(&self.stats) as _, escaper);
let ctx = DirectHttpForwardContext::new(self.stats.clone(), escaper);
Box::new(ctx)
}

4 changes: 2 additions & 2 deletions g3proxy/src/escape/proxy_float/peer/http/http_connect/mod.rs
Original file line number Diff line number Diff line change
@@ -172,8 +172,8 @@ impl ProxyFloatHttpPeer {
wrapper_stats.push_other_stats(self.fetch_user_upstream_io_stats(task_notes));
let wrapper_stats = Arc::new(wrapper_stats);

let ups_r = LimitedReader::new_unlimited(ups_r, wrapper_stats.clone() as _);
let ups_w = LimitedWriter::new_unlimited(ups_w, wrapper_stats as _);
let ups_r = LimitedReader::new_unlimited(ups_r, wrapper_stats.clone());
let ups_w = LimitedWriter::new_unlimited(ups_w, wrapper_stats);

Ok((Box::new(ups_r), Box::new(ups_w)))
}
Loading

0 comments on commit a1e6025

Please sign in to comment.