mirror of
https://github.com/System-End/slack-morphism-rust.git
synced 2026-04-19 23:22:56 +00:00
30 lines
875 B
Rust
30 lines
875 B
Rust
use slack_morphism::prelude::*;
|
|
|
|
use hyper_proxy2::{Intercept, Proxy, ProxyConnector};
|
|
|
|
async fn test_proxy_client() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
|
let proxy = {
|
|
let https_connector = hyper_rustls::HttpsConnectorBuilder::new()
|
|
.with_native_roots()?
|
|
.https_only()
|
|
.enable_http2()
|
|
.build();
|
|
|
|
let proxy_uri = "http://proxy.domain.unfortunate.world.example.net:3128"
|
|
.parse()
|
|
.unwrap();
|
|
let proxy = Proxy::new(Intercept::Https, proxy_uri);
|
|
ProxyConnector::from_proxy(https_connector, proxy).unwrap()
|
|
};
|
|
|
|
let _client = SlackClient::new(SlackClientHyperConnector::with_connector(proxy));
|
|
|
|
Ok(())
|
|
}
|
|
|
|
#[tokio::main]
|
|
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
|
test_proxy_client().await?;
|
|
|
|
Ok(())
|
|
}
|