-
-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathproxy.rs
More file actions
28 lines (26 loc) · 717 Bytes
/
proxy.rs
File metadata and controls
28 lines (26 loc) · 717 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use trillium_client::Client;
use trillium_logger::Logger;
use trillium_proxy::{
upstream::{ConnectionCounting, IntoUpstreamSelector, UpstreamSelector},
Proxy,
};
use trillium_smol::ClientConfig;
pub fn main() {
env_logger::init();
let upstream = if std::env::args().count() == 1 {
"http://localhost:8080".into_upstream().boxed()
} else {
std::env::args()
.skip(1)
.collect::<ConnectionCounting<_>>()
.boxed()
};
trillium_smol::run((
Logger::new(),
Proxy::new(
Client::new(ClientConfig::default()).with_default_pool(),
upstream,
)
.with_via_pseudonym("trillium-proxy"),
));
}