add meter_proxy, a TCP proxy
This commit is contained in:
31
meter_proxy/src/main.rs
Normal file
31
meter_proxy/src/main.rs
Normal file
@@ -0,0 +1,31 @@
|
||||
use meter_proxy::proxy::r#async::AsyncMeterProxy;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
|
||||
// https://github.com/dzobbe/rust-proxy
|
||||
fn main() {
|
||||
println!("Starting Proxy");
|
||||
let meter_proxy = AsyncMeterProxy::new("101.132.122.240".to_owned(), 443, "0.0.0.0".to_owned(), 443);
|
||||
|
||||
let meter_proxy_c = meter_proxy.clone();
|
||||
let _child_proxy = thread::spawn(move || {
|
||||
meter_proxy_c.start();
|
||||
});
|
||||
|
||||
// let mut n=0;
|
||||
// let sleep_time=2000;
|
||||
// while n < 100{
|
||||
// n += 1;
|
||||
|
||||
// //Do something
|
||||
// thread::sleep(Duration::from_millis(sleep_time));
|
||||
|
||||
// println!("The measured latency 'till now: {:.3} ms",meter_proxy.get_latency_ms());
|
||||
// println!("The measured throughput 'till now: {:.3}",meter_proxy.get_num_bytes_rcvd() as f64/(n*sleep_time) as f64);
|
||||
// }
|
||||
|
||||
loop { thread::sleep(Duration::from_millis(10000)); }
|
||||
|
||||
// meter_proxy.stop_and_reset();
|
||||
// let _ = child_proxy.join();
|
||||
}
|
||||
Reference in New Issue
Block a user